/* TourStack Design System v2.1.0 */
/* Design sofisticado e minimal para gestao de transfers. Suporte a temas claro/escuro. */

/* ==========================================
   DARK THEME (Default)
   ========================================== */
:root,
[data-theme="dark"] {
    /* ========================================
       SEMANTIC COLORS
       ======================================== */
    --primary: #10b981;           /* Esmeralda - CTAs, acoes principais */
    --primary-hover: #059669;     /* Esmeralda Escuro */
    --primary-light: #34d399;     /* Esmeralda Claro */
    --primary-rgb: 16, 185, 129;

    --secondary: #475569;         /* Slate Grey - acoes secundarias */
    --secondary-hover: #334155;

    --success: #34d399;           /* Verde Claro - confirmacoes */
    --warning: #fbbf24;           /* Ambar - pendentes */
    --danger: #f87171;            /* Vermelho Suave - cancelados/erros */
    --info: #38bdf8;              /* Azul Ceu - informacoes */

    /* ========================================
       BACKGROUNDS
       ======================================== */
    --bg-body: #0f172a;           /* Slate 900 - fundo principal */
    --bg-surface: #1e293b;        /* Slate 800 - cards, modals, dropdowns */
    --bg-input: #334155;          /* Slate 700 - campos de formulario */
    --bg-elevated: #475569;       /* Slate 600 - elementos elevados */
    --bg-hover: rgba(16, 185, 129, 0.08); /* Hover sutil com primary */

    /* ========================================
       TEXT COLORS
       ======================================== */
    --text-main: #f1f5f9;         /* Slate 100 - texto principal */
    --text-muted: #94a3b8;        /* Slate 400 - textos secundarios, labels */
    --text-inverse: #0f172a;      /* Para texto em fundos claros */

    /* ========================================
       BORDER COLORS
       ======================================== */
    --border-color: #334155;      /* Slate 700 */
    --border-light: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(16, 185, 129, 0.5);

    /* ========================================
       LAYOUT
       ======================================== */
    --sidebar-width: 260px;
    --navbar-height: 64px;
    --border-radius: 0.5rem;
    --border-radius-sm: 0.375rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;

    /* ========================================
       SHADOWS (Dark Theme)
       ======================================== */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --shadow-glow-primary: 0 0 20px rgba(16, 185, 129, 0.15);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.1);

    /* ========================================
       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-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ========================================
       SPACING SCALE
       ======================================== */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* ========================================
       GLASSMORPHISM (Dark Theme)
       ======================================== */
    --navbar-bg: rgba(30, 41, 59, 0.8);
    --navbar-border: rgba(255, 255, 255, 0.05);
    --sidebar-bg: rgba(30, 41, 59, 0.95);

    /* Theme indicator */
    --theme-icon: "\f497"; /* bi-moon-stars */
}

/* ==========================================
   LIGHT THEME
   ========================================== */
[data-theme="light"] {
    /* ========================================
       SEMANTIC COLORS (adjusted for light)
       ======================================== */
    --primary: #059669;           /* Esmeralda mais escuro para contraste */
    --primary-hover: #047857;
    --primary-light: #10b981;
    --primary-rgb: 5, 150, 105;

    --secondary: #64748b;         /* Slate Grey */
    --secondary-hover: #475569;

    --success: #059669;           /* Verde */
    --warning: #d97706;           /* Ambar mais escuro */
    --danger: #dc2626;            /* Vermelho */
    --info: #0284c7;              /* Azul */

    /* ========================================
       BACKGROUNDS
       ======================================== */
    --bg-body: #f8fafc;           /* Slate 50 */
    --bg-surface: #ffffff;        /* White */
    --bg-input: #f1f5f9;          /* Slate 100 */
    --bg-elevated: #e2e8f0;       /* Slate 200 */
    --bg-hover: rgba(5, 150, 105, 0.06);

    /* ========================================
       TEXT COLORS
       ======================================== */
    --text-main: #1e293b;         /* Slate 800 */
    --text-muted: #64748b;        /* Slate 500 */
    --text-inverse: #f8fafc;      /* Para texto em fundos escuros */

    /* ========================================
       BORDER COLORS
       ======================================== */
    --border-color: #e2e8f0;      /* Slate 200 */
    --border-light: rgba(0, 0, 0, 0.06);
    --border-focus: rgba(5, 150, 105, 0.5);

    /* ========================================
       SHADOWS (Light Theme)
       ======================================== */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-glow-primary: 0 0 20px rgba(5, 150, 105, 0.1);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

    /* ========================================
       GLASSMORPHISM (Light Theme)
       ======================================== */
    --navbar-bg: rgba(255, 255, 255, 0.85);
    --navbar-border: rgba(0, 0, 0, 0.08);
    --sidebar-bg: rgba(255, 255, 255, 0.95);

    /* Theme indicator */
    --theme-icon: "\f5a2"; /* bi-sun */
}

/* Smooth theme transition */
body,
.sidebar,
.navbar,
.card,
.modal-content,
.dropdown-menu,
.list-group-item,
.form-control,
.form-select,
.btn {
    transition: background-color var(--transition-base),
                color var(--transition-base),
                border-color var(--transition-base),
                box-shadow var(--transition-base);
}

/* ==========================================
   GLOBAL STYLES
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background: var(--bg-body);
    font-size: 0.9375rem; /* 15px - slightly smaller for elegance */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11"; /* Inter stylistic sets */
}

/* Override Bootstrap bg-light for dark theme */
body.bg-light {
    background: var(--bg-body) !important;
}

/* ==========================================
   TYPOGRAPHY - Refined Scale
   ========================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.3;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.035em;
}
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
h6 {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-muted);
}

/* Paragraph refinements */
p {
    margin-bottom: 1rem;
    color: var(--text-main);
}

.lead {
    font-size: 1.0625rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.7;
}

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

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

/* Label styling */
.form-label, label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.01em;
    margin-bottom: 0.375rem;
}

/* Small text refinement */
small, .small {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Monospace for codes */
.font-mono, code, pre, .confirmation-number {
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}

/* ==========================================
   SIDEBAR - Refined Navigation
   ========================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header h5 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin: 0;
    font-size: 1.125rem;
}

/* Brand icon pulse on hover */
.sidebar-header a:hover .bi-bus-front {
    animation: subtlePulse 1s ease-in-out;
}

@keyframes subtlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.org-info {
    background: var(--bg-input);
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0.5rem;
}

/* Sidebar section titles */
.sidebar-nav .nav-link.text-muted {
    color: var(--text-muted) !important;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 1rem 1rem 0.5rem;
    margin-top: 0.25rem;
    pointer-events: none;
    opacity: 0.7;
}

.sidebar-nav .nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-base);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    margin: 2px 0;
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

/* Refined active state with left indicator */
.sidebar-nav .nav-link.active {
    background: var(--bg-hover);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 0.625rem;
    font-size: 1rem;
    opacity: 0.85;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.sidebar-nav .nav-link:hover i,
.sidebar-nav .nav-link.active i {
    opacity: 1;
}

.sidebar-nav .nav-link.active i {
    color: var(--primary);
}

.sidebar-footer {
    flex-shrink: 0;
    background: linear-gradient(to top, var(--bg-input), transparent);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
}

.sidebar-footer .avatar {
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 2px;
}

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

/* Hidden Sidebar */
.sidebar.hidden {
    transform: translateX(-100%);
}

body.sidebar-hidden .main-content {
    margin-left: 0;
}

/* Transition for sidebar */
.sidebar {
    transition: transform var(--transition-base);
}

/* Collapsible Sidebar Sections */
.nav-section {
    list-style: none;
}

.nav-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: var(--border-radius-sm);
}

