/* ==========================================================================
   Aakansha Training Administration Interface
   Compact production-quality forms, tables and management screens
   ========================================================================== */

/* Remove public-page spacing when the shared layout renders an admin page. */
body:has(.admin-page) main:not(.admin-page) {
    padding-top: 0;
    padding-bottom: 0;
}

.admin-page {
    width: min(calc(100% - 40px), 1480px);
    margin: 12px auto 36px;
}

.admin-page > .admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 14px;
    padding: 16px 22px;
    border: 1px solid #d9e2f1;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(21, 55, 105, 0.06);
}

.admin-page-header > div:first-child {
    min-width: 0;
}

.admin-page-header h1 {
    margin: 2px 0 4px;
    color: #17489d;
    font-size: clamp(1.65rem, 2.4vw, 2.05rem);
    line-height: 1.15;
}

.admin-page-header h2 {
    margin: 0 0 6px;
    color: #16315e;
    font-size: 1.3rem;
    line-height: 1.25;
}

.admin-page-header p {
    max-width: 760px;
    margin: 0;
    color: #62718d;
    font-size: 0.9rem;
    line-height: 1.4;
}

.admin-eyebrow {
    color: #ef5a14 !important;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.admin-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.admin-card {
    margin-bottom: 18px;
    padding: 18px 22px;
    overflow: hidden;
    border: 1px solid #d9e2f1;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(21, 55, 105, 0.05);
}

.admin-card > form {
    width: min(100%, 1240px);
    margin: 0 auto;
}

/* ==========================================================================
   Compact form grid
   ========================================================================== */

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 22px;
    align-items: start;
}

.admin-field {
    min-width: 0;
}

.admin-field-wide {
    grid-column: 1 / -1;
}

.admin-field label {
    display: block;
    margin-bottom: 7px;
    color: #16284a;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.3;
}

.admin-field label span[aria-hidden="true"] {
    color: #d92d20;
}

.admin-field input:not([type="checkbox"]):not([type="radio"]),
.admin-field select,
.admin-field textarea {
    width: 100%;
    border: 1px solid #cbd7e8;
    border-radius: 9px;
    background: #ffffff;
    color: #18243a;
    font-family: inherit;
    font-size: 0.94rem;
    outline: none;
    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        background-color 0.16s ease;
}

.admin-field input:not([type="checkbox"]):not([type="radio"]),
.admin-field select {
    min-height: 44px;
    padding: 9px 12px;
}

.admin-field textarea {
    min-height: 92px;
    padding: 11px 12px;
    line-height: 1.5;
    resize: vertical;
}

.admin-field #short_description {
    min-height: 92px;
    max-height: 180px;
}

.admin-field #public_notes {
    min-height: 105px;
    max-height: 220px;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
    border-color: #1d55b3;
    box-shadow: 0 0 0 3px rgba(29, 85, 179, 0.13);
}

.admin-field input:disabled,
.admin-field select:disabled,
.admin-field textarea:disabled {
    cursor: not-allowed;
    background: #f2f5fa;
    color: #77839a;
}

.admin-field-help {
    margin: 6px 0 0;
    color: #6a7890;
    font-size: 0.78rem;
    line-height: 1.45;
}

.admin-field-error {
    margin: 6px 0 0;
    color: #c62828;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
}

/* ==========================================================================
   Grouped sections and checkboxes
   ========================================================================== */

.admin-status-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0;
    padding: 20px 22px 22px;
    border: 1px solid #d7e1f0;
    border-radius: 14px;
    background: #f8faff;
}

.admin-status-controls legend {
    padding: 0 8px;
    color: #173a76;
    font-size: 0.96rem;
    font-weight: 700;
}

.admin-status-controls > .admin-form-grid {
    grid-column: 1 / -1;
    width: 100%;
    grid-template-columns:
        minmax(240px, 0.75fr)
        minmax(360px, 1.25fr);
}

.admin-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    margin: 0;
    padding: 10px 13px;
    border: 1px solid #d9e2f1;
    border-radius: 10px;
    background: #ffffff;
    color: #233654;
    font-size: 0.9rem;
    cursor: pointer;
}

.admin-checkbox:hover {
    border-color: #aebfda;
    background: #fbfcff;
}

.admin-checkbox input {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    accent-color: #1d55b3;
}

/* ==========================================================================
   Service-location search
   ========================================================================== */

.admin-status-controls .admin-header-actions {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 9px;
    width: 100%;
}

#batch_location_search_button {
    min-width: 92px;
    min-height: 44px;
    align-self: stretch;
}

#batch_selected_location {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 13px 15px;
}

#batch_selected_location[hidden] {
    display: none;
}

#batch_selected_location_label {
    min-width: 0;
    color: #173a76;
    font-weight: 700;
}

