:root {
    --cam-sidebar-width: 268px;
    --cam-primary: #6366f1;
    --cam-primary-hover: #4f46e5;
    --cam-primary-soft: rgba(99, 102, 241, 0.1);
    --cam-accent: #f97316;
    --cam-accent-soft: rgba(249, 115, 22, 0.12);
    --cam-success: #10b981;
    --cam-warning: #f59e0b;
    --cam-danger: #ef4444;
    --cam-bg: #f4f6fb;
    --cam-surface: #ffffff;
    --cam-border: #e2e8f0;
    --cam-text: #0f172a;
    --cam-text-muted: #64748b;
    --cam-sidebar-bg: #0f172a;
    --cam-sidebar-hover: rgba(255, 255, 255, 0.06);
    --cam-sidebar-active: rgba(99, 102, 241, 0.18);
    --cam-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --cam-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --cam-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
    --cam-radius: 14px;
    --cam-radius-sm: 10px;
    --cam-transition: 200ms ease;
    --bs-primary: #6366f1;
    --bs-primary-rgb: 99, 102, 241;
    --bs-link-color: #6366f1;
    --bs-link-hover-color: #4f46e5;
}

[data-bs-theme="dark"] {
    --cam-bg: #0b1120;
    --cam-surface: #111827;
    --cam-border: #1e293b;
    --cam-text: #f1f5f9;
    --cam-text-muted: #94a3b8;
    --cam-sidebar-bg: #070d19;
    --cam-primary-soft: rgba(99, 102, 241, 0.15);
    --cam-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    --bs-body-bg: #0b1120;
    --bs-body-color: #f1f5f9;
    --bs-border-color: #1e293b;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--cam-text);
    background: var(--cam-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

code, .font-mono {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.875em;
}

/* ── Layout ── */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-content {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    background: var(--cam-bg);
}

.admin-main {
    padding: 1.75rem 2rem 2.5rem;
    max-width: 1400px;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--cam-sidebar-width);
    min-height: 100vh;
    background: var(--cam-sidebar-bg);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--cam-primary), #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.sidebar-brand-title {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    margin: 0;
}

.sidebar-brand-sub {
    color: #64748b;
    font-size: 0.75rem;
    margin: 0;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
}

.sidebar-nav-label {
    color: #475569;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem 0.75rem 0.75rem;
}

.sidebar .nav-link {
    color: #94a3b8;
    border-radius: var(--cam-radius-sm);
    padding: 0.65rem 0.875rem;
    margin-bottom: 2px;
    font-weight: 500;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background var(--cam-transition), color var(--cam-transition);
    cursor: pointer;
    text-decoration: none;
}

.sidebar .nav-link i {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.sidebar .nav-link:hover {
    background: var(--cam-sidebar-hover);
    color: #e2e8f0;
}

.sidebar .nav-link.active {
    background: var(--cam-sidebar-active);
    color: #fff;
}

.sidebar .nav-link.active i {
    color: #a5b4fc;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.sidebar-user-name {
    color: #e2e8f0;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
}

.sidebar-user-role {
    color: #64748b;
    font-size: 0.75rem;
}

/* ── Topbar ── */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--cam-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-bs-theme="dark"] .admin-topbar {
    background: rgba(17, 24, 39, 0.9);
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
    color: var(--cam-text);
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--cam-text-muted);
    margin: 0.125rem 0 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--cam-border);
    background: var(--cam-surface);
    color: var(--cam-text-muted);
    cursor: pointer;
    transition: all var(--cam-transition);
}

.btn-icon:hover {
    border-color: var(--cam-primary);
    color: var(--cam-primary);
    background: var(--cam-primary-soft);
}

/* ── Page header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}

.page-header p {
    color: var(--cam-text-muted);
    margin: 0.25rem 0 0;
    font-size: 0.9375rem;
}

/* ── Cards ── */
.cam-card {
    background: var(--cam-surface);
    border: 1px solid var(--cam-border);
    border-radius: var(--cam-radius);
    box-shadow: var(--cam-shadow-sm);
    overflow: hidden;
}

