/* ============================================================
   StreamManager Premium Dark Theme
   Glassmorphism + Red-to-Orange Gradient Accents
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --bg-darkest: #0a0a0a;
    --bg-dark: #111111;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --bg-surface: #2a2a2a;
    --bg-surface-light: #3a3a3a;
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.07);
    --bg-glass-active: rgba(255, 255, 255, 0.1);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-light: rgba(255, 255, 255, 0.12);
    --border-gradient: linear-gradient(135deg, rgba(255, 107, 107, 0.3), rgba(255, 142, 83, 0.3));

    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #a0a0a0;
    --text-dimmed: #6b7280;

    --gradient-primary: linear-gradient(135deg, #ff6b6b, #ff8e53);
    --gradient-primary-hover: linear-gradient(135deg, #ff5252, #ff7b3a);
    --gradient-success: linear-gradient(135deg, #4ade80, #22c55e);
    --gradient-info: linear-gradient(135deg, #3b82f6, #60a5fa);
    --gradient-warning: linear-gradient(135deg, #fbbf24, #f59e0b);
    --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);

    --color-primary: #ff6b6b;
    --color-primary-light: #ff8e53;
    --color-success: #4ade80;
    --color-warning: #fbbf24;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 107, 107, 0.15);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;

    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Courier New', monospace;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-stack);
    background: var(--bg-darkest) !important;
    color: var(--text-secondary) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

html {
    background: var(--bg-darkest) !important;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--bg-surface-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
* { scrollbar-width: thin; scrollbar-color: var(--bg-surface-light) var(--bg-dark); }

/* --- Selection --- */
::selection { background: rgba(255, 107, 107, 0.3); color: #fff; }

/* --- Links --- */
a { color: var(--color-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--color-primary-light); }

/* --- Headings --- */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); font-weight: 600; }

/* ============================================================
   GLASSMORPHISM CARD
   ============================================================ */
.card, .glass-card {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-color-light) !important;
    box-shadow: var(--shadow-card), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.card-header {
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-primary);
    padding: 1rem 1.25rem;
}

.card-header h5, .card-header h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
}

.card-body { color: var(--text-secondary); padding: 1.25rem; }
.card-footer { background: rgba(255,255,255,0.02) !important; border-top: 1px solid var(--border-color) !important; }

/* ============================================================
   STAT CARDS (Dashboard Metrics)
   ============================================================ */
.stat-card {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    padding: 1.25rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: rgba(255, 107, 107, 0.15) !important;
}

.stat-card:hover::before { opacity: 1; }

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-card .icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Stat label/value from old layout */
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.stat-icon { font-size: 2rem; opacity: 0.6; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { border-radius: var(--radius-sm); font-weight: 500; transition: var(--transition); letter-spacing: 0.2px; }

/* Primary gradient button */
.btn-primary {
    background: var(--gradient-primary) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.25);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--gradient-primary-hover) !important;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.35);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* Success */
.btn-success {
    background: var(--gradient-success) !important;
    border: none !important;
    color: #fff !important;
}
.btn-success:hover { box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3); transform: translateY(-1px); }

/* Info */
.btn-info {
    background: var(--gradient-info) !important;
    border: none !important;
    color: #fff !important;
}
.btn-info:hover { box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); transform: translateY(-1px); }

/* Warning */
.btn-warning {
    background: var(--gradient-warning) !important;
    border: none !important;
    color: #000 !important;
}
.btn-warning:hover { box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3); transform: translateY(-1px); }

/* Danger */
.btn-danger {
    background: var(--gradient-danger) !important;
    border: none !important;
    color: #fff !important;
}
.btn-danger:hover { box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); transform: translateY(-1px); }

