@import "_alert";
@import "_elements";
@import "_tables";

#pp_cred_wrap h3 {
  font-size: 15px;
}

#pp_cred_wrap h4, #pp_cred_wrap th, #pp_cred_wrap td, #pp_cred_wrap select {
  font-size: 13px;
}

#agent-profile .form-table td, #agent-profile .form-table th {
  line-height: 1.5em;
  padding: 0.2em;
}

#agent-profile .form-table th {
  width: 100px;
}

#pp-permissions-wrapper h1 a {
  color:  @main_color;
}

#pp-permissions-wrapper h1 a:hover {
  text-decoration: underline;
}

table.pp-agent-profile {
  width: 100%;
  margin-bottom: 20px;
}

.pp-group_post-types,
.pp-group-roles {
  background-color: #fff;
  border-color: #6eaebf;
}

.pp-group_members {
	margin: 0 0 20px;
	h3 {
		margin-bottom: 0;
	}
  h4 {
    margin-top: 0;
    margin-bottom: 1.5em;
  }
}

#pp-agent-selection_member-wrapper {
	width: 100%;
	max-width: 800px;
}

body.permissions_page_presspermit-edit-permissions {
	span.select2 {
		width: 100% !important;
	}
}

#agent-profile div.pp-group_members span:not(.select2):not(.select2 span) {
  border: none;
  border-bottom: none;
}

#pp_add_role select,
#pp_add_exception select {
  min-width: 9em;
  margin-bottom: 15px;
}

#pp_add_role {
  width: 100%;

  @media(min-width: 780px) {
    width: 550px;
  }

  .pp-checkbox {
    margin: 3px 0;
  }

  #pp_add_exception .pp-checkbox {
    margin-top: 2px;
    margin-bottom: 10px;
  }
}

#pp_select_x_assign_for .pp-checkbox label {
  vertical-align: baseline;
}

div.pp-add-exceptions {
  padding-top: 10px;
  min-width: 870px;
}

#group-roles-selections {
  margin-top: 20px;
}

#wpbody-content #pp_add_exception #menu-settings-column {
  padding-top: 3px;
}

#pp_add_exception .pp-select-x-operation, #pp_add_exception .pp-select-x-mod-type {
  text-align: left;
  padding-left: 15px;
}

#pp_add_exception .pp-select-x-operation, #pp_add_exception .pp-select-x-mod-type, #pp_add_exception .pp-select-x-via-type {
  padding-top: 5px;
  padding-left: 15px;
  padding-right: 15px;
}

#pp_add_exception .pp-select-x-via-type {
  padding-right: 10px;
}

#pp_add_exception .pp-select-x-operation label, #pp_add_exception .pp-select-x-mod-type label {
  padding-bottom: 20px;
  white-space: nowrap;
}

#pp_add_exception div.pp-checkbox {
  margin-bottom: 10px;
}

#pp_add_exception #select-role-item {
  margin-bottom: 0;
}

#pp_add_exception #nav-menus-frame {
  margin-top: -2.35em;
}

#pp_add_exception #nav-menus-frame h3 {
  padding-top: 8px;
}

#pp_add_exception #nav-menus-frame h3 span {
  font-family: sans-serif;
  font-size: 13px;
  font-weight: bold;
}

#pp_add_exception .nav-tabs-nav, #pp_add_exception button.handlediv {
  display: none;
}

#pp_add_exception .pp-select-items {
  padding-left: 15px;
}

span.nav-tab {
  display: none;
}

.pp-select-items div.postbox {
  padding-bottom: 25px;
  margin-bottom: 0;
}

.pp-edit-msg {
  background-color: #FFFFE0;
  border: 1px solid #ccc;
  padding: 5px;
  margin-top: 0;
  margin-bottom: 5px;
}

#pp-permissions-wrapper #pp_review_roles {
  margin-top: 0;
}

#pp_tbl_role_selections,
#pp_tbl_exception_selections {
  background-color: #909090;
}

#pp_tbl_role_selections thead tr th,
#pp_tbl_role_selections tbody tr td, #pp_tbl_exception_selections thead tr th, #pp_tbl_exception_selections tbody tr td {
  background-color: white;
  padding-left: 0.5em;
  padding-right: 0.5em;
  min-width: 0;
}

#group-exceptions-selections {
  margin-left: 10px;
  margin-right: 10px;
}

#pp_review_exceptions div.mirror-label {
  font-weight: bold;
}

div.mirror-confirm {
  border-left-color: #46b450 !important;
  background: #fff;
  border: 1px solid #ccd0d4;
  border-left-color: rgb(204, 208, 212);
  border-left-width: 1px;
  border-left-width: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
  margin: 5px 15px 2px 0;
  padding: 1px 12px;
}

/*---- Bulk Edit Exceptions ----*/
.pp-role-bulk-edit, .pp-exception-bulk-edit {
  margin: 1em 0 0 0;
}

