/* ═══════════════════════════════════════════════════════════════════
   Admin UI — fullabrz dashboard
   ═══════════════════════════════════════════════════════════════════ */

/* ── Shell ── */
.adm-shell {
    display: flex;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #F1F5F9;
}

/* ── Sidebar ── */
.adm-sidebar {
    width: 240px;
    min-height: 100vh;
    background: #fff;
    box-shadow: 1px 0 0 #E2E8F0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* ── Logo ── */
.adm-logo-img {
    display: block;
    height: 56px;
    width: auto;
    object-fit: contain;
    padding: 0.75rem 1rem;
}

/* ── Nav ── */
.adm-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.5rem 0.625rem;
    flex: 1;
}

.adm-nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5625rem 0.75rem;
    border-radius: 8px;
    color: #64748B;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}

.adm-nav-item:hover {
    background: #F8FAFC;
    color: #1E293B;
    text-decoration: none;
}

.adm-nav-active,
.adm-nav-active:hover {
    background: #EFF6FF;
    color: #2563EB;
    text-decoration: none;
}

.adm-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
}

/* ── Sidebar footer ── */
.adm-sidebar-footer {
    padding: 0.75rem 0.625rem 1rem;
    margin-top: auto;
}

.adm-help-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: #EFF6FF;
    border-radius: 10px;
    padding: 0.75rem;
}

.adm-help-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #DBEAFE;
    color: #2563EB;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    line-height: 1;
}

.adm-help-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1E293B;
    line-height: 1.3;
}

.adm-help-link {
    font-size: 0.75rem;
    color: #2563EB;
    text-decoration: none;
    font-weight: 500;
    display: block;
}

.adm-help-link:hover {
    text-decoration: underline;
}

/* ── Body + topbar ── */
.adm-body {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.adm-topbar-right {
    position: absolute;
    top: 1.375rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    z-index: 10;
}

.adm-bell {
    position: relative;
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748B;
    padding: 0;
    line-height: 1;
}

.adm-bell svg {
    width: 16px;
    height: 16px;
}

.adm-bell-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    background: #2563EB;
    border-radius: 50%;
    border: 1.5px solid #fff;
}

.adm-avatar-wrap {
    position: relative;
}

.adm-avatar {
    width: 36px;
    height: 36px;
    background: #2563EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    padding: 0;
}

.adm-avatar svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.adm-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.adm-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    z-index: 100;
    overflow: hidden;
}

.adm-user-menu-email {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: #64748B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adm-user-menu-divider {
    height: 1px;
    background: #F1F5F9;
}

.adm-user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.875rem;
    color: #DC2626;
    cursor: pointer;
}

.adm-user-menu-item:hover {
    background: #FEF2F2;
}

.adm-user-menu-item svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    flex-shrink: 0;
}

/* ── Content area ── */
.adm-content {
    flex: 1;
    padding: 1.5rem;
}

/* ── Page header ── */
.adm-page-header {
    margin-bottom: 1.5rem;
    padding-right: 110px;
}

.adm-page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0F172A;
    margin: 0 0 0.125rem;
    line-height: 1.3;
}

.adm-page-header p {
    font-size: 0.875rem;
    color: #64748B;
    margin: 0;
}

/* ── KPI grids ── */
.adm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.adm-kpi-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* ── KPI card ── */
.adm-kpi-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.125rem;
    box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.adm-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.adm-kpi-icon svg {
    width: 22px;
    height: 22px;
}

.adm-kpi-icon-text {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1;
}

.adm-kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748B;
    margin-bottom: 0.125rem;
}

.adm-kpi-value {
    font-size: 1.625rem;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.15;
}

.adm-kpi-sub {
    font-size: 0.7rem;
    color: #94A3B8;
    margin-top: 0.125rem;
}

