/**
 *   Prevent page width change when scroll is required.
 *   Helps reduce screen redraws.
 */
body.page-admin-people-permissions {
  overflow-y: scroll;
}

#user-admin-permissions.ctools-use-modal-processed .compact-link {
  display:none;
}

/* Disable the hand tool styling that admin_menu adds for module rows. */
.fpa-container tr.admin-menu-tweak-permissions-processed {
  cursor: default;
}

.fpa-container .form-submit {
  margin: 1em;
}

/**
 *   Prevent vertical jitter of dummy checkboxes.
 */
.fpa-container .dummy-checkbox {
  vertical-align: middle;
}

.fpa-container {
  width: 100%;
}

/**
 *   Override admin_menu's "Collapse module groups on the Permissions page" functionality.
 */
.fpa-container tr.element-hidden {
  display: table-row;
}

.fpa-left-section,
.fpa-right-section {
  display: table-cell;
  border: 1px solid #D6DBDE;
  vertical-align: top;
}

.fpa-left-section {
  background-color: #F6F6F6;
  width: 1px; /* Keep column as small as possible. Table cells automatically push wider. */
}

.fpa-left-section .item-list ul {
  background-color: #EFEFEF;
  list-style: none;
  margin:0;
  padding: 0;
  text-align: left;
}

.fpa-left-section .item-list li {
  background-color: inherit;
  border-bottom: 1px solid #D6DBDE;
  cursor: pointer;
  font-size: 90%;
  line-height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
  position: relative; /* Fix for IE disappearing bg with negative margin */
}

.fpa-left-section .item-list li > div {
  display: table;
  width: 100%;
}

.fpa-left-section .item-list li a,
.fpa-left-section .item-list li .fpa-perm-total {
  display: table-cell;
  padding: 0.5em;
}

.fpa-left-section .item-list li .fpa-perm-total {
  min-width: 6em;
}

.fpa-left-section .item-list li a {
  text-decoration: none;
  color: inherit;
}

.fpa-left-section .item-list li .fpa-perm-total {
  text-align: right;
}

.fpa-right-section {
  width: 100%;
  background-color: white;
  border-left-width: 0;
}

.fpa-filter-form {
  .form-item {
    display: inline-block;
    padding: 3px 10px;
    vertical-align: top;
    float: none;
  }
  
  .form-checkboxes .form-type-checkbox,
  .form-radios .form-type-radio {
    display: block;
  }
}

.fpa-filter-form .clear-search {
  cursor: pointer;
  display: inline-block;
}

.fpa-right-section .fpa-table-wrapper {
  padding: 10px;
}

/**
 *   Module filter 2.x has a simple permissions filter. Hide this if FPA is enabled.
 */
.fpa-table-wrapper .module-filter-inputs-wrapper .form-item-module-filter-name {
  display: none;
}

/**
 *   CTools attempts some styling to compact forms, looks bad with FPA.
 */
div.ctools-modal-content .fpa-container .form-item label {
  float: none;
  width: auto;
}

/*
 * Rubik has some aggressive styling which makes FPA look poor, reset it here.
 */
.fpa-container .block,
.fpa-container .item-list,
.fpa-container .help-items ul,
.fpa-container .form-item,
.fpa-container .confirmation ul,
.fpa-container .admin-list,
.fpa-container .node-type-list,
.fpa-container .admin-panel {
  border-width: 0;
}

/**
 *   Styling for matching permissions counter.
 */
.fpa-left-section li[fpa-module] {
  counter-reset: fpa-module-permissions;
}

.fpa-perm-counter {
  display: inline;
  counter-increment: fpa-module-permissions;
}

.fpa-perm-total:before {
  content: counter(fpa-module-permissions);
}

.fpa-perm-total:after {
  content: " of " attr(fpa-total);
}

.fpa-toggle-container {
  padding: 0.5em;
}

.fpa-toggle-container a {
  margin: 0.5em;
}

.fpa-hide-descriptions table#permissions .description {
  display: none;
}

