/* ==========================================================
   ADMIN UI – SHARED BASELINE
   Used by:
   - Users
   - School Years
   - Schools
   - Federations
   ========================================================== */


/* ==========================================================
   PAGE
   ========================================================== */

.page-container {
    padding: 20px;
    margin: 0 auto;
    max-width: 1200px;
    box-sizing: border-box;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.page-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}


/* ==========================================================
   TOOLBAR / SEARCH / FILTERS
   ========================================================== */

.users-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.filter-left,
.filter-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.result-info {
    font-size: 13px;
    color: #666;
}


/* ==========================================================
   TOOLBAR BUTTONS
   ========================================================== */

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    height: 34px;
    padding: 6px 12px;

    font-size: 14px;
    font-weight: 500;

    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 6px;

    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.toolbar-btn:hover {
    background: #f6f7f8;
    border-color: #999;
}

/* Chevron rotation for Filters buttons */
.toolbar-btn .chevron {
    font-size: 1.3em;
    line-height: 1;
    transition: transform 180ms ease;
}

.toolbar-btn.open .chevron {
    transform: rotate(180deg);
}

/* Inline checkbox inside advanced filters */
.filter-checkbox {
    display: flex;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;

    font-size: 13px;
    font-weight: 500;
    color: #444;

    cursor: pointer;
    user-select: none;
}

.checkbox-inline input[type="checkbox"] {
    margin: 0;
}

.clickable {
    cursor: pointer;
    color: #3a3a3a;
    text-decoration: underline;
}
.clickable:hover {
    text-decoration: underline;
}

/* ==========================================================
   ADMIN TABLE – SEARCH INPUT
   ========================================================== */

.table-search-input {
    height: 34px;                 /* match toolbar buttons */
    width: 320px;

    padding: 6px 12px;
    font-size: 14px;

    border: 1px solid #ccc;
    border-radius: 6px;

    background: #ffffff;
    color: #2f2f2f;

    box-sizing: border-box;
}

/* Hover: same subtle feedback as buttons */
.table-search-input:hover {
    border-color: #999;
}

/* Focus: visible but calm */
.table-search-input:focus {
    outline: none;
    border-color: #666;
    background: #ffffff;
}

/* Placeholder tone */
.table-search-input::placeholder {
    color: #999;
}


/* ==========================================================
   ADVANCED FILTERS PANEL
   ========================================================== */

.advanced-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;

    padding: 14px;
    margin-bottom: 16px;

    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 6px;

    max-height: 0;
    opacity: 0;
    overflow: hidden;

    transition:
            max-height 220ms ease,
            opacity 160ms ease;
}

.advanced-filters.open {
    max-height: 260px;
    opacity: 1;
}

.advanced-filters.hidden {
    display: none;
}

.filter-field {
    display: flex;
    flex-direction: column;
}

.filter-field label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #444;
}

.filter-field select {
    min-height: 90px;
    padding: 6px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.advanced-filters-footer {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

/* ==========================================================
   TABLE WRAPPER (horizontal scroll when needed)
   ========================================================== */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

/* Prevent scrollbar from touching content */
.table-wrapper::-webkit-scrollbar {
    height: 10px;
}


/* ==========================================================
   ADMIN TABLE (GENERIC – NO COLUMN LOGIC)
   ========================================================== */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 14px;
    table-layout: fixed;
}

.admin-table thead {
    background: #2e2e2e;
    color: #ffffff;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;

    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-table tbody tr:hover {
    background: #f5f6f7;
}

/* Sortable headers */
.admin-table th {
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: nowrap;
    padding-right: 22px;
    text-align: left;
    opacity: 0.85;
}

.admin-table th:hover {
    background: #3a3a3a;
    opacity: 1;
}

/* Sort indicators */
.admin-table th.sorted-asc::after,
.admin-table th.sorted-desc::after {
    position: absolute;
    padding-left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75em;
    opacity: 0.8;
}

.admin-table th.sorted-asc::after { content: "▲"; }
.admin-table th.sorted-desc::after { content: "▼"; }


/* ==========================================================
   CLICKABLE NAME (EDIT)
   ========================================================== */

.clickable-name {
    cursor: pointer;
    color: #2f2f2f;
    text-decoration: underline;
    text-decoration-color: #8c8c8c;
    text-underline-offset: 2px;
}

.clickable-name:hover {
    color: #111;
    text-decoration-color: #555;
}


/* ==========================================================
   STATUS / ACCOUNT STATE
   ========================================================== */

.account-state {
    text-align: center;
    cursor: pointer;
}

.account-state:hover .badge {
    filter: brightness(0.95);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;

    border-radius: 12px;
    white-space: nowrap;
}

.badge-active {
    background: #e6f4ea;
    color: #1e7e34;
}

.badge-inactive {
    background: #fdecea;
    color: #a94442;
}

.badge img {
    width: 8px;
    height: 8px;
}


/* Account state icons (Users) */

.state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.state-icon img {
    width: 20px;
    height: 20px;
}

.state-icon[data-can-toggle="true"] {
    cursor: pointer;
}

.state-icon[data-can-toggle="true"]:hover {
    filter: brightness(0.9);
}


/* ==========================================================
   EMPTY STATE
   ========================================================== */

.empty-state {
    text-align: center;
    padding: 16px;
    color: #777;
    font-style: italic;
}


/* ==========================================================
   MODAL
   ========================================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #ffffff;
    width: 420px;
    max-width: 95%;

    padding: 24px 28px;
    border-radius: 6px;
}

.modal-content h2 {
    margin: 0 0 16px;
    font-size: 18px;
}


/* ==========================================================
   MODAL FORM ELEMENTS
   ========================================================== */

.modal-content label {
    display: block;
    font-size: 13px;
    margin-bottom: 16px;
}

/* Inputs & selects share the same baseline */
.modal-content input,
.modal-content select {
    width: 100%;
    box-sizing: border-box;

    padding: 10px 12px;
    margin-top: 6px;

    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Multi-selects */
.modal-content select[multiple] {
    min-height: 110px;
    resize: vertical;
}

/* Toolbar buttons inside modals (e.g. Force password reset) */
.modal-content .toolbar-btn {
    align-self: flex-start;
    background: #f6f7f8;
    border-color: #ccc;
}


/* ==========================================================
   MODAL SECTIONS
   ========================================================== */

.modal-section {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.section-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Hint / helper text */
.hint-text {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
    line-height: 1.4;
}


/* ==========================================================
   MODAL ACTIONS & BUTTONS
   ========================================================== */

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.primary-btn,
.secondary-btn {
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
}

.primary-btn {
    background: #ffffff;
    border: 1px solid #ccc;
}

/*
.primary-btn:hover {
    background: #f6f7f8;
    border-color: #999;
}
*/

.primary-btn:not(:disabled):hover {
    background: #f6f7f8;
    border-color: #999;
}

.secondary-btn {
    background: #e0e0e0;
    border: 1px solid #ccc;
}

/*
.secondary-btn:hover {
    background: #d0d0d0;
}
*/
.secondary-btn:not(:disabled):hover {
    background: #d0d0d0;
}

/* ==========================================================
   DISABLED BUTTONS
   ========================================================== */

.primary-btn:disabled,
.secondary-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background-color: #e5e5e5;
    border-color: #ccc;
    color: #777;
}