/* ==========================================================================
   Parking Management System — Admin Portal
   Served from /public/css (no npm / Vite build step)
   Theme: deep teal primary · charcoal sidebar · light gray canvas
   ========================================================================== */

:root {
    --color-sidebar: #1e293b;
    --color-sidebar-hover: #334155;
    --color-sidebar-active: #0f766e;
    --color-primary: #0f766e;
    --color-primary-hover: #0d9488;
    --color-primary-light: #ccfbf1;
    --color-primary-dark: #115e59;
    --color-content-bg: #f1f5f9;
    --color-surface: #ffffff;
    --color-warning: #d97706;
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-info: #2563eb;
    --color-text: #0f172a;
    --color-muted: #64748b;
    --color-border: #e2e8f0;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.625rem;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --sidebar-width: 16.5rem;
    --header-height: 3.75rem;
    --font-sans: "Segoe UI", "Noto Sans Bengali", "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: auto;
}

body.admin-body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-content-bg);
    min-height: 100vh;
}

/* Focus visibility (accessibility) -------------------------------------- */

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Layout shell ----------------------------------------------------------- */

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    color: #e2e8f0;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
}

.admin-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--header-height);
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.admin-sidebar__logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.admin-brand-logo {
    object-fit: contain;
    flex-shrink: 0;
    background: #fff;
}

.admin-brand-logo--sidebar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.15rem;
}

.admin-brand-logo--auth {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 0.2rem;
}

.admin-sidebar__brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    flex: 1;
}

.admin-sidebar__brand-text strong {
    font-size: 0.95rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar__brand-text span {
    font-size: 0.7rem;
    color: #94a3b8;
}

.admin-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem 1.5rem;
}

.admin-sidebar__section {
    margin-bottom: 0.35rem;
}

.admin-sidebar__link,
.admin-sidebar__toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
}

.admin-sidebar__link:hover,
.admin-sidebar__toggle:hover {
    background: var(--color-sidebar-hover);
    color: #fff;
}

.admin-sidebar__link.is-active,
.admin-sidebar__toggle.is-active {
    background: rgba(15, 118, 110, 0.35);
    color: #fff;
}

.admin-sidebar__link.is-exact-active {
    background: var(--color-sidebar-active);
    color: #fff;
}

.admin-sidebar__icon {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    opacity: 0.9;
}

.admin-sidebar__chevron {
    margin-left: auto;
    width: 0.9rem;
    height: 0.9rem;
    opacity: 0.7;
}

.admin-sidebar__toggle[aria-expanded="true"] .admin-sidebar__chevron {
    transform: rotate(180deg);
}

.admin-sidebar__children {
    display: none;
    padding: 0.15rem 0 0.35rem 0.5rem;
}

.admin-sidebar__children.is-open {
    display: block;
}

.admin-sidebar__child {
    display: block;
    padding: 0.5rem 0.85rem 0.5rem 2.35rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8125rem;
}

.admin-sidebar__child:hover {
    color: #fff;
    background: var(--color-sidebar-hover);
}

.admin-sidebar__child.is-active {
    color: #fff;
    background: var(--color-sidebar-active);
}

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 30;
}

.admin-header__left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.admin-header__menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
}

.admin-header__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-header__profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-header__avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    overflow: hidden;
    flex-shrink: 0;
}

.admin-header__avatar--image {
    background: transparent;
    padding: 0;
}

.admin-header__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-header__user {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.admin-header__user strong {
    font-size: 0.875rem;
}

.admin-header__user span {
    font-size: 0.75rem;
    color: var(--color-muted);
}

.admin-content {
    padding: 1.25rem;
    flex: 1;
}

.admin-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    color: var(--color-muted);
}

.admin-breadcrumb a {
    color: var(--color-primary);
    text-decoration: none;
}

.admin-breadcrumb a:hover {
    text-decoration: underline;
}

.admin-breadcrumb__sep {
    opacity: 0.5;
}

.admin-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 35;
}

.admin-overlay.is-visible {
    display: block;
}

/* Form validation -------------------------------------------------------- */

.field-error {
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: var(--color-danger);
}

.is-invalid {
    border-color: var(--color-danger) !important;
}

/* Stat cards (dashboard / reports) -------------------------------------- */