.cam-card-header {
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--cam-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cam-card-header h6 {
    margin: 0;
    font-weight: 600;
    font-size: 0.9375rem;
}

.cam-card-body {
    padding: 1.5rem;
}

/* ── Stat cards ── */
.stat-card {
    background: var(--cam-surface);
    border: 1px solid var(--cam-border);
    border-radius: var(--cam-radius);
    padding: 1.375rem 1.5rem;
    box-shadow: var(--cam-shadow-sm);
    transition: box-shadow var(--cam-transition), border-color var(--cam-transition);
    cursor: default;
    height: 100%;
}

.stat-card:hover {
    box-shadow: var(--cam-shadow);
    border-color: rgba(99, 102, 241, 0.25);
}

.stat-label {
    color: var(--cam-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--cam-text);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
}

.stat-icon-purple { background: var(--cam-primary-soft); color: var(--cam-primary); }
.stat-icon-green  { background: rgba(16, 185, 129, 0.12); color: var(--cam-success); }
.stat-icon-blue   { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.stat-icon-orange { background: var(--cam-accent-soft); color: var(--cam-accent); }

/* ── Data rows ── */
.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--cam-border);
}

.data-row:last-child { border-bottom: none; padding-bottom: 0; }
.data-row:first-child { padding-top: 0; }

.data-row-label {
    color: var(--cam-text-muted);
    font-size: 0.9375rem;
}

.data-row-value {
    font-weight: 600;
    font-size: 0.9375rem;
}

/* ── Tables ── */
.cam-table {
    width: 100%;
    margin: 0;
}

.cam-table thead th {
    background: var(--cam-bg);
    color: var(--cam-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--cam-border);
    white-space: nowrap;
}

.cam-table tbody td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--cam-border);
    font-size: 0.9375rem;
}

.cam-table tbody tr {
    transition: background var(--cam-transition);
}

.cam-table tbody tr:hover {
    background: var(--cam-primary-soft);
}

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

