/* ==========================================================================
   Queue Management System — Admin Portal
   Served from /public/css (no npm / Vite build step)
   Theme: purple primary · dark sidebar · light gray canvas
   ========================================================================== */

:root {
    /* Sidebar */
    --color-sidebar: #1a1630;
    --color-sidebar-surface: #221f38;
    --color-sidebar-hover: rgba(124, 58, 237, 0.12);
    --color-sidebar-active: #7C3AED;
    --color-sidebar-text: #b8b3c8;
    --color-sidebar-text-hover: #f0eef5;
    --color-sidebar-border: rgba(255, 255, 255, 0.06);

    /* Brand / Primary */
    --color-primary: #7C3AED;
    --color-primary-hover: #6D28D9;
    --color-primary-light: #EDE9FE;
    --color-primary-dark: #5B21B6;
    --color-primary-soft: rgba(124, 58, 237, 0.15);

    /* Canvas */
    --color-content-bg: #f1f5f9;
    --color-surface: #ffffff;
    --color-warning: #d97706;
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-info: #2563eb;

    /* Text */
    --color-text: #0f172a;
    --color-muted: #64748b;
    --color-border: #e2e8f0;

    /* Spacing / Radii */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.625rem;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);

    /* Layout */
    --sidebar-width: 16.5rem;
    --header-height: 3.75rem;

    /* Typography */
    --font-sans: "Segoe UI", "Noto Sans Bengali", "Helvetica Neue", Arial, sans-serif;
}

/* Reset / Base ---------------------------------------------------------- */

*,
*::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;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Layout Shell ---------------------------------------------------------- */

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

/* Sidebar --------------------------------------------------------------- */

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

.admin-sidebar::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6rem;
    background: linear-gradient(to top, var(--color-sidebar) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

/* Brand area ------------------------------------------------------------ */

.admin-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--header-height);
    padding: 0 1.25rem;
    background: rgba(124, 58, 237, 0.1);
    border-bottom: 1px solid var(--color-sidebar-border);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.admin-sidebar__brand::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-primary);
}

.admin-sidebar__logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary) 0%, #a855f7 100%);
    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;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.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.12);
    padding: 0.15rem;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(168, 85, 247, 0.1) 100%);
}

.admin-brand-logo--auth {
    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.9rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
}

.admin-sidebar__brand-text span {
    font-size: 0.68rem;
    color: var(--color-sidebar-text);
    letter-spacing: 0.03em;
}

/* Nav area -------------------------------------------------------------- */

.admin-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.625rem 2rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.admin-sidebar__nav::-webkit-scrollbar {
    width: 4px;
}

.admin-sidebar__nav::-webkit-scrollbar-track {
    background: transparent;
}

.admin-sidebar__nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

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

/* Nav link / toggle (base) ---------------------------------------------- */

.admin-sidebar__link,
.admin-sidebar__toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    color: var(--color-sidebar-text);
    text-decoration: none;
    font-size: 0.845rem;
    font-weight: 500;
    letter-spacing: 0.005em;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
    transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
    position: relative;
}

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

/* Section toggle (expanded) --------------------------------------------- */

.admin-sidebar__toggle[aria-expanded="true"] {
    background: var(--color-sidebar-hover);
    color: var(--color-sidebar-text-hover);
}

.admin-sidebar__toggle[aria-expanded="true"] .admin-sidebar__icon {
    color: var(--color-primary);
}

/* Section active -------------------------------------------------------- */

.admin-sidebar__link.is-active,
.admin-sidebar__toggle.is-active {
    background: var(--color-sidebar-hover);
    color: var(--color-sidebar-text-hover);
}

/* Exact active — pill style --------------------------------------------- */

.admin-sidebar__link.is-exact-active {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.admin-sidebar__link.is-exact-active .admin-sidebar__icon {
    color: #fff;
}

/* Icons ----------------------------------------------------------------- */

.admin-sidebar__icon {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    opacity: 0.75;
    transition: opacity 150ms ease, color 150ms ease;
}

.admin-sidebar__link:hover .admin-sidebar__icon,
.admin-sidebar__toggle:hover .admin-sidebar__icon {
    opacity: 1;
}

.admin-sidebar__link.is-exact-active .admin-sidebar__icon {
    opacity: 1;
    color: #fff;
}

/* Chevron --------------------------------------------------------------- */

.admin-sidebar__chevron {
    margin-left: auto;
    width: 0.85rem;
    height: 0.85rem;
    opacity: 0.5;
    transition: transform 200ms ease, opacity 150ms ease;
}

.admin-sidebar__toggle:hover .admin-sidebar__chevron {
    opacity: 0.8;
}

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

/* Children (dropdown) --------------------------------------------------- */

.admin-sidebar__children {
    display: none;
    padding: 0.2rem 0 0.35rem 0;
    overflow: hidden;
}

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

.admin-sidebar__child {
    display: block;
    padding: 0.45rem 0.85rem 0.45rem 2.35rem;
    border-radius: var(--radius-sm);
    color: var(--color-sidebar-text);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 450;
    letter-spacing: 0.005em;
    transition: background 120ms ease, color 120ms ease;
    position: relative;
}

.admin-sidebar__child::before {
    content: "";
    position: absolute;
    left: 1.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: background 120ms ease, transform 120ms ease;
}

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

.admin-sidebar__child:hover::before {
    background: var(--color-sidebar-text-hover);
}

.admin-sidebar__child.is-active {
    color: #fff;
    background: var(--color-primary);
    font-weight: 600;
}

.admin-sidebar__child.is-active::before {
    background: #fff;
    transform: translateY(-50%) scale(1.25);
}

/* Main content ---------------------------------------------------------- */

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

/* Header ---------------------------------------------------------------- */

.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;
    transition: border-color 120ms ease;
}

.admin-header__menu-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.admin-header__title {
    margin: 0;
    font-size: 1.1rem;
    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--image 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.85rem;
    font-weight: 600;
}

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

/* Content area ---------------------------------------------------------- */

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

/* Breadcrumbs ----------------------------------------------------------- */

.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;
    font-weight: 500;
}

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

.admin-breadcrumb__sep {
    opacity: 0.4;
}

/* Overlay (mobile sidebar) ---------------------------------------------- */

.admin-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 35;
}

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

/* Forms ----------------------------------------------------------------- */

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

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

/* Stat cards ------------------------------------------------------------ */

.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: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    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.85rem;
    color: var(--color-muted);
}

/* 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 ------------------------------------------------------------ */

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); }
}

/* 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;
    }
}

@media (prefers-reduced-motion: reduce) {
    .admin-sidebar__link,
    .admin-sidebar__toggle,
    .admin-sidebar__child,
    .admin-sidebar__chevron,
    .admin-sidebar__icon,
    .admin-header__menu-btn,
    .btn-spinner {
        transition: none;
    }

    .btn-spinner {
        animation: none;
        border-right-color: currentColor;
        opacity: 0.5;
    }
}