.nav-section-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.nav-section-title {
    opacity: 0.7;
}

.nav-section-toggle:hover .nav-section-title {
    opacity: 1;
}

.nav-section-icon {
    font-size: 0.75rem;
    transition: transform var(--transition-fast);
    opacity: 0.5;
}

.nav-section-toggle:hover .nav-section-icon {
    opacity: 1;
}

.nav-section-toggle[aria-expanded="false"] .nav-section-icon {
    transform: rotate(-90deg);
}

.nav-section-items {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    max-height: 500px;
    transition: max-height var(--transition-slow), opacity var(--transition-fast);
}

.nav-section-items.collapsed {
    max-height: 0;
    opacity: 0;
}

.main-content {
    transition: margin-left var(--transition-base);
}

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

/* ==========================================
   NAVBAR
   ========================================== */
.navbar {
    height: var(--navbar-height);
    background: var(--navbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--navbar-border);
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
}

.navbar .navbar-text {
    color: var(--text-muted);
}

.navbar .btn-link {
    color: var(--text-muted);
}

.navbar .btn-link:hover {
    color: var(--text-main);
}

/* Navbar Brand Wrapper with Breadcrumbs */
.navbar-brand-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
}

.navbar-brand-wrapper .navbar-brand {
    line-height: 1.2;
}

/* Breadcrumbs */
.breadcrumb {
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    font-size: 0.75rem;
}

.breadcrumb-item {
    color: var(--text-muted);
}

.breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-base);
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--text-main);
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--text-muted);
    padding: 0 0.5rem;
}

/* ==========================================
   CARDS - Refined Design
   ========================================== */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header .card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header .card-title i {
    color: var(--text-muted);
    font-size: 1rem;
}

.card-body {
    padding: 1.25rem;
    color: var(--text-main);
}

.card-footer {
    background: var(--bg-input);
    border-top: 1px solid var(--border-color);
    padding: 0.875rem 1.25rem;
}

/* ==========================================
   KPI STATS CARDS - Sophisticated Minimal
   ========================================== */
.card-stats {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
}

/* Subtle top accent line */
.card-stats::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
    opacity: 0;
    transition: opacity var(--transition-slow);
}

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

.card-stats:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(16, 185, 129, 0.2);
}

.card-stats .card-body {
    padding: 1.25rem;
}

.card-stats .icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    flex-shrink: 0;
}

.card-stats:hover .icon-box {
    transform: scale(1.05);
}

/* KPI text styling */
.card-stats h3 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
}

.card-stats h6 {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    text-transform: none;
    margin-bottom: 0.25rem;
}

/* Trend indicators */
.card-stats .text-success,
.card-stats .text-danger {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
}

/* Icon box color variants */
.icon-box.bg-primary, .icon-box.bg-opacity-10.text-primary {
    background: rgba(16, 185, 129, 0.12) !important;
    color: var(--primary) !important;
}

.icon-box.bg-success, .icon-box.bg-opacity-10.text-success {
    background: rgba(52, 211, 153, 0.12) !important;
    color: var(--success) !important;
}

.icon-box.bg-warning, .icon-box.bg-opacity-10.text-warning {
    background: rgba(251, 191, 36, 0.12) !important;
    color: var(--warning) !important;
}

.icon-box.bg-info, .icon-box.bg-opacity-10.text-info {
    background: rgba(56, 189, 248, 0.12) !important;
    color: var(--info) !important;
}

.icon-box.bg-danger, .icon-box.bg-opacity-10.text-danger {
    background: rgba(248, 113, 113, 0.12) !important;
    color: var(--danger) !important;
}

/* Staggered entrance animation for KPI cards */
@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-stats {
    animation: slideUpFade 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

/* Stagger delays for multiple cards */
.col-sm-6:nth-child(1) .card-stats { animation-delay: 0ms; }
.col-sm-6:nth-child(2) .card-stats { animation-delay: 50ms; }
.col-sm-6:nth-child(3) .card-stats { animation-delay: 100ms; }
.col-sm-6:nth-child(4) .card-stats { animation-delay: 150ms; }

.col-xl-3:nth-child(1) .card-stats { animation-delay: 0ms; }
.col-xl-3:nth-child(2) .card-stats { animation-delay: 50ms; }
.col-xl-3:nth-child(3) .card-stats { animation-delay: 100ms; }
.col-xl-3:nth-child(4) .card-stats { animation-delay: 150ms; }

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    transition: all var(--transition-base);
    text-transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--primary);
    border-color: transparent;
    color: var(--bg-body);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-hover);
    border-color: transparent;
    color: var(--bg-body);
}

.btn-primary:active {
    background: var(--primary-hover);
    border-color: transparent;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--bg-body);
    border-color: var(--primary);
}

.btn-secondary {
    background: var(--secondary);
    border-color: transparent;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    border-color: transparent;
    color: var(--text-main);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover {
    background: var(--bg-input);
    color: var(--text-main);
    border-color: var(--border-color);
}

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

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

.btn-success {
    background: var(--success);
    border-color: transparent;
    color: var(--bg-body);
}

.btn-success:hover {
    background: #10b981;
    color: var(--bg-body);
}

.btn-danger {
    background: var(--danger);
    border-color: transparent;
    color: var(--bg-body);
}

.btn-danger:hover {
    background: #ef4444;
    color: var(--bg-body);
}

.btn-warning {
    background: var(--warning);
    border-color: transparent;
    color: var(--text-dark) !important;
}

.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active {
    color: var(--text-dark) !important;
}

.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-warning:active {
    color: var(--text-dark) !important;
}

.btn-info {
    background: var(--info);
    border-color: transparent;
    color: var(--bg-body);
}

.btn-link {
    color: var(--primary);
}

.btn-link:hover {
    color: var(--primary-hover);
}

/* ==========================================
   FORMS
   ========================================== */
.form-control,
.form-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-main);
    padding: 0.625rem 0.875rem;
    transition: all var(--transition-base);
}

/* Select dropdown arrow - white for dark theme */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.25rem;
}

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

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-input);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
    color: var(--text-main);
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--bg-surface);
    opacity: 0.6;
}

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

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

.form-check-input {
    background-color: var(--bg-input);
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.form-check-label {
    color: var(--text-main);
}

.input-group-text {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Invalid states */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
}

.invalid-feedback {
    color: var(--danger);
}

/* ==========================================
   TABLES - Refined Minimal Design
   ========================================== */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-border-color: var(--border-color);
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 1rem;
    border-bottom-color: var(--border-color);
    text-align: left;
}

.table td.text-end,
.table th.text-end {
    text-align: right;
}

.table td.text-center,
.table th.text-center {
    text-align: center;
}

.table thead {
    background: var(--bg-input);
}

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

.table thead th.text-end {
    text-align: right;
}

.table thead th.text-center {
    text-align: center;
}

.table tbody tr {
    transition: background var(--transition-fast), transform var(--transition-fast);
}

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

