/* ============================================
   BANHAMMER - Premium Dark Design System
   ============================================
   A sophisticated dark interface with glassmorphism,
   subtle animations, and premium micro-interactions.
   ============================================ */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Core Background Colors */
    --bg-primary: #0a0e14;
    --bg-secondary: #0d1117;
    --bg-tertiary: #161b22;
    --bg-elevated: #1c2128;
    --bg-surface: #21262d;

    /* Glass Effect Backgrounds */
    --glass-bg: rgba(22, 27, 34, 0.8);
    --glass-bg-light: rgba(33, 38, 45, 0.6);
    --glass-border: rgba(48, 54, 61, 0.5);
    --glass-border-light: rgba(240, 246, 252, 0.1);

    /* Text Colors */
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;
    --text-muted: #484f58;

    /* Accent Colors - Status */
    --accent-success: #3fb950;
    --accent-success-muted: rgba(63, 185, 80, 0.15);
    --accent-success-glow: rgba(63, 185, 80, 0.4);

    --accent-warning: #d29922;
    --accent-warning-muted: rgba(210, 153, 34, 0.15);
    --accent-warning-glow: rgba(210, 153, 34, 0.4);

    --accent-danger: #f85149;
    --accent-danger-muted: rgba(248, 81, 73, 0.15);
    --accent-danger-glow: rgba(248, 81, 73, 0.4);

    --accent-info: #58a6ff;
    --accent-info-muted: rgba(88, 166, 255, 0.15);
    --accent-info-glow: rgba(88, 166, 255, 0.4);

    --accent-purple: #a371f7;
    --accent-purple-muted: rgba(163, 113, 247, 0.15);

    /* Brand Accent */
    --accent-brand: #f85149;
    --accent-brand-hover: #ff6b63;

    /* Borders */
    --border-primary: #30363d;
    --border-secondary: #21262d;
    --border-subtle: rgba(240, 246, 252, 0.1);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow-success: 0 0 20px rgba(63, 185, 80, 0.3);
    --shadow-glow-danger: 0 0 20px rgba(248, 81, 73, 0.3);
    --shadow-glow-info: 0 0 20px rgba(88, 166, 255, 0.3);
    --shadow-glow-warning: 0 0 20px rgba(210, 153, 34, 0.3);

    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --header-height: 64px;
}

/* ============================================
   Base Reset & Typography
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(88, 166, 255, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(248, 81, 73, 0.05), transparent);
    pointer-events: none;
    z-index: -1;
}

::selection {
    background: var(--accent-info);
    color: var(--bg-primary);
}

a {
    color: var(--accent-info);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--text-primary);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    line-height: var(--leading-tight);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

code, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--accent-info);
}

/* ============================================
   Layout Structure
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--space-6);
    transition: margin-left var(--transition-slow);
    min-height: 100vh;
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* ============================================
   Sidebar Navigation
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-slow), transform var(--transition-slow);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    overflow: hidden;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-details,
.sidebar.collapsed .user-info i.bi-gear {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: var(--space-3);
}

.sidebar.collapsed .nav-item i {
    margin-right: 0;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}

.sidebar.collapsed .user-avatar {
    margin: 0;
}

/* Sidebar Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--border-primary);
    gap: var(--space-3);
}

.brand-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-danger), var(--accent-warning));
    border-radius: var(--radius-md);
    font-size: var(--text-xl);
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.brand-text {
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-2);
}

.nav-group {
    margin-bottom: var(--space-6);
}

.nav-group-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--text-tertiary);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    margin: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-brand);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: height var(--transition-fast);
}

.nav-item:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-info-muted);
    color: var(--accent-info);
}

.nav-item.active::before {
    height: 60%;
    background: var(--accent-info);
}

.nav-item i {
    font-size: var(--text-lg);
    width: 24px;
    margin-right: var(--space-3);
    transition: margin var(--transition-fast);
}

.nav-text {
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

/* Badge in nav */
.nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--accent-danger);
    color: white;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.user-info:hover {
    background: var(--bg-surface);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-info));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* Sidebar Toggle */
.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 24px;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 10;
}

.sidebar-toggle:hover {
    background: var(--bg-surface);
    transform: scale(1.1);
}

.sidebar-toggle i {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* ============================================
   Page Header
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.page-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.page-title h1 {
    font-size: var(--text-2xl);
    font-weight: 600;
}

.page-title i {
    font-size: var(--text-2xl);
    color: var(--text-tertiary);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ============================================
   Cards - Glass Morphism Style
   ============================================ */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-primary);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.card-header h5,
.card-header h6 {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-primary);
    background: transparent;
}