/* Outline buttons dark */
.btn-outline-primary { color: var(--color-primary) !important; border-color: var(--color-primary) !important; background: transparent !important; }
.btn-outline-primary:hover { background: rgba(255, 107, 107, 0.1) !important; color: #fff !important; border-color: var(--color-primary) !important; }

.btn-outline-secondary { color: var(--text-muted) !important; border-color: var(--border-color-light) !important; background: transparent !important; }
.btn-outline-secondary:hover { background: var(--bg-glass-hover) !important; color: var(--text-primary) !important; border-color: var(--text-muted) !important; }

.btn-outline-success { color: var(--color-success) !important; border-color: var(--color-success) !important; background: transparent !important; }
.btn-outline-success:hover { background: rgba(74, 222, 128, 0.1) !important; color: #fff !important; }

.btn-outline-info { color: var(--color-info) !important; border-color: var(--color-info) !important; background: transparent !important; }
.btn-outline-info:hover { background: rgba(59, 130, 246, 0.1) !important; color: #fff !important; }

.btn-outline-warning { color: var(--color-warning) !important; border-color: var(--color-warning) !important; background: transparent !important; }
.btn-outline-warning:hover { background: rgba(251, 191, 36, 0.1) !important; color: #fff !important; }

.btn-outline-danger { color: var(--color-danger) !important; border-color: var(--color-danger) !important; background: transparent !important; }
.btn-outline-danger:hover { background: rgba(239, 68, 68, 0.1) !important; color: #fff !important; }

.btn-outline-dark { color: var(--text-muted) !important; border-color: var(--border-color-light) !important; }
.btn-outline-dark:hover { background: var(--bg-glass-hover) !important; color: var(--text-primary) !important; }

.btn-outline-light { color: var(--text-secondary) !important; border-color: rgba(255,255,255,0.2) !important; }
.btn-outline-light:hover { background: rgba(255,255,255,0.1) !important; }

.btn-light { background: var(--bg-glass) !important; border-color: var(--border-color) !important; color: var(--text-secondary) !important; }

/* Button group */
.btn-group .btn-outline-primary.active,
.btn-group .btn-primary {
    background: var(--gradient-primary) !important;
    border-color: transparent !important;
    color: #fff !important;
}

.btn-group .btn { border-color: var(--border-color-light) !important; }

/* Small close button */
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-control, .form-select {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color-light) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    padding: 0.6rem 0.85rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15) !important;
    background: var(--bg-surface) !important;
    outline: none;
}

.form-control::placeholder { color: var(--text-dimmed) !important; }

.form-label { color: var(--text-secondary); font-weight: 500; font-size: 0.875rem; margin-bottom: 0.35rem; }

.form-text { color: var(--text-dimmed); }

.form-check-input {
    background-color: var(--bg-surface) !important;
    border-color: var(--border-color-light) !important;
}
.form-check-input:checked {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}
.form-check-label { color: var(--text-secondary); }

/* Floating labels */
.form-floating > .form-control,
.form-floating > .form-select {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color-light) !important;
    color: var(--text-primary) !important;
    height: calc(3.5rem + 2px);
}
.form-floating > label { color: var(--text-muted) !important; }
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label { color: var(--color-primary) !important; }

/* Input group */
.input-group-text {
    background: var(--bg-surface-light) !important;
    border: 1px solid var(--border-color-light) !important;
    color: var(--text-muted) !important;
}

/* Form section */
.form-section {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-section h5, .form-section h6 { color: var(--text-primary); border-bottom: 1px solid var(--border-color); padding-bottom: 0.75rem; margin-bottom: 1rem; }

/* ============================================================
   TABLES
   ============================================================ */
.table {
    color: var(--text-secondary);
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.04);
    --bs-table-border-color: var(--border-color);
    margin-bottom: 0;
}

.table > thead > tr > th {
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-muted) !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table > tbody > tr > td {
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

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

.table-hover > tbody > tr:hover > td {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.table-hover > tbody > tr { transition: background 0.2s ease; }

/* Zebra striping dark */
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(255, 255, 255, 0.015); }

/* Table responsive wrapper */
.table-responsive {
    border-radius: var(--radius-md);
    scrollbar-width: thin;
}

/* ============================================================
   BADGES & LABELS
   ============================================================ */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.7em;
    border-radius: 50rem;
    letter-spacing: 0.3px;
}

.badge-active, .badge-Active { background: rgba(74, 222, 128, 0.15) !important; color: var(--color-success) !important; }
.badge-suspended, .badge-Suspended { background: rgba(251, 191, 36, 0.15) !important; color: var(--color-warning) !important; }
.badge-pending, .badge-Pending { background: rgba(59, 130, 246, 0.15) !important; color: var(--color-info) !important; }
.badge-terminated, .badge-Terminated,
.badge-cancelled, .badge-Cancelled { background: rgba(239, 68, 68, 0.15) !important; color: var(--color-danger) !important; }
.badge-paid, .badge-Paid { background: rgba(74, 222, 128, 0.15) !important; color: var(--color-success) !important; }
.badge-unpaid, .badge-Unpaid { background: rgba(251, 191, 36, 0.15) !important; color: var(--color-warning) !important; }
.badge-overdue, .badge-Overdue { background: rgba(239, 68, 68, 0.15) !important; color: var(--color-danger) !important; }
.badge-open { background: rgba(239, 68, 68, 0.15) !important; color: var(--color-danger) !important; }
.badge-answered { background: rgba(59, 130, 246, 0.15) !important; color: var(--color-info) !important; }
.badge-customer_reply { background: rgba(255, 142, 83, 0.15) !important; color: var(--color-primary-light) !important; }
.badge-closed { background: rgba(107, 114, 128, 0.2) !important; color: var(--text-muted) !important; }
.badge-low { background: rgba(74, 222, 128, 0.15) !important; color: var(--color-success) !important; }
.badge-medium { background: rgba(251, 191, 36, 0.15) !important; color: var(--color-warning) !important; }
.badge-high { background: rgba(239, 68, 68, 0.15) !important; color: var(--color-danger) !important; }

/* Bootstrap bg-* badges override */
.bg-primary { background: rgba(59, 130, 246, 0.2) !important; color: var(--color-info) !important; }
.bg-secondary { background: rgba(107, 114, 128, 0.2) !important; color: var(--text-muted) !important; }
.bg-success { background: rgba(74, 222, 128, 0.15) !important; color: var(--color-success) !important; }
.bg-danger { background: rgba(239, 68, 68, 0.15) !important; color: var(--color-danger) !important; }
.bg-warning { background: rgba(251, 191, 36, 0.15) !important; color: var(--color-warning) !important; }
.bg-info { background: rgba(59, 130, 246, 0.15) !important; color: var(--color-info) !important; }
.bg-light { background: rgba(255, 255, 255, 0.05) !important; color: var(--text-secondary) !important; }
.bg-dark { background: var(--bg-card) !important; color: var(--text-primary) !important; }

/* Opacity overrides for stat icons */
.bg-opacity-10 { --bs-bg-opacity: 0.1 !important; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
}

.alert-success {
    background: rgba(74, 222, 128, 0.1) !important;
    border-color: rgba(74, 222, 128, 0.2) !important;
    color: var(--color-success) !important;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    color: var(--color-danger) !important;
}
.alert-warning {
    background: rgba(251, 191, 36, 0.1) !important;
    border-color: rgba(251, 191, 36, 0.2) !important;
    color: var(--color-warning) !important;
}
.alert-info {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
    color: var(--color-info) !important;
}
.alert-secondary {
    background: rgba(107, 114, 128, 0.1) !important;
    border-color: rgba(107, 114, 128, 0.2) !important;
    color: var(--text-muted) !important;
}
.alert-primary {
    background: rgba(255, 107, 107, 0.1) !important;
    border-color: rgba(255, 107, 107, 0.2) !important;
    color: var(--color-primary) !important;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
    background: var(--bg-card) !important;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--border-color) !important; }
.modal-header .modal-title { color: var(--text-primary); }
.modal-footer { border-top: 1px solid var(--border-color) !important; }
.modal-backdrop.show { backdrop-filter: blur(4px); }

/* ============================================================
   DROPDOWNS
   ============================================================ */
.dropdown-menu {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    padding: 0.5rem;
}
.dropdown-item {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.85rem;
    transition: var(--transition);
}
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--bg-glass-hover) !important;
    color: var(--text-primary) !important;
}
.dropdown-divider { border-color: var(--border-color) !important; }