/* ── Badges ── */
.badge-cam {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-active {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.badge-inactive {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

.badge-position {
    background: var(--cam-primary-soft);
    color: var(--cam-primary);
}

[data-bs-theme="dark"] .badge-active { color: #34d399; }
[data-bs-theme="dark"] .badge-inactive { color: #94a3b8; }

/* ── Buttons ── */
.btn-primary {
    background: var(--cam-primary);
    border-color: var(--cam-primary);
    font-weight: 600;
    border-radius: 10px;
    padding: 0.5rem 1.125rem;
    transition: all var(--cam-transition);
    cursor: pointer;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--cam-primary-hover);
    border-color: var(--cam-primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-accent {
    background: var(--cam-accent);
    border-color: var(--cam-accent);
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--cam-transition);
}

.btn-accent:hover {
    background: #ea580c;
    border-color: #ea580c;
    color: #fff;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--cam-border);
    color: var(--cam-text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--cam-transition);
}

.btn-ghost:hover {
    border-color: var(--cam-primary);
    color: var(--cam-primary);
    background: var(--cam-primary-soft);
}

.btn-action {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--cam-border);
    background: var(--cam-surface);
    color: var(--cam-text-muted);
    cursor: pointer;
    transition: all var(--cam-transition);
}

.btn-action:hover { border-color: var(--cam-primary); color: var(--cam-primary); background: var(--cam-primary-soft); }
.btn-action-danger:hover { border-color: var(--cam-danger); color: var(--cam-danger); background: rgba(239, 68, 68, 0.08); }
.btn-action-warning:hover { border-color: var(--cam-warning); color: var(--cam-warning); background: rgba(245, 158, 11, 0.08); }
.btn-action-success:hover { border-color: var(--cam-success); color: var(--cam-success); background: rgba(16, 185, 129, 0.08); }

/* ── Forms ── */
.form-control, .form-select {
    border-radius: 10px;
    border-color: var(--cam-border);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: border-color var(--cam-transition), box-shadow var(--cam-transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--cam-primary);
    box-shadow: 0 0 0 3px var(--cam-primary-soft);
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--cam-text);
    margin-bottom: 0.375rem;
}

.nav-tabs {
    border-bottom-color: var(--cam-border);
    gap: 0.25rem;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 10px 10px 0 0;
    color: var(--cam-text-muted);
    font-weight: 500;
    padding: 0.625rem 1.125rem;
    cursor: pointer;
    transition: all var(--cam-transition);
}

.nav-tabs .nav-link:hover {
    color: var(--cam-primary);
    background: var(--cam-primary-soft);
}

.nav-tabs .nav-link.active {
    color: var(--cam-primary);
    background: var(--cam-primary-soft);
    border-bottom: 2px solid var(--cam-primary);
}

/* ── Alerts ── */
.cam-alert {
    border-radius: var(--cam-radius-sm);
    border: none;
    padding: 0.875rem 1.125rem;
    font-size: 0.9375rem;
    font-weight: 500;
    margin: 1rem 2rem 0;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--cam-primary-soft);
    color: var(--cam-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--cam-text-muted);
    margin-bottom: 1.25rem;
}

/* ── Login ── */
.auth-page {
    min-height: 100vh;
    display: flex;
}

.auth-brand-panel {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.2) 0%, transparent 50%);
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.auth-brand-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.auth-brand-panel h1 {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.auth-brand-panel p {
    color: #94a3b8;
    font-size: 1.0625rem;
    line-height: 1.7;
}

.auth-features {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    color: #cbd5e1;
    font-size: 0.9375rem;
}

.auth-feature i {
    color: #a5b4fc;
    font-size: 1.125rem;
}

.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--cam-bg);
    max-width: 520px;
}

.auth-form-card {
    width: 100%;
    max-width: 400px;
}

.auth-form-card h2 {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.375rem;
}

.auth-form-card .subtitle {
    color: var(--cam-text-muted);
    margin-bottom: 2rem;
}

/* ── Landing ── */
.landing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(180deg, var(--cam-bg) 0%, #eef2ff 100%);
}

[data-bs-theme="dark"] .landing-page {
    background: linear-gradient(180deg, var(--cam-bg) 0%, #1e1b4b 100%);
}

.landing-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.35);
}

.landing-page h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 0.75rem;
}

.landing-page .lead {
    color: var(--cam-text-muted);
    font-size: 1.125rem;
    max-width: 480px;
    margin-bottom: 2rem;
}

.landing-api {
    margin-top: 2.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--cam-surface);
    border: 1px solid var(--cam-border);
    border-radius: 10px;
    font-size: 0.8125rem;
    color: var(--cam-text-muted);
}

/* ── Ad fields toggle ── */
.ad-field { display: none; }
.ad-field.active { display: block; }

.ad-field.row.active,
.ad-field.active.row {
    display: flex;
}

/* ── Responsive ── */
@media (max-width: 992px) {
    .auth-brand-panel { display: none; }
    .auth-form-panel { max-width: none; }
}

@media (max-width: 768px) {
    .admin-shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        min-height: auto;
        position: relative;
    }
    .sidebar-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.5rem; }
    .sidebar-nav-label, .sidebar-footer, .sidebar-user { display: none; }
    .sidebar .nav-link { flex: 1; justify-content: center; padding: 0.5rem; font-size: 0.8125rem; }
    .admin-main { padding: 1.25rem; }
    .admin-topbar { padding: 0.875rem 1.25rem; }
    .cam-alert { margin: 1rem 1.25rem 0; }
    .stat-value { font-size: 1.625rem; }
}