/* Table hover highlight - first cell gets left indicator */
.table-hover tbody tr:hover > td:first-child {
    box-shadow: inset 3px 0 0 var(--primary);
}

.table-striped tbody tr:nth-of-type(odd) {
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
}

/* Table cell link styling */
.table td a {
    color: var(--primary);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.table td a:hover {
    color: var(--primary-light);
}

/* Data Table wrapper */
.data-table {
    background: var(--bg-surface);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    width: 100%;
}

.data-table .table {
    margin-bottom: 0;
    width: 100%;
}

/* Table responsive - ensure full width */
.table-responsive {
    width: 100%;
}

.table-responsive .table {
    width: 100%;
}

/* Card body with table - remove padding for full width */
.card-body.p-0 .table,
.card-body.p-0 .table-responsive {
    width: 100%;
}

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

.data-table .table thead th.text-end {
    text-align: right;
}

.data-table .table thead th.text-center {
    text-align: center;
}

.data-table .table thead th:first-child {
    border-top-left-radius: var(--border-radius-lg);
}

.data-table .table thead th:last-child {
    border-top-right-radius: var(--border-radius-lg);
}

.data-table .table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    color: var(--text-main);
    text-align: left;
}

.data-table .table tbody td.text-end {
    text-align: right;
}

.data-table .table tbody td.text-center {
    text-align: center;
}

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

/* Table row selected state */
.table tr.selected {
    background-color: rgba(16, 185, 129, 0.08) !important;
}

.table tr.selected > td:first-child {
    box-shadow: inset 3px 0 0 var(--primary);
}

/* Checkbox column */
.col-checkbox,
.checkbox-column {
    width: 48px;
    text-align: center !important;
    padding-left: 1rem !important;
    padding-right: 0.5rem !important;
}

/* Checkbox in table header - ensure visibility */
.table thead th .form-check-input,
.data-table thead th .form-check-input {
    background-color: var(--bg-surface);
    border-color: var(--text-muted);
}

.table thead th .form-check-input:checked,
.data-table thead th .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Actions column */
.col-actions {
    width: 1%;
    white-space: nowrap;
}

/* Action buttons in table */
.table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Table truncated text */
.table .text-truncate {
    max-width: 200px;
}

/* Truncate text in table cells */
.text-truncate-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================
   BADGES / STATUS
   ========================================== */
.badge {
    font-weight: 600;
    padding: 0.25em 0.6em;
    border-radius: 9999px;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
}

/* Status Badges - Differentiated colors */
/* Draft - Slate */
.badge-draft {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

/* Quote - Gray */
.badge-quote {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

/* Pending - Amber/Warning */
.badge-pending {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

/* Confirmed - Green/Success */
.badge-confirmed,
.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* Assigned - Blue */
.badge-assigned {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
}

/* In Progress - Amber/Orange */
.badge-in_progress,
.badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #f59e0b;
}

/* Pending Review - Purple */
.badge-pending_review {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
}

/* Completed - Green/Success */
.badge-completed {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* Cancelled & No Show - Red/Danger */
.badge-cancelled,
.badge-no_show,
.badge-danger {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

/* Generic info badge */
.badge-info {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
}

/* Status Select Dropdowns - Matching colors */
select.badge-draft {
    background: rgba(100, 116, 139, 0.15) !important;
    color: #64748b !important;
}

select.badge-quote {
    background: rgba(148, 163, 184, 0.15) !important;
    color: #94a3b8 !important;
}

select.badge-pending {
    background: rgba(251, 191, 36, 0.15) !important;
    color: #fbbf24 !important;
}

select.badge-confirmed {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
}

select.badge-assigned {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
}

select.badge-in_progress {
    background: rgba(251, 191, 36, 0.15) !important;
    color: #f59e0b !important;
}

select.badge-pending_review {
    background: rgba(167, 139, 250, 0.15) !important;
    color: #a78bfa !important;
}

select.badge-completed {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
}

select.badge-cancelled,
select.badge-no_show {
    background: rgba(248, 113, 113, 0.15) !important;
    color: #f87171 !important;
}

/* Driver Status Badges */
.bg-available {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
}

.bg-busy {
    background: rgba(251, 191, 36, 0.15) !important;
    color: #fbbf24 !important;
}

.bg-off {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
}

.bg-inactive {
    background: var(--bg-input) !important;
    color: var(--text-muted) !important;
}

/* Vehicle Status Badges */
.bg-in_use {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
}

.bg-maintenance {
    background: rgba(251, 191, 36, 0.15) !important;
    color: #fbbf24 !important;
}

/* Status border colors for cards */
.border-quote { border-color: #6c757d !important; }
.border-confirmed { border-color: #0d6efd !important; }
.border-assigned { border-color: var(--primary) !important; }
.border-in_progress { border-color: #fd7e14 !important; }
.border-completed { border-color: var(--success) !important; }
.border-cancelled { border-color: var(--danger) !important; }
.border-no_show { border-color: var(--danger) !important; }

/* Dashed border utility */
.border-dashed { border-style: dashed !important; }

/* Bootstrap badge overrides */
.bg-primary {
    background-color: var(--primary) !important;
}

.bg-secondary {
    background-color: var(--secondary) !important;
}

.bg-success {
    background-color: var(--success) !important;
}

.bg-danger {
    background-color: var(--danger) !important;
}

.bg-warning {
    background-color: var(--warning) !important;
    color: var(--text-dark) !important;
}

.bg-info {
    background-color: var(--info) !important;
}

/* ==========================================
   DROPDOWNS
   ========================================== */
.dropdown-menu {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
}

.dropdown-item {
    color: var(--text-main);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--bg-input);
    color: var(--text-main);
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--primary);
    color: var(--bg-body);
}

.dropdown-divider {
    border-color: var(--border-color);
}

/* ==========================================
   MODALS
   ========================================== */
.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.modal-title {
    color: var(--text-main);
}

.modal-body {
    padding: 1.25rem;
    color: var(--text-main);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

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

/* ==========================================
   ALERTS
   ========================================== */
.alert {
    border-radius: var(--border-radius);
    border: none;
}

.alert-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.alert-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.alert-info {
    background: rgba(56, 189, 248, 0.15);
    color: var(--info);
}

/* ==========================================
   PAGINATION
   ========================================== */
.pagination .page-link {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--border-radius-sm);
    margin: 0 2px;
    font-weight: 500;
}

.pagination .page-link:hover {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-main);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--bg-body);
}

.pagination .page-item.disabled .page-link {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-muted);
    opacity: 0.5;
}

/* ==========================================
   PAGE HEADER
   ========================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.page-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title-bar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.page-title-bar .actions {
    display: flex;
    gap: 0.5rem;
}

/* ==========================================
   DETAIL HEADER
   ========================================== */
.detail-header {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.detail-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}

.detail-header h2 {
    margin: 0.5rem 0;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

/* ==========================================
   DETAIL CARD
   ========================================== */
.detail-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
}

.detail-card h5 {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    font-weight: 600;
}

.detail-item {
    margin-bottom: 1rem;
}

.detail-item label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-item span {
    font-weight: 500;
    color: var(--text-main);
}

/* ==========================================
   FILTER SECTION
   ========================================== */
.filters-section,
.filter-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.filter-card .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

/* ==========================================
   EMPTY STATE - Elegant Minimal
   ========================================== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    opacity: 0.4;
    display: block;
}

/* Subtle icon container */
.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-input);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.empty-state-icon i {
    font-size: 2rem;
    margin: 0;
    opacity: 0.6;
}

.empty-state h5 {
    color: var(--text-main);
    margin-bottom: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state .btn {
    margin-top: 0.5rem;
}

/* Compact empty state for small areas */
.empty-state-sm {
    padding: 2rem 1.5rem;
}

.empty-state-sm i {
    font-size: 2.5rem;
}

.empty-state-sm h5 {
    font-size: 0.9375rem;
}

.empty-state-sm p {
    font-size: 0.8125rem;
}

/* ==========================================
   PROGRESS BARS
   ========================================== */
.progress {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-input);
    overflow: hidden;
}

.progress-bar {
    border-radius: 4px;
    transition: width var(--transition-slow);
    background: var(--primary);
}

/* ==========================================
   AVATAR
   ========================================== */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    background: var(--primary);
    color: var(--bg-body);
}