/* ============================================================
   LIST GROUPS
   ============================================================ */
.list-group { border-radius: var(--radius-md); }
.list-group-item {
    background: transparent !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
    transition: var(--transition);
}
.list-group-item:last-child { border-bottom: none !important; }
.list-group-item-action:hover {
    background: var(--bg-glass-hover) !important;
    color: var(--text-primary) !important;
}
.list-group-flush > .list-group-item { border-left: 0; border-right: 0; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { gap: 4px; }
.page-item .page-link {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
    transition: var(--transition);
    padding: 0.4rem 0.75rem;
}
.page-item .page-link:hover {
    background: var(--bg-glass-hover) !important;
    color: var(--text-primary) !important;
    border-color: var(--color-primary) !important;
}
.page-item.active .page-link {
    background: var(--gradient-primary) !important;
    border-color: transparent !important;
    color: #fff !important;
}
.page-item.disabled .page-link {
    background: rgba(255,255,255,0.02) !important;
    color: var(--text-dimmed) !important;
    border-color: var(--border-color) !important;
}

/* ============================================================
   NAV / TABS
   ============================================================ */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}
.nav-tabs .nav-link {
    color: var(--text-muted) !important;
    border: none;
    padding: 0.75rem 1.25rem;
    transition: var(--transition);
}
.nav-tabs .nav-link:hover { color: var(--text-primary) !important; }
.nav-tabs .nav-link.active {
    color: var(--color-primary) !important;
    background: transparent;
    border-bottom: 2px solid var(--color-primary);
}