.pp-role-bulk-edit select, .pp-exception-bulk-edit select {
  min-width: 12em;
}

input.submit-edit-item-role {
  margin-left: 1em;
}

.pp-current-site-roles input {
  margin-left: 1em;
}

.pp-current-site-roles label {
  margin-right: 2em;
  white-space: nowrap;
}


div.pp-current-roles, div.pp-current-exceptions {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

div.pp-current-roles h4, div.pp-current-exceptions h4 {
  margin-bottom: 0.2em;
}

/* ?? */
.pp-current-site-roles label, .pp_item_role_caption {
  color: #21759B;
  font-weight: bold
}

label span.pp_nolink, .pp_item_role_caption span.pp_nolink {
  color: black
}

.pp-taxonomy-caption {
  font-weight: bold;
  margin-bottom: 0.4em
}

.pp-role-terms div {
  margin-bottom: 0.4em;
  color: black
}

.pp-role-container {
  display: flex;
  flex-direction: row;
  label {
    flex: 1;
  }
}

.pp-readonly .pp-current-site-roles label {
  margin: 0 0 0 6px;
}

.pp-current-exceptions table tbody tr td {
  text-align: left;
  background-color: white;
  padding: 0 0.5em 0.2em 0.5em;
  min-width: 0;
  vertical-align: top;
  border-bottom: 1px solid #777;
  border-top: 1px solid white;
}

.pp-current-exceptions table tbody tr th {
  border-top: 1px solid #f2f2f2;
}

.pp-role-terms-wrapper {
  padding-top: 0.2em;
}

.pp-taxonomy-caption {
  text-align: center;
}

div.pp-current-type-roles a {
  margin-left: 5px;
  // display: none;
}

.role_both {
  font-weight: bold;
  color: #120FAF;
}

.role_ch {
  font-weight: bold;
  color: #777;
}

input.exc-copied {
  background-color: #afa !important;
  border: 1px solid black !important;
}

tr.pp_faded td, label.pp_faded {
  color: #aa8d8d;
}

.pp_exceptions_notes {
  margin: 0 0 20px;
  padding: 20px;
  background-color: #FFFFE0;
  border: 1px solid #E6DB55;
}

.pp_exceptions_notes ul {
  list-style-type: circle;
  margin-left: 16px;
}

#agent_submit_member, .pp-members-current #member, .pp-members-current h4 {
  margin-left: 8px;
}

#pp_find_users_field {
  margin-left: 0;
}

#pp-all-anon-warning {
  margin-top: 10px;
  margin-bottom: 10px;
}

#pp_add_exception td.pp-select-x-via-type div, #pp_add_exception td.pp-select-x-status p {
  white-space: nowrap;
}

#pp_add_exception td.pp-select-x-via-type label {
  padding-right: 10px;
}

#pp_add_exception td.pp-select-items, #nav-menus-frame, #nav-menus-frame #menu-settings-column.pp-menu-settings-column {
  width: 100% !important;
}

ul.categorychecklist li.highlight-none {
  font-style: italic;
  font-weight: 600;
}

ul.categorychecklist label {
  vertical-align: top;
}

ul.categorychecklist span {
  font-weight: bold;
  font-size: 120%;
  cursor: cell;
}

.tabs-panel-view-all ul.categorychecklist span {
  display: inline-block;
  width: 12px;
}

#nav-menus-frame .add-to-menu {
  float: none;
  margin-left: 15px;
}

td.pp-select-items #nav-menu-meta div.tabs-panel ul li label {
  vertical-align: baseline;
}

// Pagination CSS
.add-menu-item-pagelinks {
  display: flex;
  gap: 5px;
  justify-content: center;
  align-items: center;
  margin: 20px 0;

  .page-numbers {
    padding: 4px 10px;
    border: 1px solid #ddd;
    background: #f7f7f7;
    color: #0073aa;
    text-decoration: none;
    border-radius: 4px;
    min-width: 8px!important;

    &:hover {
      background: #0073aa;
      color: #fff !important;
      font-weight: bold;
    }
  }

  .current {
    background: #0073aa;
    color: #fff;
    font-weight: bold;
    border: 1px solid #0073aa;
  }

  .next,
  .prev {
    font-weight: bold;
  }
}