/* ==========================================
   HTMX INDICATORS
   ========================================== */
.htmx-indicator {
    display: none;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.htmx-request .htmx-indicator {
    display: inline-block;
    opacity: 1;
}

.htmx-request.htmx-indicator {
    display: inline-block;
    opacity: 1;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg-input);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

/* HTMX swap animations */
.htmx-swapping {
    opacity: 0.5;
    transition: opacity var(--transition-base);
}

.htmx-settling {
    animation: fadeIn var(--transition-base) ease-out;
}

/* ==========================================
   FLIGHT STATUS CARD
   ========================================== */
.flight-status-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.flight-status-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='rgba(16,185,129,0.1)'%3E%3Cpath d='M3.478 2.405a.75.75 0 00-.926.94l2.432 7.905H13.5a.75.75 0 010 1.5H4.984l-2.432 7.905a.75.75 0 00.926.94 60.519 60.519 0 0018.445-8.986.75.75 0 000-1.218A60.517 60.517 0 003.478 2.405z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    opacity: 0.3;
}

.flight-status-card .flight-number {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-main);
}

.flight-status-card .flight-route {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.flight-status-card .airport-code {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.flight-status-card .flight-line {
    flex: 1;
    height: 2px;
    background: var(--border-color);
    position: relative;
}

.flight-status-card .flight-line::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.flight-status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.flight-status-badge.on-time { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.flight-status-badge.delayed { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.flight-status-badge.cancelled { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.flight-status-badge.landed { background: rgba(56, 189, 248, 0.15); color: var(--info); }

/* ==========================================
   BULK ACTIONS BAR
   ========================================== */
#bulk-actions-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    border-radius: var(--border-radius);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   QUICK ACTIONS
   ========================================== */
.quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    border: none;
    cursor: pointer;
}

.quick-action-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-main);
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    color: var(--text-main);
}

.toast-header {
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

/* ==========================================
   MONEY/FINANCIAL
   ========================================== */
.money-positive { color: var(--success); }
.money-negative { color: var(--danger); }

.money-large {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

/* ==========================================
   PULSE ANIMATION
   ========================================== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ==========================================
   TEXT UTILITIES
   ========================================== */
.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-info {
    color: var(--info) !important;
}

/* ==========================================
   BORDER UTILITIES
   ========================================== */
.border {
    border-color: var(--border-color) !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

/* ==========================================
   NAV TABS
   ========================================== */
.nav-tabs {
    border-bottom-color: var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--text-main);
    border-color: transparent;
    border-bottom-color: var(--border-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    background: transparent;
    border-color: transparent;
    border-bottom-color: var(--primary);
}

.nav-tabs .nav-link .badge {
    font-size: 0.65rem;
    font-weight: 600;
    vertical-align: middle;
}

.nav-tabs .nav-link.active .badge {
    background: var(--primary) !important;
}

/* ==========================================
   NAV PILLS
   ========================================== */
.nav-pills .nav-link {
    color: var(--text-muted);
    border-radius: var(--border-radius);
}

.nav-pills .nav-link:hover {
    color: var(--text-main);
    background: var(--bg-input);
}

.nav-pills .nav-link.active {
    color: var(--bg-body);
    background: var(--primary);
}

/* ==========================================
   LIST GROUP
   ========================================== */
.list-group-item {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-main);
}

.list-group-item:hover {
    background: var(--bg-input);
}

.list-group-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--bg-body);
}

/* ==========================================
   ACCORDION
   ========================================== */
.accordion-item {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

.accordion-button {
    background: var(--bg-surface);
    color: var(--text-main);
}

.accordion-button:not(.collapsed) {
    background: var(--bg-input);
    color: var(--primary);
}

.accordion-button::after {
    filter: invert(1);
}

.accordion-body {
    background: var(--bg-surface);
    color: var(--text-main);
}

/* ==========================================
   OFFCANVAS
   ========================================== */
.offcanvas {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

.offcanvas-header {
    border-bottom: 1px solid var(--border-color);
}

.offcanvas-title {
    color: var(--text-main);
}

/* ==========================================
   POPOVER
   ========================================== */
.popover {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

.popover-header {
    background: var(--bg-input);
    border-bottom-color: var(--border-color);
    color: var(--text-main);
}

.popover-body {
    color: var(--text-main);
}

/* ==========================================
   TOOLTIP
   ========================================== */
.tooltip-inner {
    background: var(--bg-elevated);
}

/* ==========================================
   BREADCRUMB
   ========================================== */
.breadcrumb {
    background: transparent;
}

.breadcrumb-item {
    color: var(--text-muted);
}

.breadcrumb-item.active {
    color: var(--text-main);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

.breadcrumb-item a {
    color: var(--text-muted);
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

    .sidebar.show {
        transform: translateX(0);
    }

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

/* ==========================================
   SCROLLBAR (Global)
   ========================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

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

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) var(--bg-body);
}

/* ==========================================
   BOOTSTRAP OVERRIDES (Dark Theme)
   ========================================== */

/* Background utilities */
.bg-white {
    background-color: var(--bg-surface) !important;
}

.bg-light {
    background-color: var(--bg-body) !important;
}

.bg-body {
    background-color: var(--bg-body) !important;
}

/* Text utilities */
.text-dark {
    color: var(--text-main) !important;
}

.text-body {
    color: var(--text-main) !important;
}

/* Border utilities */
.border-light {
    border-color: var(--border-color) !important;
}

.border-secondary {
    border-color: var(--border-color) !important;
}

/* Dropdown header */
.dropdown-header {
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Input group */
.input-group-text {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Select2 / Choices.js overrides (if used) */
.choices__inner {
    background: var(--bg-input);
    border-color: var(--border-color);
}

.choices__list--dropdown {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

/* Card variants */
.card.bg-light {
    background: var(--bg-surface) !important;
}

.card-header.bg-light {
    background: var(--bg-input) !important;
}

/* Table variants */
.table-light {
    --bs-table-bg: var(--bg-input);
    --bs-table-color: var(--text-main);
}

/* Close button in dark theme */
.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
}

.btn-close:hover {
    opacity: 1;
}

/* Notification badge */
#notification-badge .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.65rem;
    padding: 0.2em 0.45em;
}

/* Spinner in dark theme */
.spinner-border {
    color: var(--primary);
}

.spinner-border-sm {
    color: var(--text-muted);
}

/* Hr / Dividers */
hr {
    border-color: var(--border-color);
    opacity: 1;
}

/* Lead text */
.lead {
    color: var(--text-muted);
}

/* Small text */
small, .small {
    color: var(--text-muted);
}

/* Figure caption */
.figure-caption {
    color: var(--text-muted);
}

/* Mark / Highlight */
mark, .mark {
    background-color: rgba(251, 191, 36, 0.3);
    color: var(--text-main);
}

/* Blockquote */
.blockquote-footer {
    color: var(--text-muted);
}

/* Form floating labels */
.form-floating > label {
    color: var(--text-muted);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--text-muted);
}

/* Range input */
.form-range::-webkit-slider-thumb {
    background: var(--primary);
}

.form-range::-webkit-slider-runnable-track {
    background: var(--bg-input);
}

/* Select option (for native select) */
option {
    background: var(--bg-surface);
    color: var(--text-main);
}

/* Placeholder text */
::placeholder {
    color: var(--text-muted) !important;
    opacity: 1;
}

/* Autofill styles */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-main);
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-input) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Focus visible outline */
:focus-visible {
    outline-color: var(--primary);
}

/* Selection highlight */
::selection {
    background: rgba(16, 185, 129, 0.3);
    color: var(--text-main);
}

/* Code blocks and pre elements */
pre, code {
    background: var(--bg-input);
    color: var(--text-main);
}

pre {
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

code {
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

pre code {
    padding: 0;
    background: transparent;
}

pre.bg-light, code.bg-light {
    background: var(--bg-input) !important;
}

/* Table row variants */
tr.bg-light, .table tr.bg-light {
    background-color: var(--bg-input) !important;
}

tr.bg-light td, tr.bg-light th {
    color: var(--text-main);
}

/* List group item highlight */
.list-group-item.bg-light {
    background: var(--bg-input) !important;
}

/* Card inside card (nested bg-light) */
.card.bg-light .card-header {
    background: var(--bg-input) !important;
}

/* Border top utility fix */
.border-top {
    border-top-color: var(--border-color) !important;
}

/* Form text (helper text) */
.form-text {
    color: var(--text-muted);
}

/* Valid/Invalid feedback */
.valid-feedback {
    color: var(--success);
}

.invalid-feedback {
    color: var(--danger);
}

/* Disabled state */
.disabled, :disabled {
    opacity: 0.6;
}

/* Shadow overrides */
.shadow, .shadow-sm, .shadow-lg {
    box-shadow: var(--shadow-md) !important;
}

/* ==========================================
   MICRO-INTERACTIONS & POLISH
   ========================================== */

/* Button hover lift effect */
.btn {
    transition: all var(--transition-base);
}

.btn-primary:hover,
.btn-outline-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

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

/* Icon button hover */
.btn-icon,
.btn-ghost {
    transition: all var(--transition-fast);
}

.btn-icon:hover,
.btn-ghost:hover {
    background: var(--bg-hover);
}

/* Badge pulse animation for notifications */
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.badge-notification {
    animation: badgePulse 2s ease-in-out infinite;
}

/* Link underline animation */
.link-animated {
    position: relative;
    text-decoration: none;
}

.link-animated::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--primary);
    transition: width var(--transition-base);
}

.link-animated:hover::after {
    width: 100%;
}

/* Card click feedback */
.card-clickable {
    cursor: pointer;
    transition: all var(--transition-base);
}

.card-clickable:hover {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: var(--shadow-lg);
}

.card-clickable:active {
    transform: scale(0.995);
}

/* List group item hover refinement */
.list-group-item-action {
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.list-group-item-action:hover {
    background: var(--bg-hover);
    border-left-color: var(--primary);
}

/* Input focus glow */
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Checkbox/Radio custom styling */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Smooth page transitions for HTMX */
.htmx-swapping {
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.htmx-settling {
    animation: fadeSlideIn 0.2s ease-out;
}

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

/* Loading skeleton animation */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

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

/* Status badge subtle animation */
.badge {
    transition: all var(--transition-fast);
}

.badge:hover {
    transform: scale(1.02);
}

/* Dropdown animation */
.dropdown-menu {
    animation: dropdownFade 0.15s ease-out;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal entrance animation */
.modal.show .modal-dialog {
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Toast notification animation */
.toast {
    animation: toastSlideIn 0.3s ease-out;
}

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

/* Focus ring for accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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

/* ==========================================
   UTILITY CLASSES
   ========================================== */

/* Subtle gradient backgrounds */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
}

.bg-gradient-surface {
    background: linear-gradient(180deg, var(--bg-surface), var(--bg-body));
}

/* Text gradient */
.text-gradient-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Divider with text */
.divider {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider::before {
    margin-right: 1rem;
}

.divider::after {
    margin-left: 1rem;
}

/* Number highlight */
.number-highlight {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-weight: 600;
    font-feature-settings: "tnum";
    letter-spacing: -0.02em;
}

/* Confirmation number styling */
.confirmation-number {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--primary);
}

/* ==========================================
   BOOKING SIDEBAR - Sticky Summary
   ========================================== */
.booking-sidebar {
    position: sticky;
    top: calc(var(--navbar-height) + 1.5rem);
    max-height: calc(100vh - var(--navbar-height) - 3rem);
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.booking-sidebar::-webkit-scrollbar {
    width: 4px;
}

.booking-sidebar::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 2px;
}

/* Summary Card */
.booking-summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.booking-summary-card .card-header {
    background: var(--bg-input);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.booking-summary-card .card-header h6 {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0;
}

.booking-summary-card .card-body {
    padding: 1rem;
}

/* Summary Items */
.summary-item {
    margin-bottom: 0.875rem;
}

.summary-item:last-child {
    margin-bottom: 0;
}

.summary-item-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.summary-item-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-main);
}

.summary-item-value.text-muted-placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

/* Route Display */
.route-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.route-point {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}

.route-point-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.route-point-icon.origin {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.route-point-icon.destination {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

.route-connector {
    width: 24px;
    display: flex;
    justify-content: center;
    padding: 0.25rem 0;
}

.route-connector-line {
    width: 2px;
    height: 16px;
    background: var(--border-color);
    position: relative;
}

.route-connector-line::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--border-color);
}

.route-point-text {
    font-size: 0.875rem;
    color: var(--text-main);
    line-height: 1.4;
    flex: 1;
    word-break: break-word;
}

/* Validation Checklist */
.validation-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.validation-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.validation-item:last-child {
    border-bottom: none;
}

.validation-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    flex-shrink: 0;
    transition: all var(--transition-base);
}

.validation-item.pending .validation-icon {
    background: var(--bg-input);
    color: var(--text-muted);
}

.validation-item.valid .validation-icon {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.validation-item.invalid .validation-icon {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

.validation-text {
    font-size: 0.8125rem;
    color: var(--text-main);
    flex: 1;
}

.validation-item.pending .validation-text {
    color: var(--text-muted);
}

.validation-item.valid .validation-text {
    color: var(--text-main);
}

/* Price Summary */
.price-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.price-summary-row.border-top {
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.price-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.price-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

.price-summary-row.total .price-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-main);
}

.price-summary-row.total .price-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Action Buttons in Sidebar */
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-actions .btn {
    width: 100%;
    justify-content: center;
}

.sidebar-actions .btn-lg {
    padding: 0.75rem 1rem;
}

/* Mobile Floating Action Bar */
.mobile-action-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-action-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 100%;
}

.mobile-action-bar-total {
    flex-shrink: 0;
}

.mobile-action-bar-total .label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.mobile-action-bar-total .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

.mobile-action-bar-buttons {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    justify-content: flex-end;
}

/* Show mobile bar and hide sidebar on mobile */
@media (max-width: 991.98px) {
    .mobile-action-bar {
        display: block;
    }

    /* Add padding to body to account for fixed bar */
    body.has-mobile-action-bar {
        padding-bottom: 80px;
    }
}

/* Info row for passengers/luggage */
.summary-info-row {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.summary-info-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.summary-info-item i {
    font-size: 0.9375rem;
}

/* ==========================================
   TOURSTACK COPILOT - AI Chat Sidebar
   ========================================== */

/* Sidebar Container */
.copilot-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    pointer-events: none;
}

.copilot-sidebar.open {
    pointer-events: auto;
}

/* Backdrop */
.copilot-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.copilot-sidebar.open .copilot-backdrop {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Panel */
.copilot-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100%;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

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

/* Header */
.copilot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.copilot-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.copilot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.copilot-avatar i {
    font-size: 1.25rem;
    color: white;
}

.copilot-title {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin: 0;
    letter-spacing: -0.01em;
}

.copilot-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    display: block;
}

.copilot-header-actions {
    display: flex;
    gap: 0.5rem;
}

.copilot-header-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.copilot-header-btn i {
    font-size: 0.875rem;
    color: white;
}

.copilot-header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Container */
.copilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-body);
}

/* Custom scrollbar for messages */
.copilot-messages::-webkit-scrollbar {
    width: 6px;
}

.copilot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.copilot-messages::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}

/* Message Bubbles */
.copilot-message {
    display: flex;
    gap: 0.75rem;
    max-width: 90%;
    animation: copilotMessageSlide 0.3s ease-out;
}

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

.copilot-message.assistant {
    align-self: flex-start;
}

.copilot-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.copilot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copilot-message-avatar i {
    font-size: 0.875rem;
    color: white;
}

.copilot-message.user .copilot-message-avatar {
    display: none;
}

.copilot-message-content {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    line-height: 1.6;
}

.copilot-message.assistant .copilot-message-content {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-top-left-radius: 4px;
}

.copilot-message.user .copilot-message-content {
    background: var(--primary);
    color: var(--bg-body);
    border-top-right-radius: 4px;
}

.copilot-message-content p {
    margin: 0 0 0.5rem;
}

.copilot-message-content p:last-child {
    margin-bottom: 0;
}

.copilot-message-content code {
    background: var(--bg-input);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-family: 'JetBrains Mono', monospace;
}

.copilot-message.user .copilot-message-content code {
    background: rgba(0, 0, 0, 0.2);
}

.copilot-message-content pre {
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: var(--bg-input);
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
}

.copilot-message-content pre code {
    padding: 0;
    background: transparent;
}

.copilot-message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.copilot-message-content li {
    margin-bottom: 0.25rem;
}

.copilot-message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.copilot-message-content h3,
.copilot-message-content h4,
.copilot-message-content h5 {
    margin: 0.75rem 0 0.5rem;
    color: var(--text-main);
    line-height: 1.4;
}

.copilot-message-content h3:first-child,
.copilot-message-content h4:first-child,
.copilot-message-content h5:first-child {
    margin-top: 0;
}

.copilot-message-content h3 {
    font-size: 1rem;
    font-weight: 700;
}

.copilot-message-content h4 {
    font-size: 0.9375rem;
    font-weight: 600;
}

.copilot-message-content h5 {
    font-size: 0.875rem;
    font-weight: 600;
}

.copilot-message-content em {
    font-style: italic;
    color: var(--text-muted);
}

.copilot-message-content strong {
    font-weight: 600;
    color: var(--primary-light);
}

.copilot-message-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.75rem 0;
}

/* Typewriter cursor */
.copilot-message-content.typing::after {
    content: '|';
    color: var(--primary);
    font-weight: 400;
    animation: copilotCursorBlink 0.7s ease-in-out infinite;
}

@keyframes copilotCursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Error message */
.copilot-message.error .copilot-message-content {
    background: rgba(248, 113, 113, 0.15);
    border-color: var(--danger);
    color: var(--danger);
}

/* Loading Animation */
.copilot-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.copilot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: copilotTyping 1.4s ease-in-out infinite both;
}

.copilot-typing span:nth-child(1) {
    animation-delay: 0s;
}

.copilot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.copilot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes copilotTyping {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Area */
.copilot-input-area {
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    position: relative;
}

.copilot-form {
    margin: 0;
}

.copilot-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.copilot-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.copilot-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.25rem 0;
    resize: none;
    max-height: 120px;
    font-family: inherit;
}

.copilot-input::placeholder {
    color: var(--text-muted);
}

.copilot-input:focus {
    outline: none;
}

.copilot-send-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    background: var(--primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.copilot-send-btn i {
    font-size: 0.875rem;
    color: var(--bg-body);
}

.copilot-send-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

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

/* Footer */
.copilot-footer {
    margin-top: 0.5rem;
    text-align: center;
}

.copilot-footer-text {
    font-size: 0.6875rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* Status Indicator Dot */
.copilot-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    position: absolute;
    bottom: 2px;
    right: 2px;
    border: 2px solid var(--primary-hover);
    animation: copilotStatusPulse 2s ease-in-out infinite;
}

@keyframes copilotStatusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Quick Suggestions */
.copilot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-body);
    border-top: 1px solid var(--border-color);
}