/* ============================================
   Stat Cards
   ============================================ */
.stat-card {
    position: relative;
    overflow: hidden;
    padding: var(--space-5);
    border-radius: var(--radius-xl);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    transition: all var(--transition-base);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--stat-color), transparent);
    opacity: 0.8;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--stat-color);
}

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

.stat-card.primary { --stat-color: var(--accent-info); }
.stat-card.warning { --stat-color: var(--accent-warning); }
.stat-card.danger { --stat-color: var(--accent-danger); }
.stat-card.success { --stat-color: var(--accent-success); }
.stat-card.purple { --stat-color: var(--accent-purple); }

.stat-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-1);
}

.stat-change {
    font-size: var(--text-xs);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-top: var(--space-2);
}

.stat-change.positive {
    color: var(--accent-success);
}

.stat-change.negative {
    color: var(--accent-danger);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
    background: var(--stat-color);
    color: white;
    opacity: 0.9;
    box-shadow: 0 4px 12px var(--stat-color);
}

/* ============================================
   Tables
   ============================================ */
.table-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    color: var(--text-primary);
    background: transparent;
}

.table thead th {
    background: var(--bg-tertiary);
    padding: var(--space-4) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-primary);
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-secondary);
    transition: background var(--transition-fast);
}

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

.table tbody tr:hover {
    background: var(--bg-surface);
}

.table tbody tr.clickable {
    cursor: pointer;
}

.table tbody tr.clickable:hover {
    background: var(--accent-info-muted);
}

.table tbody td {
    padding: var(--space-4);
    font-size: var(--text-sm);
    vertical-align: middle;
}

/* Table Row States */
.table tbody tr.row-danger {
    background: var(--accent-danger-muted);
}

.table tbody tr.row-danger:hover {
    background: rgba(248, 81, 73, 0.25);
}

.table tbody tr.row-warning {
    background: var(--accent-warning-muted);
}

.table tbody tr.row-warning:hover {
    background: rgba(210, 153, 34, 0.25);
}

.table tbody tr.row-success {
    background: var(--accent-success-muted);
}

/* Scrollable Table */
.table-responsive {
    max-height: 400px;
    overflow-y: auto;
}

/* ============================================
   Badges & Status Indicators
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-success {
    background: var(--accent-success-muted);
    color: var(--accent-success);
}

.badge-warning {
    background: var(--accent-warning-muted);
    color: var(--accent-warning);
}

.badge-danger {
    background: var(--accent-danger-muted);
    color: var(--accent-danger);
}

.badge-info {
    background: var(--accent-info-muted);
    color: var(--accent-info);
}

.badge-purple {
    background: var(--accent-purple-muted);
    color: var(--accent-purple);
}

.badge-neutral {
    background: var(--bg-surface);
    color: var(--text-secondary);
}

/* Status Dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.status-dot.online {
    background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success);
    animation: pulse-success 2s ease-in-out infinite;
}

.status-dot.warning {
    background: var(--accent-warning);
    box-shadow: 0 0 8px var(--accent-warning);
}

.status-dot.offline {
    background: var(--text-muted);
}

.status-dot.danger {
    background: var(--accent-danger);
    box-shadow: 0 0 8px var(--accent-danger);
    animation: pulse-danger 2s ease-in-out infinite;
}

@keyframes pulse-success {
    0%, 100% { box-shadow: 0 0 8px var(--accent-success); }
    50% { box-shadow: 0 0 16px var(--accent-success); }
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 8px var(--accent-danger); }
    50% { box-shadow: 0 0 16px var(--accent-danger); }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
    background: var(--accent-info);
    color: white;
    border-color: var(--accent-info);
}

.btn-primary:hover:not(:disabled) {
    background: #4a9eff;
    box-shadow: var(--shadow-glow-info);
    transform: translateY(-1px);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--text-tertiary);
}

/* Danger Button */
.btn-danger {
    background: var(--accent-danger);
    color: white;
    border-color: var(--accent-danger);
}

.btn-danger:hover:not(:disabled) {
    background: #ff6b63;
    box-shadow: var(--shadow-glow-danger);
    transform: translateY(-1px);
}

/* Success Button */
.btn-success {
    background: var(--accent-success);
    color: white;
    border-color: var(--accent-success);
}