.fpa-table-wrapper tr:before {
  white-space: nowrap;
  
  .fpa-hide-system-names & {
    display: none;
  }
}

// Need to have this to now interfere with admin_menu.
.fpa-table-wrapper thead tr:before {
  content: "System Name";
  display: table-cell;
  
  border-bottom: 3px solid #ccc;
  padding-right: 1em;
  text-align: left;
  
  vertical-align: middle;
  padding: 8px 10px;
  border: 0;
  color: #000;
  
  text-transform: uppercase;
  background: #e1e2dc;
  font-weight: normal;
  border-width: 1px;
  border-style: solid;
  border-color: #bebfb9;
}

.fpa-table-wrapper tbody tr {
  &:before {
    content: attr(fpa-system-name);
    display: table-cell;
    
    vertical-align: middle;
    padding: 8px 10px;
    border: 0;
    color: #000;
    
    text-align: left;
  }
  
  &.fpa-module-row:before {
    font-weight: bold;
  }
  
  &.fpa-permission-row:before {
    padding-left: 1.5em;
  }
}

/**
 *   Styling for injected checkboxes.
 */

.fpa-table-wrapper th.checkbox {
  vertical-align: bottom;
}

.fpa-table-wrapper th input[type="checkbox"] {
  display: block;
  margin: 0.5em auto;
}

.fpa-hide-descriptions a[fpa-toggle-class="fpa-hide-descriptions"]:before {
  content: attr(show);
}

a[fpa-toggle-class="fpa-hide-descriptions"]:before {
  content: attr(hide);
}


.fpa-hide-system-names a[fpa-toggle-class="fpa-hide-system-names"]:before {
  content: attr(show);
}

a[fpa-toggle-class="fpa-hide-system-names"]:before {
  content: attr(hide);
}

#user-admin-permissions .form-submit.fpa-clear-search {
  margin: 0;
}

.fpa-mobile input[type="checkbox"] {
  width: 4em;
  height: 4em;
}

.fpa-permission-container {
  display: table;
  width: 100%;
}

.fpa-row-toggle-container {
  display: table-cell;
  vertical-align: middle;
  width: 2em;
  text-align: center;
}

td.checkbox,
.fpa-row-toggle-container {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#permissions td {
  text-align: center;
}

#permissions td.permission,
#permissions td.module {
  text-align: left;
}

/**
 * [checked] is HTML attribute. ':checked' selector is based on DOM property.
 *
 * IE: Both :checked and box-shadow are only supported on IE9+, so <=IE8 will not see this feature at all.
 */

.fpa-table-wrapper td.checkbox input[type="checkbox"] {
  border-collapse: separate;
  
  // [checked] = state of page load.
  // :checked  = current state.
  &:not([checked]):checked {
    box-shadow: 0px 0px 10px 6px rgba(0, 255, 0, 0.5);
  }
  
  &[checked]:not(:checked) {
    box-shadow: 0px 0px 10px 6px rgba(255, 0, 0, 0.5);
  }
}

/**
 * Hide aspects of FPA that depend on JS.
 */
.fpa-checkboxes-toggle {
  visibility: hidden;
}

html.js .fpa-checkboxes-toggle {
  visibility: inherit;
}

.fpa-filter-form {
  display: none;
}

html.js .fpa-filter-form {
  display: block;
}



/**
 * Tweak how the table is initially displayed to prevent premature reflow.
 * 
 * The table is displayed with a <style /> tag immediately after in the HTML.
 */
#permissions {
  display: none;
}

