/* ============================================================
   Eventio Super Admin — Design System
   ============================================================ */

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

:root {
    --primary:        #16a34a;
    --primary-light:  #f0fdf4;
    --primary-hover:  #15803d;
    --sidebar-bg:     #14532d;
    --sidebar-hover:  #166534;
    --sidebar-active: #166534;
    --sidebar-border: #166534;
    --sidebar-text:   #86efac;
    --sidebar-width:  240px;
    --topbar-height:  56px;
    --page-bg:        #f0fdf4;
    --card-bg:        #ffffff;
    --card-border:    #dcfce7;
    --card-shadow:    0 1px 4px rgba(20,83,45,.06), 0 0 0 1px rgba(20,83,45,.04);
    --card-shadow-md: 0 4px 16px rgba(20,83,45,.10), 0 0 0 1px rgba(20,83,45,.04);
    --text-primary:   #14532d;
    --text-secondary: #374151;
    --text-muted:     #6b7280;
    --border:         #d1fae5;
    --border-focus:   var(--primary);
    --input-bg:       #ffffff;
    --radius-sm:      .375rem;
    --radius:         .5rem;
    --radius-lg:      .75rem;
    --radius-xl:      1rem;
    --font:           -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

html, body {
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--page-bg);
    -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────────── */

.admin-body {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
    padding: 0 1rem;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid var(--sidebar-border);
    color: white;
    font-weight: 700;
    font-size: .9375rem;
    letter-spacing: -.01em;
    flex-shrink: 0;
}
.sidebar-brand svg { flex-shrink: 0; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand small {
    display: block;
    font-weight: 400;
    font-size: .65rem;
    color: #ffffff;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: .75rem .625rem;
    display: flex;
    flex-direction: column;
    gap: .125rem;
}

.sidebar-section-label {
    font-size: .625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #4ade80;
    padding: .75rem .5rem .3rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .5rem .625rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background .12s, color .12s;
}
.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #dcfce7;
}
.sidebar-nav a.active {
    background: rgba(22,163,74,.2);
    color: #bbf7d0;
}
.sidebar-nav a.active .nav-icon-wrap {
    background: var(--primary);
    color: white;
}

.nav-icon-wrap {
    width: 1.625rem;
    height: 1.625rem;
    border-radius: .3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    background: rgba(0,0,0,.2);
    flex-shrink: 0;
    transition: background .12s, color .12s;
}
.sidebar-nav a:hover .nav-icon-wrap {
    background: rgba(0,0,0,.3);
}

.nav-icon { font-size: .875rem; }

.sidebar-footer {
    padding: .875rem 1rem;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: .625rem;
    flex-shrink: 0;
}
.sidebar-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(0,0,0,.25);
    color: #bbf7d0;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-user { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: .75rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.logout-link {
    font-size: .7rem;
    color: #86efac;
    text-decoration: none;
    transition: color .12s;
}
.logout-link:hover { color: #dcfce7; }

/* ── Main area ───────────────────────────────────────────────── */

.admin-main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    gap: 1rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .8125rem;
    color: var(--text-muted);
}
.topbar-breadcrumb .current {
    color: var(--text-primary);
    font-weight: 600;
}
.topbar-sep { color: var(--border); }

.admin-content {
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
    padding: 1.75rem;
    flex: 1;
}

/* ── Flash / Alerts ──────────────────────────────────────────── */

.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: .8125rem;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    border: 1px solid transparent;
}
.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}
.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}
.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

/* ── Page header ─────────────────────────────────────────────── */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text-primary);
}
.page-sub {
    color: var(--text-secondary);
    margin-top: .25rem;
    font-size: .8125rem;
}

/* ── Cards ───────────────────────────────────────────────────── */

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-weight: 600;
    font-size: .9375rem;
    color: var(--text-primary);
}
.card-text {
    font-size: .8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: .25rem;
}

/* ── Stats ───────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    opacity: 0;
    transition: opacity .2s;
}
.stat-card:hover::before { opacity: 1; }
.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -.03em;
    line-height: 1;
}
.stat-label {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .4rem;
    font-weight: 500;
}

/* ── Tables ──────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8125rem;
}
.table th {
    text-align: left;
    padding: .625rem 1.25rem;
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: .75rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: var(--text-secondary);
}
.table td strong { color: var(--text-primary); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover td { background: #fafbfc; }
.td-actions {
    display: flex;
    gap: .375rem;
    justify-content: flex-end;
    align-items: center;
}
.empty-row {
    color: var(--text-muted);
    padding: 3rem 1.25rem !important;
    text-align: center;
    font-size: .875rem;
}
.empty-row a { color: var(--primary); text-decoration: none; }
.empty-row a:hover { text-decoration: underline; }

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .08s;
    white-space: nowrap;
    line-height: 1;
    font-family: var(--font);
    letter-spacing: -.005em;
}
.btn:active { transform: scale(.98); }

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary-hover);
    box-shadow: 0 1px 2px rgba(22,163,74,.3), inset 0 1px 0 rgba(255,255,255,.1);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 6px rgba(22,163,74,.35);
}

.btn-secondary {
    background: white;
    color: var(--text-secondary);
    border-color: var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-danger {
    background: white;
    color: #dc2626;
    border-color: #fecaca;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.btn-danger:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}

.btn-full { width: 100%; }
.btn-sm { padding: .3rem .7rem; font-size: .75rem; }
.btn-lg { padding: .65rem 1.25rem; font-size: .9rem; }
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: .35rem;
    color: var(--text-muted);
    font-size: 1rem;
    border-radius: var(--radius-sm);
    transition: background .12s, color .12s;
    line-height: 1;
    font-family: var(--font);
}
.btn-icon:hover { background: #f1f5f9; color: var(--text-primary); }

/* ── Forms ───────────────────────────────────────────────────── */

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.375rem;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.form-group label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -.005em;
}
.form-group input,
.form-group select,
.form-group textarea {
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--input-bg);
    width: 100%;
    transition: border-color .12s, box-shadow .12s;
    line-height: 1.4;
}
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #cbd5e1;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.form-group input[readonly] {
    background: #f8fafc;
    color: var(--text-secondary);
}
.form-group textarea {
    resize: vertical;
    min-height: 88px;
}
.form-hint {
    font-size: .7rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.form-section-title {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    padding-top: .75rem;
    margin-top: .25rem;
    padding-bottom: .5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.form-section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.form-actions {
    display: flex;
    gap: .625rem;
    padding-top: .375rem;
    flex-wrap: wrap;
}
.required { color: #ef4444; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .8125rem;
    color: var(--text-secondary);
    user-select: none;
}
.checkbox-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary);
}