.sectionSubsection(){
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
  }

  .table {
    margin-bottom: 0;
  }

  .header {
    margin-bottom: 32px;
  }

  .header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    color: #111827;
  }

  .permission-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 36px;
  }

  .section-header {
    padding: 16px 24px;
    background-color: #dedfe0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
  }

  .section-header:hover {
    background-color: #e3e4e5;
  }

  .subsection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
  }

  .section-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
    color: #374151;
  }

  .section-controls {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .search-box {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-size: 14px;
    width: 200px;
  }

  .icon-guidance {
    padding: 12px 24px;
  }

  .checkbox-column {
    width: 1%;
    text-align: center;
  }

  .permission-type {
    padding: 12px 24px 12px 24px;
    margin-bottom: 6px;
  }

  .permission-type:last-child {
    border-bottom: none;
  }

  .permission-type thead tr th {
    border-top: none;
  }

  .permission-type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
  }

  .permission-type-title {
    margin-top: 6px;
    margin-bottom: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
  }

  .permission-type-title .badge {
    margin-left: 8px;
  }

  .permission-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
  }

  .permission-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
  }

  .permission-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
  }

  .status-enabled {
    background-color: #10b981;
  }

  .status-blocked {
    background-color: #ef4444;
  }

  .status-limited {
    background-color: #f59e0b;
  }

  .permission-name {
    flex-grow: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .permission-actions {
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
  }

  .permission-item:hover .permission-actions {
    opacity: 1;
  }

  .btn {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    background: none;
  }

  .btn-edit {
    color: #4f46e5;
  }

  .btn-edit:hover {
    background-color: rgba(79, 70, 229, 0.1);
  }

  .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
  }

  .for-type .badge {
    padding: 2px 8px 1px 8px;
  }

  .badge-info {
    background-color: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
  }

  .badge-count {
    background-color: rgba(255, 255, 255, 0.7);
    color: #6b7280;
  }

  .mod-type-key {
    padding-right: 50px !important;
  }

  .notes {
    padding: 16px 24px;
    font-size: 13px;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
    background-color: #f9fafb;
    text-align: center;
  }

  .notes span {
    padding-right: 20px;
    white-space: nowrap;
  }

  .notes strong {
    color: #374151;
  }
  
  .notes-main {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .footer-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
  }

  .btn-primary {
    background-color: #4f46e5;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
  }

  .btn-link {
    color: #4f46e5;
    background: none;
    font-weight: 500;
  }

  .pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
  }

  .page-btn {
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 4px;
    cursor: pointer;
  }

  .page-btn.active {
    background-color: #4f46e5;
    color: white;
    border-color: #4f46e5;
  }

  .expand-icon {
    transition: transform 0.2s;
  }

  .collapsed .expand-icon {
    transform: rotate(-90deg);
  }

  .hidden {
    display: none;
  }

  .no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 16px;
    color: #6b7280;
    font-style: italic;
  }

  table tr td {
    vertical-align: middle;
  }

  .checkbox-column,
  .icon-column {
    width: 20px;
  }

  .status-column {
    width: 20%;
  }

  .assign-for-column {
    width: 25px;
  }

  td.assign-for-column {
    text-align: right;
    padding-right: 0;
  }

  i.assign-child {
    color: #999;
    border: 1px dashed #999;
    padding: 0 1px;
  }

  i.assign-both {
    color: #120faf;
    font-style: bold;
    padding: 0 1px;
  }

  .icon-column {
    vertical-align: bottom;
  }

  .edit-column {
    width: 10%;
    text-align: right;
  }
}

#pp_current_exceptions {
  margin-top: 36px;
  margin-bottom: 80px;
  .sectionSubsection();
}

#pp_current_roles, .pp_current_exceptions_profile, .pp_user_profile {
  margin-top: 24px;
  margin-bottom: 16px;

  .sectionSubsection();

  a:hover {
    text-decoration: underline;
  }

  .checkbox-column {
    width: 1%;
    text-align: center;
  }

  .pp_nolink{
    font-weight: bold;
    color: #000;
  }

  .role-column {
    width: 40%;
  }

  .edit-column {
    width: 10%;
    text-align: right;
  }
  
  table tr th {
    text-align: left;
  }

  td {
    label,
    input {
      vertical-align: text-top;
    }
  }
}

.pp-agent-profile {
    .pp-user-avatar-cell {
        width: 100px;
        vertical-align: top;
        padding-right: 20px;

        img {
            border-radius: 4px;
            border: 2px solid #ddd;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }
    }

    .pp-user-info-cell {
        vertical-align: top;
    }

    .pp-user-actions-cell {
        width: 200px;
        vertical-align: top;
        text-align: right;
        padding-left: 20px;
    }

    tr {
        @media screen and (max-width: 782px) {
            display: block;
        }
    }
}

.pp-user-quick-links {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;

    a {
        display: block;
        padding: 6px 0;
        text-decoration: none;
        font-size: 13px;

        &:before {
            content: "→ ";
            margin-right: 5px;
        }
    }
}

.pp-user-login {
    color: #666;
    font-size: 13px;
    margin-left: 8px;
}

.pp-user-meta-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pp-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

@media screen and (max-width: 782px) {
    .pp-agent-profile .pp-user-avatar-cell,
    .pp-agent-profile .pp-user-info-cell,
    .pp-agent-profile .pp-user-actions-cell {
        display: block;
        width: 100%;
        padding: 10px 0;
    }

    .pp-agent-profile .pp-user-actions-cell {
        text-align: left;
    }
}


// Design consistency
#pp-permissions-wrapper {
  .ppTables();
  .ppAlertBoxes();
}