.copilot-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-main);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.copilot-suggestion i {
    font-size: 0.875rem;
    color: var(--primary);
}

.copilot-suggestion:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.copilot-suggestion:hover i {
    transform: scale(1.1);
}

/* Commands Dropdown */
.copilot-commands {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.copilot-commands.show {
    display: block;
    animation: copilotCommandsSlide 0.15s ease-out;
}

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

.copilot-commands-header {
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-input);
}

.copilot-commands-list {
    padding: 0.375rem;
}

.copilot-command {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-main);
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.copilot-command:hover,
.copilot-command.active {
    background: var(--bg-hover);
}

.copilot-command-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: var(--border-radius-sm);
    color: var(--primary);
    flex-shrink: 0;
}

.copilot-command-icon i {
    font-size: 1rem;
}

.copilot-command-info {
    flex: 1;
    min-width: 0;
}

.copilot-command-name {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--primary);
}

.copilot-command-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.copilot-command-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Commands Scrollbar */
.copilot-commands::-webkit-scrollbar {
    width: 4px;
}

.copilot-commands::-webkit-scrollbar-track {
    background: transparent;
}

.copilot-commands::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 2px;
}

/* Footer Keyboard Hints */
.copilot-footer-hints {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    opacity: 0.7;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.copilot-footer-hint {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.copilot-footer-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.125rem;
    padding: 0 0.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 3px;
}

/* Welcome Message */
.copilot-welcome {
    text-align: center;
    padding: 2rem 1rem;
}

.copilot-welcome-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copilot-welcome-icon i {
    font-size: 1.75rem;
    color: white;
}

.copilot-welcome-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.375rem;
}

