/*
   Admin Schools page — districts table with expandable nested schools rows.
   ────────────────────────────────────────────────────────────────────────
   Reuses the same Tailwind-Slate token palette as admin-users.css for
   consistency. No KPI cards — just header, toolbar, and the table.
*/

.admin-schools {
    color: #0f172a;
}

/* ═══════════════════════════════════════════════════════
   Page header — eyebrow / title / subtitle / primary CTA
   ═══════════════════════════════════════════════════════ */
.admin-schools-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.admin-schools-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.375rem;
}

.admin-schools-title {
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: #0f172a;
    margin: 0;
}

.admin-schools-subtitle {
    margin: 0.375rem 0 0;
    font-size: 0.875rem;
    color: #475569;
}

.admin-schools-primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.admin-schools-primary-btn:hover {
    background: #1e293b;
}

.admin-schools-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Secondary action — county creation is rarer than district creation, so it
   reads as subordinate to the filled primary button beside it. */
.admin-schools-secondary-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: #fff;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.admin-schools-secondary-btn:hover {
    background: #f8fafc;
}

/* ═══════════════════════════════════════════════════════
   Toolbar — search + count
   ═══════════════════════════════════════════════════════ */
.admin-schools-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.admin-schools-search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 24rem;
}

.admin-schools-search-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    font-size: 0.875rem;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-schools-search-input::placeholder {
    color: #94a3b8;
}

.admin-schools-search-input:focus {
    outline: none;
    border-color: #0f172a;
    box-shadow: 0 0 0 1px #0f172a;
}

.admin-schools-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 1rem !important;
}

.admin-schools-filter {
    flex: 0 0 auto;
}

.admin-schools-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: #64748b;
}

/* ═══════════════════════════════════════════════════════
   Districts table
   ═══════════════════════════════════════════════════════ */
.admin-schools-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-schools-table thead th {
    background: #f8fafc;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
}

.admin-schools-table thead th.text-right {
    text-align: right;
}

.admin-schools-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
}

.admin-schools-table tbody tr:last-child {
    border-bottom: none;
}

/* District row */
.admin-schools-table .district-row {
    cursor: pointer;
    transition: background 0.12s ease;
}

.admin-schools-table .district-row:hover {
    background: #f8fafc;
}

.admin-schools-table .district-row.expanded {
    background: #f8fafc;
}

.admin-schools-table .district-row td {
    padding: 0.875rem 1.25rem;
    color: #334155;
    vertical-align: middle;
}

.admin-schools-table .district-row td.text-right {
    text-align: right;
}

.admin-schools-district-name {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.admin-schools-chevron {
    color: #94a3b8 !important;
    transition: transform 0.15s ease, color 0.15s ease;
    font-size: 1.125rem !important;
}

.district-row.expanded .admin-schools-chevron {
    transform: rotate(90deg);
    color: #334155 !important;
}

/* ═══════════════════════════════════════════════════════
   County sections

   Each county is its own section wrapping a districts table, so that table
   keeps honest column headers. This is the same card-inside-a-row idiom the
   schools table already uses inside a district, applied one tier up.
   ═══════════════════════════════════════════════════════ */

.county-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.county-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 1.25rem;
    background: #f8fafc;
    cursor: pointer;
    transition: background 0.12s ease;
}

.county-header:hover {
    background: #f1f5f9;
}

.county-header.expanded {
    border-bottom: 1px solid #e2e8f0;
}

.county-header-name {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.county-header.expanded .admin-schools-chevron {
    transform: rotate(90deg);
    color: #334155 !important;
}

.county-name-text {
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #0f172a;
}

.county-body {
    /* The districts table draws its own borders; no padding so it sits flush
       against the section edges the way the schools table does. */
    overflow-x: auto;
}

/* The county header is already a grey band. Left at its default #f8fafc the
   column header would butt straight against it as a second grey band, so inside
   a section the column header goes white and leans on its border instead. */
.county-body .admin-schools-table thead th {
    background: #fff;
}

.county-empty-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
    font-size: 0.8125rem;
    color: #64748b;
}

.admin-schools-empty-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
}

.admin-schools-name-text {
    font-weight: 500;
    color: #0f172a;
}

.admin-schools-name-sub {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.125rem;
}

.admin-schools-region {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: #475569;
}

.admin-schools-region-icon {
    color: #94a3b8 !important;
    font-size: 0.875rem !important;
}

.admin-schools-count-cell {
    font-variant-numeric: tabular-nums;
    color: #334155;
}

/* ═══════════════════════════════════════════════════════
   Action icon buttons (View / Edit / Delete)
   ═══════════════════════════════════════════════════════ */
.admin-schools-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.375rem;
}

.admin-schools-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.admin-schools-icon-btn:hover {
    background: #f8fafc;
    color: #0f172a;
}

.admin-schools-icon-btn .mud-icon-root {
    font-size: 1rem !important;
}

.admin-schools-icon-btn.danger {
    color: #b91c1c;
}

.admin-schools-icon-btn.danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* ═══════════════════════════════════════════════════════
   Expanded detail row — nested schools card
   ═══════════════════════════════════════════════════════ */
.district-detail-cell {
    background: #f8fafc;
    padding: 0.5rem 1.25rem 1.25rem;
}

.district-detail-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.district-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.district-detail-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #0f172a;
}

.district-detail-title-icon {
    color: #64748b !important;
    font-size: 1rem !important;
}

.district-detail-count-pill {
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
    padding: 0.125rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   District type chips
   ═══════════════════════════════════════════════════════ */

.admin-field-hint {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.admin-field-hint.warn {
    color: #b45309;
}

.district-type-chip {
    display: inline-block;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.district-type-chip.type-public {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.district-type-chip.type-charter {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

.district-type-chip.type-private {
    background: #faf5ff;
    color: #7e22ce;
    border-color: #e9d5ff;
}

.district-type-chip.type-other {
    background: #f8fafc;
    color: #475569;
    border-color: #e2e8f0;
}

.district-detail-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 6px;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: background 0.12s ease;
}

.district-detail-add-btn:hover {
    background: #f8fafc;
}

.district-detail-add-btn .mud-icon-root {
    font-size: 0.875rem !important;
}

.district-detail-empty {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
}

/* Nested schools table */
.schools-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.schools-table thead th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.625rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.schools-table thead th.text-right {
    text-align: right;
}

.schools-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s ease;
}

.schools-table tbody tr:hover {
    background: #f8fafc;
}

.schools-table tbody tr:last-child {
    border-bottom: none;
}

.schools-table tbody td {
    padding: 0.75rem 1rem;
    color: #334155;
    vertical-align: middle;
}

.schools-table tbody td.text-right {
    text-align: right;
}

.school-name {
    font-weight: 500;
    color: #0f172a;
}

.school-coord-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.school-coord-pill.set {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.school-coord-pill.unset {
    color: #64748b;
    background: #f1f5f9;
    border-color: #e2e8f0;
}

/* ═══════════════════════════════════════════════════════
   Empty state
   ═══════════════════════════════════════════════════════ */
.admin-schools-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
}

/* ═══════════════════════════════════════════════════════
   Helper hint below the table
   ═══════════════════════════════════════════════════════ */
.admin-schools-hint {
    margin-top: 0.875rem;
    font-size: 0.75rem;
    color: #64748b;
}

/* ═══════════════════════════════════════════════════════
   Two-column form grid for the school modal
   ═══════════════════════════════════════════════════════ */
.admin-schools-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.admin-schools-form-grid .admin-field.col-span-2 {
    grid-column: span 2;
}

.admin-schools-form-grid .admin-field {
    margin-bottom: 0;
}