.input-addon { display: flex; align-items: stretch; }
.input-addon input {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: none;
}
.addon-text {
    display: flex;
    align-items: center;
    padding: 0 .75rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.color-input-wrap { display: flex; align-items: center; gap: .5rem; }
.color-input-wrap input[type="color"] {
    width: 40px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border);
    padding: 2px;
}
.color-preview { font-size: .8125rem; color: var(--text-muted); }
.url-display a { color: var(--primary); font-size: .875rem; text-decoration: none; }
.url-display a:hover { text-decoration: underline; }

/* ── Badges ──────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: 9999px;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-orange { background: #fef0eb; color: var(--primary); }

/* ── Auth ────────────────────────────────────────────────────── */

.auth-page {
    background: var(--page-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}
.auth-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--card-shadow-md);
    border: 1px solid var(--card-border);
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 1.75rem;
    color: var(--text-primary);
}
.auth-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -.02em;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: .8rem;
    color: var(--text-muted);
}
.auth-footer a { color: var(--primary); text-decoration: none; }

/* ── Quick links ─────────────────────────────────────────────── */

.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.quick-link-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    text-decoration: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    font-size: .8125rem;
    font-weight: 500;
    transition: box-shadow .15s, transform .1s, border-color .15s;
    text-align: center;
}
.quick-link-card:hover {
    box-shadow: var(--card-shadow-md);
    transform: translateY(-1px);
    border-color: #cbd5e1;
    color: var(--text-primary);
}
.ql-icon { font-size: 1.5rem; }

/* ── Empty states ────────────────────────────────────────────── */

.empty-state {
    padding: 3.5rem 2rem;
    text-align: center;
}
.empty-icon { font-size: 2.5rem; margin-bottom: .875rem; display: block; }
.empty-state p { color: var(--text-muted); margin-bottom: 1rem; font-size: .875rem; }

/* ── Misc helpers ────────────────────────────────────────────── */

.text-link { color: var(--primary); text-decoration: none; font-size: .8125rem; font-weight: 500; }
.text-link:hover { text-decoration: underline; }
.code-link { font-family: monospace; font-size: .8125rem; color: var(--primary); text-decoration: none; }
.code-link:hover { text-decoration: underline; }
code {
    font-family: ui-monospace, SFMono-Regular, 'Fira Code', monospace;
    font-size: .78rem;
    background: #f1f5f9;
    color: #0f172a;
    padding: .15rem .4rem;
    border-radius: .25rem;
    border: 1px solid #e2e8f0;
}
.mono { font-family: ui-monospace, SFMono-Regular, monospace; font-size: .8125rem; }
.time-cell {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: .78rem;
    white-space: nowrap;
    color: var(--text-muted);
}
.hidden { display: none !important; }

/* ── Divider ─────────────────────────────────────────────────── */
.nav-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: .375rem 0;
}

/* ── Mobile app bar ──────────────────────────────────────────── */

.mobile-app-bar {
    display: none;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
    .admin-body { flex-direction: column; height: auto; overflow: auto; }
    .sidebar { width: 100%; height: auto; }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: .375rem;
        gap: .125rem;
    }
    .sidebar-nav a { padding: .35rem .5rem; font-size: .75rem; }
    .sidebar-section-label { display: none; }
    .admin-main { overflow: visible; }
    .admin-topbar { padding: 0 1rem; }
    .admin-content { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }

    .mobile-app-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .6rem 1rem;
        background: var(--color-primary, #16a34a);
        color: #fff;
        font-size: .8rem;
        font-weight: 600;
        gap: 1rem;
    }
    .mobile-app-bar-link {
        color: #fff;
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: .3rem;
        white-space: nowrap;
        opacity: .9;
    }
    .mobile-app-bar-link:hover { opacity: 1; text-decoration: underline; }
    .mobile-app-bar-name {
        color: rgba(255,255,255,.75);
        font-size: .75rem;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: right;
    }
}