.nav-pills .nav-link {
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav-pills .nav-link.active {
    background: var(--gradient-primary) !important;
    color: #fff !important;
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumb { background: transparent; margin: 0; padding: 0; }
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-primary); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-dimmed); }

/* ============================================================
   ADMIN SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-dark) !important;
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    overflow-y: auto;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar .brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}
.sidebar .brand h5 {
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sidebar .brand h5 i {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.3rem;
}
.sidebar .brand small {
    opacity: 0.5;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.sidebar .nav-section { padding: 0.5rem 0; }
.sidebar .nav-section-title {
    padding: 0.5rem 1rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dimmed);
    font-weight: 600;
}

.sidebar .nav-link {
    color: var(--text-muted) !important;
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.sidebar .nav-link:hover {
    color: var(--text-primary) !important;
    background: var(--bg-glass-hover);
    border-left-color: rgba(255, 107, 107, 0.4);
}

.sidebar .nav-link.active {
    color: #fff !important;
    background: rgba(255, 107, 107, 0.08);
    border-left-color: var(--color-primary);
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.7;
}
.sidebar .nav-link.active i { opacity: 1; color: var(--color-primary); }

/* ============================================================
   ADMIN MAIN CONTENT & TOP BAR
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-darkest);
}

.top-bar {
    background: rgba(17, 17, 17, 0.8) !important;
    backdrop-filter: blur(12px);
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.top-bar h6 { color: var(--text-primary); margin: 0; }

.content-area { padding: 1.5rem; }

/* ============================================================
   CLIENT NAVBAR
   ============================================================ */
