/**
 * @file
 * CiviCRM CSS overrides for NDI CiviCRM Demtools
 */

/**
 * Mobile menu
 */
#toolbar-administration > #toolbar-bar > .toolbar-tab:last-child {
  /* This accidentally fixes the Drupal 'account' icon overlapping with the CiviCRM menu */
  float: right;
}
#civicrm-menu-nav .crm-menubar-toggle-btn {
  width: 75px !important;
}

/**
 * Drupal page title and shortcut icon
 */
#block-seven-page-title {
  position: relative;
}
#block-seven-page-title .shortcut-action {
  position: absolute;
  right: 0;
  top: 10px;
  width: 10px;
  height: 5px;
}

/**
 * Multiple contact update (form CRM_Contact_Form_Task_Batch)
 * Sticky column and row headers. Issue#48
 */
.crm-container .CRM_Contact_Form_Task_Batch thead > tr > th,
.crm-container .CRM_Contact_Form_Task_Batch thead > tr > td {
  position: sticky;
  top: 45px;
  background-color: #E6E6E6 !important;
  z-index: 99999; /* must be over the rule below */
}
.crm-container .CRM_Contact_Form_Task_Batch thead > tr > td:first-child,
.crm-container .CRM_Contact_Form_Task_Batch thead > tr > th:first-child,
.crm-container .CRM_Contact_Form_Task_Batch tbody > tr > td:first-child {
  position: sticky;
  left: 0px;
  background-color: #f2f2f2 !important;
  z-index: 9999; /* over the inputs */
}

/**
 * New/Edit Contact form
 * Display of custom fields for addresses (important for sub-countries, if used).
 */
.crm-container #addressBlockId table.crm-edit-address-form > tbody > tr:last-child > td {
  /* Display address custom fields custom fields under the main adderss fields (not on the right) */
  display: block;
  padding-bottom: 0;
}
.crm-container #addressBlockId table.crm-edit-address-form .crm-edit-address-custom_data .collapsible-title {
  /* Hide the group title of custom fields */
  display: none;
}
.crm-container #addressBlockId table.crm-edit-address-form .crm-edit-address-custom_data table {
  /* Fix alignment with other address fields */
  margin-left: 5px;
}
.crm-container #addressBlockId table.crm-edit-address-form .crm-edit-address-custom_data table > tbody > tr > td,
.crm-container .CRM_Contact_Form_Inline_Address .crm-edit-address-custom_data table > tbody > tr > td {
  /* Display the label on top of the field, as with other address fields */
  display: block;
  /* Fix alignment */
  padding: 0;
}

/**
 * Contact Address Inline Edit
 */
.crm-container .CRM_Contact_Form_Inline_Address .crm-edit-address-custom_data .crm-collapsible {
  /* Remove Shoreditch shadow on custom groups */
  box-shadow: none;
  /* Fix alignment with other address fields */
  margin: 0;
  padding: 0 !important;
  padding-left: 6px !important;
}
.crm-container .CRM_Contact_Form_Inline_Address .crm-edit-address-custom_data .collapsible-title {
  /* Hide custom group titles */
  display: none;
}

/**
 * View Contact
 */
.crm-container .crm-contact-page div.address .collapsible-title {
  display: none;
}
.crm-container .crm-contact-page div.address .crm-summary-block {
  margin: 0 !important;
  padding: 0 !important;
}

/**
 * Advanced Search
 * Try to make the District (sub-county) field look more normal.
 */
.crm-container .CRM_Contact_Form_Search_Advanced #address_subcounty .crm-accordion-header {
  display: none;
}
.crm-container .CRM_Contact_Form_Search_Advanced #address_subcounty .crm-accordion-body {
  box-shadow: none;
  padding: 0 !important;
}
.crm-container .CRM_Contact_Form_Search_Advanced #address_subcounty table td {
  display: block;
  padding-left: 0;
}
.crm-container .CRM_Contact_Form_Search_Advanced #address_subcounty table td label {
  display: block;
  text-align: left;
}

/**
 * FormBuilder forms (applied to both frontend and backend forms)
 */
#crm-main-content-wrapper > crm-angular-js > form#bootstrap-theme {
  /* Based on .crm-form-block of shoreditch */
  background: #fff;
  box-shadow: 0 3px 18px 0 rgba(48,40,40,0.25);
  border-radius: 2px !important;
}
#crm-main-content-wrapper > crm-angular-js > form#bootstrap-theme fieldset {
  padding: 0.5em;
}
#crm-main-content-wrapper > crm-angular-js > form#bootstrap-theme .crm-af-field,
#crm-main-content-wrapper > crm-angular-js > form#bootstrap-theme .af-field-type-select,
#crm-main-content-wrapper > crm-angular-js > form#bootstrap-theme .select2-container {
  max-width: 600px;
}
#crm-main-content-wrapper > crm-angular-js > form#bootstrap-theme .crm-form-date {
  display: inline-block;
  max-width: 200px;
}
#crm-main-content-wrapper > crm-angular-js > form#bootstrap-theme af-form > .af-button {
  margin: 1em;
}

/**
 * Petitions (tested with Shoreditch)
 */
.crm-container form.CRM_Campaign_Form_Petition_Signature #intro {
  padding: 20px;
}
.crm-container form.CRM_Campaign_Form_Petition_Signature .crm-petition-contact-profile,
.crm-container form.CRM_Campaign_Form_Petition_Signature .crm-petition-activity-profile {
  padding: 0 20px;
}
/* Separate the personal-info from the activity-info */
.crm-container form.CRM_Campaign_Form_Petition_Signature .crm-petition-contact-profile {
  background: #d6f1ff;
  padding-bottom: 1em;
}
/* Display labels full-width, because the questions can be long */
.crm-container form.CRM_Campaign_Form_Petition_Signature .crm-section > .label {
  float: none;
  display: block;
  width: 100%;
  text-align: inherit;
}
.crm-container form.CRM_Campaign_Form_Petition_Signature .crm-section > .content {
  float: none;
  display: block;
  width: 100%;
  margin-left: 0;
  margin-top: 0;
}
/* Undo some styling from shoreditch */
.crm-container form.CRM_Campaign_Form_Petition_Signature label[for] {
  font-weight: normal !important;
}
.crm-container form.CRM_Campaign_Form_Petition_Signature tr {
  border: none;
}