.btn-success:hover:not(:disabled) {
    background: #4cc764;
    box-shadow: var(--shadow-glow-success);
    transform: translateY(-1px);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
}

/* Icon Button */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-info);
    box-shadow: 0 0 0 3px var(--accent-info-muted);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Select - Beautiful Dark Theme */
select,
.form-select {
    width: 100%;
    padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    background-size: 14px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

select:hover,
.form-select:hover {
    border-color: var(--text-tertiary);
    background-color: var(--bg-surface);
}

select:focus,
.form-select:focus {
    border-color: var(--accent-info);
    box-shadow: 0 0 0 3px var(--accent-info-muted);
    background-color: var(--bg-surface);
}

select:disabled,
.form-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg-secondary);
}

/* Select option styling */
select option {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    padding: var(--space-2);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent-info);
    cursor: pointer;
}

.form-check-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.alert-icon {
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.alert-info {
    background: var(--accent-info-muted);
    border: 1px solid rgba(88, 166, 255, 0.3);
    color: var(--accent-info);
}

.alert-success {
    background: var(--accent-success-muted);
    border: 1px solid rgba(63, 185, 80, 0.3);
    color: var(--accent-success);
}

.alert-warning {
    background: var(--accent-warning-muted);
    border: 1px solid rgba(210, 153, 34, 0.3);
    color: var(--accent-warning);
}

.alert-danger {
    background: var(--accent-danger-muted);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--accent-danger);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-6);
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    max-width: 300px;
}

/* ============================================
   Loading States
   ============================================ */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--accent-info);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-tertiary) 25%,
        var(--bg-surface) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--space-2);
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: var(--space-3);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

/* ============================================
   Connection Status Indicator
   ============================================ */
.connection-status {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: 1000;
}

.connection-badge {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.connection-badge.connected {
    border-color: var(--accent-success);
    color: var(--accent-success);
}

.connection-badge.disconnected {
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Profile Page & Form Styling
   ============================================ */
.form-text {
    display: block;
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.card .form-group {
    margin-bottom: var(--space-5);
}

.card hr {
    border: 0;
    border-top: 1px solid var(--border-primary);
    margin: var(--space-5) 0;
}

.card .p-3 {
    padding: var(--space-4);
}

.card .rounded {
    border-radius: var(--radius-md);
}

/* Info sections in cards */
.card-body .row.g-4 {
    row-gap: var(--space-4);
    column-gap: var(--space-4);
}

.card-body .col-12,
.card-body .col-md-4,
.card-body .col-md-6 {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
}

/* Session info styling */
.card-body .text-secondary.mb-1 {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    margin-bottom: var(--space-2);
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-10);
    box-shadow: var(--shadow-xl);
}

.login-brand {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-brand-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-danger), var(--accent-warning));
    border-radius: var(--radius-xl);
    font-size: var(--text-3xl);
    color: white;
    box-shadow: var(--shadow-lg);
}

.login-brand h1 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-1);
}

.login-brand p {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

.login-footer {
    text-align: center;
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-primary);
}

.login-footer p {
    color: var(--text-muted);
    font-size: var(--text-xs);
}

/* ============================================
   Dashboard Grid
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.dashboard-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

/* ============================================
   Scrollbar Styling
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-primary) var(--bg-secondary);
}

/* ============================================
   Definition Lists (User Info)
   ============================================ */
dl.row {
    margin-bottom: 0;
}

dl.row dt {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-2);
    margin-bottom: 0;
}

dl.row dd {
    font-size: var(--text-sm);
    color: var(--text-primary);
    padding: var(--space-3) var(--space-2);
    margin-bottom: 0;
    word-break: break-word;
}

/* Alternate row background for better readability */
dl.row > dt:nth-of-type(odd),
dl.row > dd:nth-of-type(odd) {
    background: rgba(33, 38, 45, 0.3);
}

dl.row > dt:nth-of-type(even),
dl.row > dd:nth-of-type(even) {
    background: transparent;
}

/* Mobile responsive for definition lists */
@media (max-width: 576px) {
    dl.row dt,
    dl.row dd {
        flex: 0 0 100%;
        max-width: 100%;
    }

    dl.row dt {
        padding-bottom: var(--space-1);
    }

    dl.row dd {
        padding-top: 0;
        padding-bottom: var(--space-3);
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--accent-success) !important; }
.text-warning { color: var(--accent-warning) !important; }
.text-danger { color: var(--accent-danger) !important; }
.text-info { color: var(--accent-info) !important; }