.stat-card {
    position: relative;
    border-left: 3px solid var(--color-border);
}

.stat-card--brand { border-left-color: var(--color-primary); }
.stat-card--success { border-left-color: var(--color-success); }
.stat-card--danger { border-left-color: var(--color-danger); }
.stat-card--warning { border-left-color: var(--color-warning); }
.stat-card--info { border-left-color: var(--color-info); }
.stat-card--neutral { border-left-color: #94a3b8; }

.stat-card__label {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.stat-card__value {
    margin: 0.5rem 0 0;
    font-size: 1.75rem;
    font-weight: 650;
    line-height: 1.15;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.stat-card__hint {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Tables ----------------------------------------------------------------- */

.admin-table-wrap {
    overflow: auto;
    max-height: min(70vh, 42rem);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.admin-table-wrap table {
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    box-shadow: inset 0 -1px 0 var(--color-border);
}

.admin-table-wrap tbody tr:hover td {
    background: #f8fafc;
}

/* Pagination (Laravel Tailwind default) --------------------------------- */

nav[role="navigation"][aria-label="Pagination Navigation"] span,
nav[role="navigation"][aria-label="Pagination Navigation"] a {
    font-size: 0.8125rem;
}

/* Loading ---------------------------------------------------------------- */

.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.72;
}

.btn-spinner {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 9999px;
    animation: admin-spin 0.6s linear infinite;
    vertical-align: -0.1rem;
}

@keyframes admin-spin {
    to { transform: rotate(360deg); }
}

/* Slot occupancy grid ---------------------------------------------------- */

.slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.25rem, 1fr));
    gap: 0.65rem;
}

.slot-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 7rem;
    padding: 0.7rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    text-decoration: none;
    background: #fff;
}

.slot-card:hover {
    box-shadow: var(--shadow-sm);
}

.slot-card:focus-visible {
    outline-offset: 2px;
}

.slot-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.35rem;
}

.slot-card__code {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.slot-card__icon {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    opacity: 0.9;
}

.slot-card__status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    width: fit-content;
    padding: 0.15rem 0.45rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.slot-card__meta {
    margin-top: auto;
    font-size: 0.68rem;
    line-height: 1.4;
    word-break: break-word;
}

.slot-card__ticket {
    font-weight: 600;
}

.slot-card--available {
    background: #f0fdf4;
    border-color: #86efac;
    color: #14532d;
}

.slot-card--available .slot-card__status {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.slot-card--occupied {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #7f1d1d;
}

.slot-card--occupied .slot-card__status {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.slot-card--disabled {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

.slot-card--disabled .slot-card__status {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #334155;
}

.slot-card--maintenance {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.slot-card--maintenance .slot-card__status {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.slot-card--reserved {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e3a8a;
}

.slot-card--reserved .slot-card__status {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

.slot-legend {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-muted);
}

.slot-legend__swatch {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 0.15rem;
    border: 1px solid transparent;
}

.slot-legend--available .slot-legend__swatch { background: #86efac; border-color: #22c55e; }
.slot-legend--occupied .slot-legend__swatch { background: #fca5a5; border-color: #ef4444; }
.slot-legend--disabled .slot-legend__swatch { background: #cbd5e1; border-color: #94a3b8; }
.slot-legend--maintenance .slot-legend__swatch { background: #fcd34d; border-color: #f59e0b; }
.slot-legend--reserved .slot-legend__swatch { background: #93c5fd; border-color: #3b82f6; }

.slot-legend__mark {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-text);
}

/* Chart containers — keep charts subordinate to KPIs -------------------- */

.chart-panel {
    position: relative;
    height: 11.5rem;
}

.chart-panel--compact {
    height: 10.5rem;
    max-width: 16rem;
    margin-inline: auto;
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 1023px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.is-open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-header__menu-btn {
        display: inline-flex;
    }

    .admin-header__user span {
        display: none;
    }
}

@media (max-width: 640px) {
    .admin-content {
        padding: 1rem;
    }

    .admin-header {
        padding: 0 0.85rem;
    }

    .stat-card__value {
        font-size: 1.4rem;
    }

    .slot-grid {
        grid-template-columns: repeat(auto-fill, minmax(7.25rem, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-spinner {
        animation: none;
        border-right-color: currentColor;
        opacity: 0.5;
    }
}