/* ── KPI icon color variants ── */
.adm-icon-blue   { background: #DBEAFE; color: #3B82F6; }
.adm-icon-green  { background: #DCFCE7; color: #22C55E; }
.adm-icon-purple { background: #F3E8FF; color: #A855F7; }
.adm-icon-amber  { background: #FEF3C7; color: #F59E0B; }
.adm-icon-violet { background: #EDE9FE; color: #8B5CF6; }
.adm-icon-orange { background: #FFEDD5; color: #F97316; }

.adm-icon-blue svg, .adm-icon-blue .adm-kpi-icon-text   { stroke: #3B82F6; color: #3B82F6; }
.adm-icon-green svg, .adm-icon-green .adm-kpi-icon-text  { stroke: #22C55E; color: #22C55E; }
.adm-icon-purple svg, .adm-icon-purple .adm-kpi-icon-text { stroke: #A855F7; color: #A855F7; }
.adm-icon-amber svg, .adm-icon-amber .adm-kpi-icon-text  { stroke: #F59E0B; color: #F59E0B; }
.adm-icon-violet svg, .adm-icon-violet .adm-kpi-icon-text { stroke: #8B5CF6; color: #8B5CF6; }
.adm-icon-orange svg, .adm-icon-orange .adm-kpi-icon-text { stroke: #F97316; color: #F97316; }

/* ── Panels ── */
.adm-panel {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    margin-bottom: 1rem;
}

.adm-panel-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0F172A;
    margin: 0 0 1rem;
}

.adm-panel-row {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 1rem;
    margin-bottom: 0;
    align-items: start;
}

.adm-panel-row .adm-panel {
    margin-bottom: 0;
}

/* ── Empty state ── */
.adm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.75rem 0 0.75rem;
    gap: 0.5rem;
}

.adm-empty svg {
    width: 52px;
    height: 52px;
    color: #CBD5E1;
    opacity: 0.8;
}

.adm-empty p {
    font-size: 0.85rem;
    color: #94A3B8;
    margin: 0;
}

/* ── Admin table ── */
.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.adm-table th {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0.5rem 0.625rem;
    border-bottom: 1px solid #F1F5F9;
    text-align: left;
}

.adm-table td {
    padding: 0.625rem 0.5rem;
    color: #1E293B;
    border-bottom: 1px solid #F8FAFC;
    vertical-align: middle;
}

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

/* ── Badges ── */
.adm-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}
.adm-badge-success { background: #DCFCE7; color: #16A34A; }
.adm-badge-warning { background: #FEF3C7; color: #D97706; }
.adm-badge-neutral { background: #F1F5F9; color: #64748B; }
.adm-badge-error   { background: #FEE2E2; color: #DC2626; }

/* ── Shared form/edit panel ── */
.adm-form-card {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

/* ── Coming soon stub ── */
.adm-coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    gap: 0.75rem;
    color: #94A3B8;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15,23,42,.06);
    padding: 2rem;
}

.adm-coming-soon svg {
    width: 64px;
    height: 64px;
    color: #CBD5E1;
}

.adm-coming-soon h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #64748B;
    margin: 0;
}

.adm-coming-soon p {
    font-size: 0.875rem;
    margin: 0;
    color: #94A3B8;
}

/* ── Loading ── */
.adm-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    color: #64748B;
    font-size: 0.875rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .adm-sidebar { width: 200px; }
    .adm-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .adm-kpi-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .adm-panel-row { grid-template-columns: 1fr; }
}

/* Mobile app bar — only rendered visible at phone widths */
.adm-mobile-bar { display: none; }

@media (max-width: 640px) {
    .adm-mobile-bar {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 0.75rem;
        background: #fff;
        box-shadow: 0 1px 0 #E2E8F0;
        z-index: 30;
    }

    .adm-nav-toggle {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: #334155;
        padding: 0;
        cursor: pointer;
    }

    .adm-nav-toggle svg { width: 22px; height: 22px; }
    .adm-mobile-logo { height: 32px; width: auto; }

    /* Bell/avatar join the bar instead of floating beside the page heading */
    .adm-topbar-right { position: fixed; top: 10px; right: 0.75rem; z-index: 31; }
    .adm-content { padding: calc(56px + 1rem) 1rem 1rem; }
    .adm-page-header { padding-right: 0; }

    /* Sidebar becomes an off-canvas drawer. Layering: bar 30 < topbar 31 <
       delete modal 200 < backdrop 300 < drawer 310. */
    .adm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 260px;
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 310;
    }

    .adm-sidebar.is-open {
        transform: none;
        box-shadow: 4px 0 24px rgba(15,23,42,.18);
    }

    .adm-drawer-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,.45);
        z-index: 300;
    }

    .adm-kpi-grid { grid-template-columns: 1fr; }
    .adm-kpi-grid-3 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .adm-sidebar { transition: none; }
}