#batch_location_feedback:empty,
#batch_location_results:empty {
    display: none;
}

#batch_location_results .admin-header-actions {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
}

#batch_location_results .admin-secondary-button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 0.82rem;
}

/* ==========================================================================
   Buttons and actions
   ========================================================================== */

.admin-primary-button,
.admin-secondary-button,
.admin-danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 14px;
    border-radius: 9px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
}

.admin-primary-button {
    border: 1px solid #174ca6;
    background: #174ca6;
    color: #ffffff;
}

.admin-primary-button:hover {
    border-color: #123e88;
    background: #123e88;
}

.admin-secondary-button {
    border: 1px solid #1d55b3;
    background: #ffffff;
    color: #174ca6;
}

.admin-secondary-button:hover {
    background: #edf4ff;
}

.admin-danger-button {
    border: 1px solid #dc2626;
    background: #ffffff;
    color: #c52020;
}

.admin-danger-button:hover {
    background: #fff1f1;
}

.admin-primary-button:hover,
.admin-secondary-button:hover,
.admin-danger-button:hover {
    transform: translateY(-1px);
}

.admin-primary-button:disabled,
.admin-secondary-button:disabled,
.admin-danger-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.admin-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px -22px -18px;
    padding: 14px 22px;
    border-top: 1px solid #dfe6f1;
    background: #f8faff;
}

.admin-row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.admin-row-actions form {
    margin: 0;
}

/* ==========================================================================
   Alerts, tables and empty states
   ========================================================================== */

.admin-alert {
    margin-bottom: 20px;
    padding: 13px 16px;
    border: 1px solid #cbd7e8;
    border-radius: 10px;
    background: #f7f9fd;
    color: #283a58;
    font-size: 0.9rem;
    line-height: 1.5;
}

.admin-alert ul {
    margin: 8px 0 0 20px;
}

.admin-alert-success {
    border-color: #a8d5b8;
    background: #effaf3;
    color: #17613a;
}

.admin-alert-error {
    border-color: #efb4b4;
    background: #fff3f3;
    color: #9f1d1d;
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e2e8f1;
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    background: #f5f8fd;
    color: #65738b;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.admin-table-meta {
    margin-top: 3px;
    color: #6e7b90;
    font-size: 0.78rem;
    line-height: 1.35;
}

.admin-empty-state {
    padding: 50px 24px;
    text-align: center;
}

.admin-empty-state h2,
.admin-empty-state h3 {
    margin: 0 0 8px;
    color: #173a76;
}

.admin-empty-state p {
    margin: 0 0 20px;
    color: #6a7890;
}

.admin-status-active,
.admin-status-warning,
.admin-status-inactive {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.admin-status-active {
    background: #e8f7ee;
    color: #18733e;
}

.admin-status-warning {
    background: #fff5db;
    color: #946200;
}

.admin-status-inactive {
    background: #f1f3f6;
    color: #687386;
}

.admin-pagination {
    margin-top: 22px;
}

/* ==========================================================================
   Responsive administration layout
   ========================================================================== */

@media (max-width: 1180px) {
    .admin-page {
        width: min(calc(100% - 28px), 1180px);
    }

    .admin-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-status-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .admin-page {
        width: min(calc(100% - 20px), 820px);
        margin-top: 10px;
    }

    .admin-page > .admin-page-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 16px 18px;
    }

    .admin-header-actions {
        justify-content: flex-start;
    }

    .admin-card {
        padding: 18px;
    }

    .admin-form-grid,
    .admin-status-controls,
    .admin-status-controls > .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-field-wide {
        grid-column: auto;
    }

    .admin-status-controls > .admin-form-grid {
        grid-column: auto;
    }

    .admin-form-actions {
        margin: 20px -18px -18px;
        padding: 14px 18px;
    }
}

@media (max-width: 560px) {
    .admin-page {
        width: calc(100% - 16px);
        margin-bottom: 30px;
    }

    .admin-page > .admin-page-header,
    .admin-card {
        border-radius: 13px;
    }

    .admin-card {
        padding: 18px 15px;
    }

    .admin-status-controls {
        padding: 17px 14px;
    }

    .admin-status-controls .admin-header-actions {
        grid-template-columns: 1fr;
    }

    #batch_location_search_button {
        width: 100%;
    }

    #batch_selected_location {
        grid-template-columns: 1fr;
    }

    .admin-form-actions {
        align-items: stretch;
        flex-direction: column;
        margin: 22px -15px -18px;
        padding: 15px;
    }

    .admin-form-actions .admin-primary-button,
    .admin-form-actions .admin-secondary-button {
        width: 100%;
    }

    .admin-row-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-row-actions a,
    .admin-row-actions button,
    .admin-row-actions form {
        width: 100%;
    }
}