.fpa-table-wrapper {
  background-repeat: no-repeat;
  background-position: center -18px;
  background-image: url('data:image/gif;base64,R0lGODlhDwAoAMQAAAAAAAhzvQx7vRh7xhyExjWQykaczlqi02uv2Iu/4bW1taDO57XW7729vb3e78bGxs7OztbW1t7e3sri89bn997v9+fn5+fv9+f3/+/v7+/3//f39/f3//f//////wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFBgAAACwAAAAADwAoAAAFxiAgApkUWduoAhukvC+UqlujNFD0vI2nuo8ZyRYZZW5C0VExkyiKK8DOIoooJFGAFQtwQldTJXK1FAKFGSLNpsjtbj6aC/ZMqkone3bP7/v/gIGCfhQJCAsVexUGAY2NBxorFQIBAgQBl5gcKowFFQkBCROXCCMUlRceoAkeE42RAAsBCB6qobWMDCIIt7asHrwJIqC0HgwHDLgBugCnAqm1ta4BsACdFdETA7Mqk40GCIyaKxfijgjVKxQLh4mD7/Dx8vIhAAAh+QQFBgAAACwAABQADQANAAAFRyAgAtOSANqoriI3XgQQFEchFunqcUQwvCpPImBwiC6rikxpc5wQooNKulgApIALwjVyTGQskcAzinVZ5qsNsA5HkSvkaRUCACH5BAUGAAAALAAAFAANAA0AAAU/ICAC11iNY4mKKnCKxsqtoudNwjgBweg5hZ7AIzqwjAECDSVI0BAoVYEFyK0cvFZhJ+KmRtOYSGNazlZe8igEACH5BAUGAAAALAAAFAANAA0AAAVIICACVIKMKFClooYKAIwYIsGmtkjFqOdNgIALcAI4EsiEjXFKiJyBaACARDEO2MNydwMChqLVTQUDGIoAAmd0YSHAo91JLAoBACH5BAUGAAAALAAAFAANAA0AAAVJICAC05IA2qiuIjdeBBAUx1ikbH7lgCPuqgvi4vEUeieEqCZIeGqLBaAG2AUChKNjIlM5CgGAwDOKjRyClXl6BLR5U2AQcFqFAAAh+QQFBgAAACwAABQADQANAAAFQCAgAtdYjWOJiipwigZQjNy6DuMEBLYueKIDqgaI2UQJ4AohqvAqShJAMEoEDI5dq6DjEHio7UpjOhJROhF5FAIAIfkEBQYAAAAsAAAUAA0ADQAABUUgIAIUgIwoUKWihgoAjBgiwaa2WMJ34JoiR8KBYpwSIuToqEwCEh4AjVEaJQLQSQtVuSYmAy6PEMgROKMLC/FDlU6rUQgAIfkEBQYAAAAsAAAUAA0ADQAABUYgIAITkADaqK4iN14EEBTHWKRsfuWAI+6qCwJX6J0QohoSUFssmL2AACdylAKAQmDhGQm6osHM4/GtYtlDMcsbHYBBEysEACH5BAUGAAAALAAAFAANAA0AAAVBICAC11iNY4mKKnCKBlCM3LoO4wQEti54ooPoVAPEUJwEzwYj8BCjGUkUMFCAAMeuRZhgdagWbKQxMYsoMKA8CgEAIfkEBQYAAAAsAAAUAA0ADQAABUkgIAJUgowoUKWihgoAjBgiwaa2SMU3EGgJAOFAPDBQjFNgKQoCTs5CYppwiGiMneDi8YwmrVFh1avAAIZTjTO6sBCu1O5EFoUAACH5BAUGAAAALAAAFAANAA0AAAVIICAC05IA2qiuIjdeBBAUx1ikY8yKlxwYlJGDtwAYCIEAAlcAOE4IzgmAENWKgIPHU4mqHBPZDiDw5L4sXbYJYI+zvVVvqgoBACH5BAUGAAAALAAAFAANAA0AAAVBICAC11iNY4mKKnCixcitQSwO48QWwSLqAo/o4HEABCPDyuM5rFAIFkAjspWQK2OgVdD9VlyAUkQVvVazlXeKCgEAOw==');
  min-height: 18px;
}



.fpa-role-styles,
.fpa-perm-styles {
  display: none;
}

.fpa-wrapper {
  display: table;// Need this to go full width.
}

.dummy-checkbox {
  display: none;
}

.fpa-authenticated-role-behavior {
  input[type="checkbox"] {
    display: none;
    
    &.rid-1, &.rid-2, &.dummy-checkbox {
      display: inline-block;
    }
  }
}