.navbar {
    background: rgba(17, 17, 17, 0.9) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.navbar-brand {
    color: var(--text-primary) !important;
    font-weight: 700;
}
.navbar-brand i {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.client-nav .nav-link {
    color: var(--text-muted) !important;
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.client-nav .nav-link:hover {
    color: var(--text-primary) !important;
    background: var(--bg-glass-hover);
}
.client-nav .nav-link.active {
    color: var(--color-primary) !important;
    background: rgba(255, 107, 107, 0.08);
    font-weight: 600;
}

.navbar-toggler {
    border-color: var(--border-color-light) !important;
    padding: 0.35rem 0.6rem;
}
.navbar-toggler-icon { filter: invert(1); }

.navbar .dropdown-toggle { color: var(--text-secondary) !important; }

/* Client container background */
body > .container.content-area,
.container.content-area { background: transparent; }

/* ============================================================
   GUEST / AUTH PAGES
   ============================================================ */
.auth-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(255, 107, 107, 0.05);
    max-width: 520px;
    width: 100%;
    padding: 2.5rem;
    margin: 20px auto;
}

.auth-card .brand { text-align: center; margin-bottom: 2rem; }
.auth-card .brand i {
    font-size: 2.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-card .brand h3 { font-weight: 700; color: var(--text-primary); margin-top: 0.5rem; }
.auth-card .brand p { color: var(--text-muted); font-size: 0.9rem; }

/* Auth page body centering when auth-card is present */
body:has(.auth-card) {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #111111 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer, .footer {
    background: var(--bg-dark) !important;
    border-top: 1px solid var(--border-color) !important;
    color: var(--text-dimmed) !important;
}
footer *, .footer * { color: var(--text-dimmed) !important; }

/* ============================================================
   CHART.JS OVERRIDES
   ============================================================ */
.chart-container { position: relative; min-height: 300px; }
canvas { border-radius: var(--radius-sm); }

/* ============================================================
   IMPORT WIZARD
   ============================================================ */
.wizard-steps .step { transition: var(--transition); }
.wizard-steps .step.active { color: var(--color-primary); border-color: var(--color-primary); }
.wizard-steps .step.completed { color: var(--color-success); border-color: var(--color-success); }

/* ============================================================
   UTILITY OVERRIDES
   ============================================================ */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-info { color: var(--color-info) !important; }
.text-secondary { color: var(--text-muted) !important; }
.text-white { color: #fff !important; }
.text-dark { color: var(--text-primary) !important; }

.bg-white { background: var(--bg-card) !important; }

.border { border-color: var(--border-color) !important; }
.border-top { border-top-color: var(--border-color) !important; }
.border-bottom { border-bottom-color: var(--border-color) !important; }
.border-start { border-left-color: var(--border-color) !important; }
.border-end { border-right-color: var(--border-color) !important; }

/* Border color overrides for stat cards */
.border-primary { border-color: var(--color-info) !important; }
.border-success { border-color: var(--color-success) !important; }
.border-warning { border-color: var(--color-warning) !important; }
.border-danger { border-color: var(--color-danger) !important; }
.border-info { border-color: var(--color-info) !important; }
.border-secondary { border-color: var(--text-dimmed) !important; }

.small, small { color: inherit; }
.fw-semibold { color: inherit; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
    background: var(--bg-surface) !important;
    border-radius: var(--radius-sm);
    height: 0.5rem;
}
.progress-bar { background: var(--gradient-primary); border-radius: var(--radius-sm); }

/* ============================================================
   ACCORDION
   ============================================================ */
.accordion-item {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-color) !important;
}
.accordion-button {
    background: var(--bg-glass) !important;
    color: var(--text-primary) !important;
}
.accordion-button:not(.collapsed) { background: var(--bg-glass-active) !important; }
.accordion-button::after { filter: invert(1); }

/* ============================================================
   TOOLTIPS
   ============================================================ */
.tooltip-inner { background: var(--bg-card); border: 1px solid var(--border-color); }

/* ============================================================
   ANIMATIONS & LOADING
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(255, 107, 107, 0); }
}

.fade-in-up { animation: fadeInUp 0.4s ease-out; }

.skeleton {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-surface-light) 50%, var(--bg-surface) 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.pulse-glow { animation: pulse-glow 2s infinite; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }

    .stat-card { padding: 1rem; }
    .stat-card .value { font-size: 1.35rem; }

    .content-area { padding: 1rem; }

    .table th, .table td { font-size: 0.8rem; padding: 0.5rem; }

    .btn-group { flex-wrap: wrap; gap: 4px; }
    .btn-group .btn { font-size: 0.78rem; padding: 0.3rem 0.6rem; }
}

@media (max-width: 576px) {
    .card-body { padding: 1rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar, .top-bar, .navbar, footer, .btn, .btn-group { display: none !important; }
    .main-content { margin-left: 0 !important; }
    body { background: #fff !important; color: #000 !important; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; background: #fff !important; }
    .table th, .table td { color: #000 !important; }
}

/* ============================================================
   MISC
   ============================================================ */
/* Focus accessible */
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Remove focus outline for mouse users */
*:focus:not(:focus-visible) { outline: none; }

/* Code blocks */
code, pre {
    font-family: var(--font-mono);
    background: var(--bg-surface);
    color: var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 0.15em 0.4em;
    font-size: 0.875em;
}
pre {
    padding: 1rem;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

/* Horizontal rule */
hr { border-color: var(--border-color); opacity: 0.5; }

/* Fix Bootstrap border-start for stat cards */
.card.stat-card.border-start.border-4 {
    border-left-width: 4px !important;
    border-left-style: solid !important;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1035;
}
@media (max-width: 768px) {
    .sidebar.show ~ .sidebar-overlay { display: block; }
}

/* Ticket thread messages */
.card.border-primary { border-color: rgba(255, 107, 107, 0.3) !important; }
.card.border-secondary { border-color: var(--border-color-light) !important; }
.bg-primary.bg-opacity-10 { background: rgba(255, 107, 107, 0.08) !important; }

/* Header search */
.search-box .form-control {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}



/* =============================================
   CAPTCHA Widget Styles - Dark Theme
   ============================================= */
.captcha-wrapper,
.captcha-widget-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px 0;
}

/* reCAPTCHA v2 dark theme adjustments */
.g-recaptcha {
    transform-origin: center;
}

/* Cloudflare Turnstile dark adjustments */
.cf-turnstile {
    display: flex;
    justify-content: center;
}

/* Responsive CAPTCHA */
@media (max-width: 400px) {
    .g-recaptcha,
    .cf-turnstile {
        transform: scale(0.85);
        transform-origin: center;
    }
    .captcha-wrapper,
    .captcha-widget-wrapper {
        overflow: hidden;
    }
}

/* Auth card CAPTCHA spacing */
.auth-card .captcha-wrapper {
    margin: 8px 0 4px;
}