.copilot-welcome-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Copilot Toggle Button in Navbar */
#copilot-toggle {
    color: var(--text-main);
    transition: all var(--transition-fast);
}

#copilot-toggle:hover {
    color: var(--primary);
}

#copilot-toggle i {
    transition: transform var(--transition-fast);
}

#copilot-toggle:hover i {
    transform: scale(1.1);
}

/* Mobile Responsive */
@media (max-width: 576px) {
    .copilot-panel {
        width: 100vw;
    }

    .copilot-header {
        padding: 0.875rem 1rem;
    }

    .copilot-messages {
        padding: 1rem;
    }

    .copilot-message {
        max-width: 95%;
    }

    .copilot-input-area {
        padding: 0.875rem 1rem;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .copilot-panel,
    .copilot-backdrop,
    .copilot-message {
        transition: none;
        animation: none;
    }

    .copilot-typing span {
        animation: none;
        opacity: 0.6;
    }
}

/* ========================================
   NOTIFICATION PULSE ANIMATION (RADAR)
   ======================================== */
.notification-pulse {
    animation: notification-pulse-animation 2s ease-in-out infinite;
}

@keyframes notification-pulse-animation {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Badge styling for notifications */
#notification-badge {
    z-index: 1;
}

#notification-badge .badge {
    z-index: 2;
    position: relative;
}