.bg-surface { background: var(--bg-surface) !important; }
.bg-elevated { background: var(--bg-elevated) !important; }

.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }

.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Grid helpers */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Flex helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* Spacing */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.me-1 { margin-right: var(--space-1); }
.me-2 { margin-right: var(--space-2); }
.mr-2 { margin-right: var(--space-2); }
.ms-1 { margin-left: var(--space-1); }
.ms-2 { margin-left: var(--space-2); }
.ml-auto { margin-left: auto; }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-5 { padding-top: var(--space-5); padding-bottom: var(--space-5); }

/* Text alignment */
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-start { text-align: left; }

/* Text colors */
.text-purple { color: var(--accent-purple) !important; }

/* Width */
.w-100 { width: 100%; }

/* Display */
.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-inline-flex { display: inline-flex; }

/* Bootstrap-like row/col for compatibility */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -12px;
    margin-left: -12px;
}

.col-12 { flex: 0 0 100%; max-width: 100%; padding-right: 12px; padding-left: 12px; }
.col-6 { flex: 0 0 50%; max-width: 50%; padding-right: 12px; padding-left: 12px; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; padding-right: 12px; padding-left: 12px; }
.col-3 { flex: 0 0 25%; max-width: 25%; padding-right: 12px; padding-left: 12px; }

@media (min-width: 768px) {
    .col-md-2 { flex: 0 0 16.666%; max-width: 16.666%; }
    .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
}

/* Gap utilities */
.g-3 { gap: var(--space-3); }

/* Input group styles for compatibility */
.input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group > .form-control {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group > .form-control:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.bg-transparent { background: transparent !important; }
.border-end-0 { border-right: 0 !important; }
.border-start-0 { border-left: 0 !important; }

/* Button group */
.btn-group {
    display: inline-flex;
}

.btn-group > .btn {
    border-radius: 0;
}

.btn-group > .btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group > .btn:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.btn-group > .btn:not(:first-child) {
    margin-left: -1px;
}

.btn-group-sm > .btn {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

/* Align items */
.align-items-center { align-items: center; }
.align-items-stretch { align-items: stretch; }

/* Justify content */
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }

@media (min-width: 768px) {
    .justify-content-md-end { justify-content: flex-end; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fadeInUp {
    animation: fadeInUp 0.4s ease-out forwards;
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Staggered animation for children */
.stagger-animation > * {
    opacity: 0;
    animation: fadeInUp 0.4s ease-out forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0ms; }
.stagger-animation > *:nth-child(2) { animation-delay: 50ms; }
.stagger-animation > *:nth-child(3) { animation-delay: 100ms; }
.stagger-animation > *:nth-child(4) { animation-delay: 150ms; }
.stagger-animation > *:nth-child(5) { animation-delay: 200ms; }
.stagger-animation > *:nth-child(6) { animation-delay: 250ms; }

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .mobile-menu-overlay.active {
        display: block;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-4);
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--glass-border);
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: var(--bg-surface);
        border: 1px solid var(--border-primary);
        border-radius: var(--radius-md);
        color: var(--text-primary);
        cursor: pointer;
    }

    .dashboard-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 13px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    .stat-card {
        padding: var(--space-4);
    }

    .stat-value {
        font-size: var(--text-2xl);
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: var(--text-xl);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-actions {
        width: 100%;
    }

    .table thead th,
    .table tbody td {
        padding: var(--space-3);
    }

    /* Hide non-essential columns on mobile */
    .hide-mobile {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: var(--space-6);
    }

    .btn {
        width: 100%;
    }
}

/* ============================================
   Language Switcher
   ============================================ */
.language-switcher {
    padding: var(--space-2) var(--space-4);
    margin-bottom: var(--space-2);
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .language-switcher {
    opacity: 0;
    visibility: hidden;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.lang-btn {
    background: transparent;
    border: 2px solid var(--border-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    position: relative;
}

.lang-btn:hover {
    border-color: var(--accent-info);
    background: var(--accent-info-muted);
    transform: translateY(-1px);
}

.lang-btn.active {
    border-color: var(--accent-info);
    background: var(--accent-info-muted);
    box-shadow: 0 0 8px var(--accent-info-glow);
}

.lang-btn:active {
    transform: translateY(0);
}

.lang-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .sidebar,
    .connection-status,
    .btn,
    .mobile-header {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        background: white;
        border: 1px solid #ddd;
        box-shadow: none;
    }
}