#notification-badge .notification-pulse {
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .notification-pulse {
        animation: none;
        display: none;
    }
}

/* ==========================================
   APP FOOTER
   ========================================== */
.app-footer {
    padding: 0.75rem 1.5rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.app-footer .text-muted {
    color: var(--text-muted) !important;
}

/* Ensure main-content is flex to push footer down */
.main-content {
    display: flex;
    flex-direction: column;
}

.main-content > .container-fluid {
    flex: 1;
}

/* ==========================================
   DESIGN SYSTEM ENHANCEMENTS v2.1
   ========================================== */

/* ------------------------------------------
   MICRO-ANIMATIONS
   ------------------------------------------ */

/* Button press effect */
.btn {
    transform: translateY(0);
    transition: all var(--transition-fast);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

/* Button hover lift effect */
.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Icon spin on hover for specific actions */
.btn-refresh:hover i,
.btn [class*="bi-arrow-clockwise"]:hover,
.refresh-btn:hover i {
    animation: spin 0.5s ease-in-out;
}

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

/* Card hover enhancement */
.card {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

/* Link underline animation */
.link-animated {
    position: relative;
    text-decoration: none;
}

.link-animated::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition-base);
}

.link-animated:hover::after {
    width: 100%;
}

/* Ripple effect for buttons */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Badge pulse for notifications */
.badge-pulse {
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Fade in animation */
.fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

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

/* Slide in animations */
.slide-in-up {
    animation: slideInUp var(--transition-slow) ease-out;
}

.slide-in-down {
    animation: slideInDown var(--transition-slow) ease-out;
}

.slide-in-left {
    animation: slideInLeft var(--transition-slow) ease-out;
}

.slide-in-right {
    animation: slideInRight var(--transition-slow) ease-out;
}

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

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

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

/* Scale in animation */
.scale-in {
    animation: scaleIn var(--transition-base) var(--transition-bounce);
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Stagger animation for lists */
.stagger-list > * {
    opacity: 0;
    animation: fadeIn var(--transition-slow) ease-out forwards;
}

.stagger-list > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-list > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-list > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-list > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-list > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-list > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-list > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-list > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-list > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-list > *:nth-child(10) { animation-delay: 0.5s; }

/* ------------------------------------------
   ENHANCED FOCUS STATES (Accessibility)
   ------------------------------------------ */

/* Global focus outline */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

/* Button focus */
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

/* Input focus enhancement */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Card focus (for keyboard navigation) */
.card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Link focus */
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Nav link focus */
.nav-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: var(--bg-hover);
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: var(--text-dark);
    padding: 0.5rem 1rem;
    z-index: 10000;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
}

/* ------------------------------------------
   TOAST NOTIFICATION SYSTEM
   ------------------------------------------ */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn var(--transition-slow) ease-out;
    pointer-events: auto;
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-error {
    border-left: 4px solid var(--danger);
}

.toast.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast.toast-info {
    border-left: 4px solid var(--info);
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-success .toast-icon {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.toast-error .toast-icon {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

.toast-warning .toast-icon {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.toast-info .toast-icon {
    background: rgba(56, 189, 248, 0.15);
    color: var(--info);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--border-radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.toast.hiding {
    animation: toastSlideOut var(--transition-base) ease-in forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Toast progress bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    animation: toastProgress 5s linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ------------------------------------------
   EMPTY STATES
   ------------------------------------------ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: 50%;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 2rem;
}

.empty-state-icon.empty-state-icon-lg {
    width: 120px;
    height: 120px;
    font-size: 3rem;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    max-width: 400px;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.empty-state-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Empty state illustrations (CSS-based) */
.empty-state-illustration {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
}

.empty-state-illustration::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--bg-input) 0%, var(--bg-elevated) 100%);
    border-radius: 50%;
    opacity: 0.5;
}

.empty-state-illustration::after {
    content: '';
    position: absolute;
    inset: 10px;
    background: var(--bg-surface);
    border-radius: 50%;
}

.empty-state-illustration i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: var(--text-muted);
    z-index: 1;
}

/* ------------------------------------------
   PAGE TRANSITIONS
   ------------------------------------------ */

/* Page fade transition */
.page-transition {
    animation: pageFadeIn var(--transition-slow) ease-out;
}

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

/* HTMX transitions */
.htmx-swapping {
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.htmx-settling {
    opacity: 1;
    transition: opacity var(--transition-base);
}

/* Content loading state */
.htmx-request {
    position: relative;
}

.htmx-request::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: loadingBar 1s infinite;
}

@keyframes loadingBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ------------------------------------------
   KEYBOARD SHORTCUT HINTS
   ------------------------------------------ */

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.375rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: inset 0 -1px 0 var(--bg-body);
}

.shortcut-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
    opacity: 0.7;
}

/* Keyboard shortcuts modal */
.shortcuts-modal .shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.shortcuts-modal .shortcut-row:last-child {
    border-bottom: none;
}

.shortcuts-modal .shortcut-keys {
    display: flex;
    gap: 0.25rem;
}

/* ------------------------------------------
   DRAG AND DROP
   ------------------------------------------ */

.draggable {
    cursor: grab;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.draggable:active {
    cursor: grabbing;
}

.draggable.dragging {
    opacity: 0.8;
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.drop-zone {
    position: relative;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.drop-zone.drag-over {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.drop-zone.drag-over::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px dashed var(--primary);
    border-radius: inherit;
    pointer-events: none;
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: var(--border-radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.drag-handle:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.drag-handle:active {
    cursor: grabbing;
}

/* ------------------------------------------
   INFINITE SCROLL
   ------------------------------------------ */

.infinite-scroll-container {
    position: relative;
}

.infinite-scroll-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}

.infinite-scroll-loader .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.infinite-scroll-end {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ------------------------------------------
   ENHANCED BUTTON VARIANTS
   ------------------------------------------ */

/* Ghost button improvements */
.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.btn-ghost:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.btn-ghost:active {
    background: var(--bg-input);
}

/* Soft button variants */
.btn-soft-primary {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border: none;
}

.btn-soft-primary:hover {
    background: rgba(16, 185, 129, 0.25);
    color: var(--primary-light);
}

.btn-soft-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
    border: none;
}

.btn-soft-danger:hover {
    background: rgba(248, 113, 113, 0.25);
}

.btn-soft-warning {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
    border: none;
}

.btn-soft-warning:hover {
    background: rgba(251, 191, 36, 0.25);
}

.btn-soft-info {
    background: rgba(56, 189, 248, 0.15);
    color: var(--info);
    border: none;
}

.btn-soft-info:hover {
    background: rgba(56, 189, 248, 0.25);
}

/* Icon-only button */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: var(--border-radius);
}

.btn-icon.btn-sm {
    width: 2rem;
    height: 2rem;
}

.btn-icon.btn-lg {
    width: 3rem;
    height: 3rem;
}

/* ------------------------------------------
   UTILITY ANIMATIONS
   ------------------------------------------ */

/* Shake animation for errors */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Bounce animation */
.bounce {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Pulse animation */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Glow effect */
.glow {
    box-shadow: var(--shadow-glow-primary);
}

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

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(16, 185, 129, 0.2); }
    50% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); }
}

/* ------------------------------------------
   ACCESSIBILITY ENHANCEMENTS
   ------------------------------------------ */

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #64748b;
        --text-muted: #cbd5e1;
    }

    .btn {
        border-width: 2px;
    }

    *:focus-visible {
        outline-width: 3px;
    }
}

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

    .htmx-request::after {
        animation: none;
    }
}

/* ------------------------------------------
   RESPONSIVE SPACING UTILITIES
   ------------------------------------------ */

.gap-responsive {
    gap: var(--space-sm);
}

@media (min-width: 768px) {
    .gap-responsive {
        gap: var(--space-md);
    }
}

@media (min-width: 1200px) {
    .gap-responsive {
        gap: var(--space-lg);
    }
}

/* ------------------------------------------
   GLOBAL AUTO-ANIMATIONS
   Apply animations automatically to common elements
   ------------------------------------------ */

/* Auto hover-lift for main content cards */
.main-content .card:not(.border-0):not(.bg-transparent) {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.main-content .card:not(.border-0):not(.bg-transparent):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Table row hover effect (non-breaking) */
.table tbody tr {
    transition: background-color var(--transition-fast);
}

/* Auto fade-in for alerts */
.alert {
    animation: slideInDown var(--transition-slow) ease-out;
}

/* Auto animation for modals */
.modal.show .modal-dialog {
    animation: scaleIn var(--transition-base) ease-out;
}

/* Auto animation for dropdowns */
.dropdown-menu.show {
    animation: fadeIn var(--transition-fast) ease-out;
}

/* Auto animation for badges in sidebar */
.sidebar .badge {
    animation: badgePulse 3s infinite;
}

/* Auto hover effect for table rows */
.table-hover tbody tr {
    transition: background-color var(--transition-fast);
}

/* Auto animation for list group items */
.list-group-item {
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.list-group-item:hover {
    background-color: var(--bg-hover);
}

/* ==========================================
   LOADING STATES SYSTEM
   ========================================== */

/* Button Loading State */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: btnSpinner 0.6s linear infinite;
}

.btn.is-loading * {
    visibility: hidden;
}

/* Restore color for the spinner based on button type */
.btn-primary.is-loading::after,
.btn-success.is-loading::after,
.btn-danger.is-loading::after,
.btn-info.is-loading::after {
    border-color: rgba(255, 255, 255, 0.3);
    border-right-color: white;
}

.btn-outline-primary.is-loading::after,
.btn-outline-secondary.is-loading::after,
.btn-secondary.is-loading::after,
.btn-light.is-loading::after {
    border-color: rgba(148, 163, 184, 0.3);
    border-right-color: var(--text-muted);
}

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

/* Form submitting state */
form.is-submitting .btn[type="submit"],
form.is-submitting button[type="submit"] {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

form.is-submitting .btn[type="submit"]::after,
form.is-submitting button[type="submit"]::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-right-color: white;
    animation: btnSpinner 0.6s linear infinite;
}

/* ==========================================
   SKELETON LOADERS
   ========================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-input) 25%,
        var(--bg-elevated) 50%,
        var(--bg-input) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--border-radius-sm);
}

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

/* Skeleton variants */
.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text-sm {
    height: 0.75rem;
    width: 60%;
}

.skeleton-title {
    height: 1.5rem;
    width: 40%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
}

.skeleton-btn {
    height: 38px;
    width: 100px;
}

.skeleton-card {
    height: 200px;
}

.skeleton-table-row {
    height: 52px;
    margin-bottom: 2px;
}

.skeleton-image {
    height: 150px;
    width: 100%;
}

/* Skeleton Table Component */
.skeleton-table {
    width: 100%;
}

.skeleton-table .skeleton-row {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-table .skeleton-cell {
    flex: 1;
    height: 1rem;
}

.skeleton-table .skeleton-cell-sm {
    flex: 0 0 80px;
}

.skeleton-table .skeleton-cell-lg {
    flex: 2;
}

/* ==========================================
   HTMX LOADING IMPROVEMENTS
   ========================================== */

/* Global page loading bar */
#page-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

#page-loading-bar.active {
    opacity: 1;
}

#page-loading-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--primary), var(--primary-light));
    animation: pageLoadingBar 1s ease-in-out infinite;
}

@keyframes pageLoadingBar {
    0% { left: -30%; }
    100% { left: 100%; }
}

/* HTMX request loading overlay for targets */
.htmx-request-overlay {
    position: relative;
}

.htmx-request-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.htmx-request-overlay.htmx-request::before {
    opacity: 1;
    pointer-events: auto;
}

.htmx-request-overlay::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2rem;
    height: 2rem;
    margin: -1rem 0 0 -1rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    z-index: 11;
    opacity: 0;
    pointer-events: none;
    animation: none;
}

.htmx-request-overlay.htmx-request::after {
    opacity: 1;
    animation: btnSpinner 0.6s linear infinite;
}

/* Improved HTMX swapping states */
.htmx-swapping {
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.htmx-settling {
    opacity: 1;
    transition: opacity var(--transition-base);
}

/* Content area loading state */
.content-loading {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-loading::after {
    content: '';
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: btnSpinner 0.8s linear infinite;
}

/* ==========================================
   LOADING SPINNER COMPONENT
   ========================================== */

.loading-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner::after {
    content: '';
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: btnSpinner 0.6s linear infinite;
}

.loading-spinner-sm::after {
    width: 1rem;
    height: 1rem;
}

.loading-spinner-lg::after {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
}

/* Loading text with spinner */
.loading-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.loading-text::before {
    content: '';
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: btnSpinner 0.6s linear infinite;
}

/* ==========================================
   FULL PAGE LOADING OVERLAY
   ========================================== */

.page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.page-loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.page-loading-overlay .spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: btnSpinner 0.8s linear infinite;
}

.page-loading-overlay .loading-message {
    color: var(--text-main);
    font-size: 0.875rem;
}
