/**
 * CasinoDash 2.0 Premium - Complete Redesign
 * Fixed: Mobile horizontal scroll, card spacing, premium look
 * 2026 Dark Glassmorphism Theme
 */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Color Palette - Premium Dark Theme */
    --bg-primary: #080b10;
    --bg-secondary: #0c1018;
    --bg-tertiary: #111822;
    --bg-card: rgba(17, 24, 34, 0.85);
    --bg-card-hover: rgba(24, 33, 46, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(0, 0, 0, 0.3);

    /* Accent Colors */
    --accent-primary: #7c3aed;
    --accent-primary-light: #a78bfa;
    --accent-primary-glow: rgba(124, 58, 237, 0.35);
    --accent-success: #10b981;
    --accent-success-light: #34d399;
    --accent-success-glow: rgba(16, 185, 129, 0.35);
    --accent-warning: #f59e0b;
    --accent-warning-glow: rgba(245, 158, 11, 0.35);
    --accent-danger: #ef4444;
    --accent-danger-glow: rgba(239, 68, 68, 0.35);
    --accent-info: #3b82f6;
    --accent-cpa: #ec4899;
    --accent-cpa-glow: rgba(236, 72, 153, 0.35);
    --accent-ftd: #06b6d4;
    --accent-ftd-glow: rgba(6, 182, 212, 0.35);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    /* Border Colors */
    --border-primary: rgba(255, 255, 255, 0.08);
    --border-secondary: rgba(255, 255, 255, 0.04);
    --border-glow: rgba(124, 58, 237, 0.4);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-premium: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    --gradient-card: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0) 100%);
    --gradient-glow: radial-gradient(ellipse at center, var(--accent-primary-glow) 0%, transparent 70%);
    --gradient-shine: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.05) 50%, transparent 70%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 60px var(--accent-primary-glow);
    --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.3);

    /* Spacing - Using clamp for responsiveness */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: clamp(1.25rem, 3vw, 2rem);
    --space-2xl: clamp(1.5rem, 4vw, 3rem);
    --space-3xl: clamp(2rem, 5vw, 4rem);

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

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

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

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 72px;
    --content-max-width: 1320px;
    --card-gap: clamp(12px, 2vw, 20px);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* CRITICAL: Prevent horizontal scroll */
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    /* CRITICAL: Prevent horizontal scroll */
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Premium Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 80% 50% at 20% 20%, rgba(124, 58, 237, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 30%, rgba(236, 72, 153, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 50% 50% at 50% 80%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: bgPulse 20s ease-in-out infinite;
}

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

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

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

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.25rem); }
h4 { font-size: 1.125rem; }

.text-success { color: var(--accent-success) !important; }
.text-danger { color: var(--accent-danger) !important; }
.text-warning { color: var(--accent-warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-cpa { color: var(--accent-cpa) !important; }
.text-ftd { color: var(--accent-ftd) !important; }

/* ============================================
   Layout - App Shell
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-logo-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

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

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

.nav-link.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
    color: var(--text-primary);
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.nav-link.active::before {
    height: 60%;
}

.nav-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

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

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
}

.content-wrapper {
    flex: 1;
    padding: var(--space-xl);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.page-title {
    font-size: clamp(1.5rem, 4vw, 1.875rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-top: var(--space-xs);
}

/* ============================================
   Cards - Premium Glassmorphism Design
   ============================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
    /* CRITICAL: Prevent card content overflow */
    max-width: 100%;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.card:hover {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: var(--shadow-card), 0 0 40px rgba(124, 58, 237, 0.08);
    transform: translateY(-2px);
}

.card-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-body {
    padding: var(--space-xl);
    overflow-x: auto;
}

.card-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border-primary);
    background: var(--bg-glass);
}

/* ============================================
   KPI Cards - Premium Stats Display with PROPER GAPS
   ============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--card-gap);
    margin-bottom: var(--space-xl);
    width: 100%;
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    min-width: 0; /* CRITICAL: Allows card to shrink */
}

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

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-shine);
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow: var(--shadow-lg), 0 0 50px var(--kpi-glow, var(--accent-primary-glow));
}

.kpi-card:hover::after {
    opacity: 1;
    animation: shine 1.5s ease-in-out;
}

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

.kpi-card.profit {
    --kpi-color: var(--gradient-success);
    --kpi-glow: var(--accent-success-glow);
}

.kpi-card.cpa {
    --kpi-color: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
    --kpi-glow: var(--accent-cpa-glow);
}

.kpi-card.ftd {
    --kpi-color: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    --kpi-glow: var(--accent-ftd-glow);
}

.kpi-card.casino {
    --kpi-color: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --kpi-glow: var(--accent-warning-glow);
}

.kpi-card.ltv {
    --kpi-color: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    --kpi-glow: rgba(139, 92, 246, 0.35);
}

.kpi-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    gap: var(--space-sm);
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--bg-glass-hover);
    flex-shrink: 0;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.kpi-value {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
    margin: var(--space-xs) 0;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}

.kpi-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    font-weight: 600;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.kpi-change.positive {
    color: var(--accent-success);
    background: rgba(16, 185, 129, 0.12);
}

.kpi-change.negative {
    color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.12);
}

.kpi-change.neutral {
    color: var(--text-secondary);
    background: var(--bg-glass);
}

/* ============================================
   Charts Container
   ============================================ */
.chart-container {
    position: relative;
    height: clamp(250px, 40vw, 350px);
    width: 100%;
    max-width: 100%;
}

.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.9375rem;
    text-align: center;
    padding: var(--space-xl);
    gap: var(--space-md);
}

.chart-empty code {
    background: var(--bg-glass);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

/* ============================================
   Tables - Premium Data Display
   ============================================ */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: calc(-1 * var(--space-lg));
    padding: var(--space-lg);
    /* Allow horizontal scroll for table only */
    max-width: calc(100% + var(--space-lg) * 2);
}

.table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    border-bottom: 1px solid var(--border-secondary);
    white-space: nowrap;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.5px;
    background: var(--bg-glass);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

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

.table .text-right {
    text-align: right;
}

.table tfoot tr {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(168, 85, 247, 0.04) 100%);
    font-weight: 600;
}

.table tfoot td {
    border-bottom: none;
    border-top: 2px solid var(--border-primary);
}

/* Casino Name Column */
.casino-name {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.casino-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* ============================================
   Badges & Status
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-affilka {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-primary-light);
}

.badge-cellxpert {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success-light);
}

.badge-afflines {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 700;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 16px var(--accent-primary-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--accent-primary-glow);
}

.btn-secondary {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-glow);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 16px var(--accent-success-glow);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: white;
    box-shadow: 0 4px 16px var(--accent-danger-glow);
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.75rem;
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 0.9375rem;
}

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

.btn-group {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

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

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

.form-control {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
    background: rgba(0, 0, 0, 0.4);
}

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

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.form-check-input {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-primary);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    accent-color: var(--accent-primary);
}

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

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

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

.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-full {
    grid-column: 1 / -1;
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 0.875rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--accent-success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--accent-danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: var(--accent-warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: var(--accent-info);
}

/* ============================================
   Filters Bar - FULLY RESPONSIVE
   ============================================ */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.filter-tabs {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

.filter-tab:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.filter-tab.active {
    color: white;
    background: var(--gradient-primary);
}

.date-range-form {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.date-range-form input[type="date"] {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8125rem;
    min-width: 130px;
}

.date-range-form input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
}

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

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-2xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

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

.login-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto var(--space-lg);
    box-shadow: var(--shadow-glow);
}

.login-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.login-form .form-group {
    margin-bottom: var(--space-lg);
}

.login-form .btn-primary {
    width: 100%;
    padding: var(--space-md);
    font-size: 0.9375rem;
}

/* ============================================
   Mobile Menu Button
   ============================================ */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: var(--space-md);
    left: var(--space-md);
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    z-index: 200;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}

.mobile-menu-btn:hover {
    background: var(--bg-card-hover);
}

.hamburger-line {
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-lg { margin-top: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }
.text-center { text-align: center; }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

.animate-slide-up {
    animation: slideUp var(--transition-slow) ease-out forwards;
    opacity: 0;
}

/* Staggered animations for cards */
.kpi-grid .kpi-card:nth-child(1) { animation-delay: 0ms; }
.kpi-grid .kpi-card:nth-child(2) { animation-delay: 60ms; }
.kpi-grid .kpi-card:nth-child(3) { animation-delay: 120ms; }
.kpi-grid .kpi-card:nth-child(4) { animation-delay: 180ms; }
.kpi-grid .kpi-card:nth-child(5) { animation-delay: 240ms; }

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-glass) 25%,
        var(--bg-glass-hover) 50%,
        var(--bg-glass) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   CRITICAL: Prevents horizontal scrolling
   ============================================ */

/* Tablet and below (1024px) */
@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }

    .content-wrapper {
        padding: var(--space-lg);
        padding-top: calc(var(--space-lg) + 60px);
    }

    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .form-grid,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        justify-content: center;
    }

    .date-range-form {
        justify-content: center;
    }

    .date-range-form input[type="date"] {
        flex: 1;
    }

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

/* Medium tablets (768px) */
@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }
}

/* Mobile (640px) */
@media (max-width: 640px) {
    :root {
        --space-xl: 1rem;
        --space-2xl: 1.25rem;
        --card-gap: 12px;
    }

    .content-wrapper {
        padding: var(--space-md);
        padding-top: calc(var(--space-md) + 56px);
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--card-gap);
    }

    .kpi-card {
        padding: var(--space-md);
    }

    .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .kpi-value {
        font-size: 1.25rem;
    }

    .kpi-label {
        font-size: 0.6875rem;
    }

    .kpi-change {
        font-size: 0.6875rem;
        padding: 2px 6px;
    }

    .card-header,
    .card-body {
        padding: var(--space-md);
    }

    .table-container {
        margin: calc(-1 * var(--space-md));
        padding: var(--space-md);
    }

    .table th,
    .table td {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.8125rem;
    }

    .btn-group {
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
        justify-content: center;
    }

    .filter-tabs {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .filter-tabs::-webkit-scrollbar {
        display: none;
    }

    .filter-tab {
        flex-shrink: 0;
    }

    .date-range-form {
        width: 100%;
    }

    .date-range-form input[type="date"] {
        min-width: 0;
        flex: 1;
    }

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

    .page-title {
        font-size: 1.25rem;
    }

    /* Mobile card-style table */
    .table-mobile .table {
        min-width: 0;
    }

    .table-mobile .table thead {
        display: none;
    }

    .table-mobile .table tbody tr {
        display: block;
        background: var(--bg-glass);
        border: 1px solid var(--border-primary);
        border-radius: var(--radius-md);
        margin-bottom: var(--space-md);
        padding: var(--space-md);
    }

    .table-mobile .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-sm) 0;
        border-bottom: 1px solid var(--border-secondary);
        white-space: normal;
    }

    .table-mobile .table td:last-child {
        border-bottom: none;
    }

    .table-mobile .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.6875rem;
        text-transform: uppercase;
        flex-shrink: 0;
        margin-right: var(--space-md);
    }

    .table-mobile .table td.text-right {
        text-align: right;
    }

    .table-mobile .table tfoot {
        display: none;
    }

    .casino-name {
        flex-direction: column;
        align-items: flex-end;
        gap: var(--space-xs);
    }

    .casino-icon {
        display: none;
    }
}

/* Small mobile (380px) */
@media (max-width: 380px) {
    .content-wrapper {
        padding: var(--space-sm);
        padding-top: calc(var(--space-sm) + 52px);
    }

    .mobile-menu-btn {
        top: var(--space-sm);
        left: var(--space-sm);
        width: 40px;
        height: 40px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 100%;
    }

    .login-container {
        padding: 0;
    }

    .login-card {
        border-radius: var(--radius-lg);
        padding: var(--space-lg);
    }

    .page-title {
        font-size: 1.125rem;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .kpi-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .kpi-card {
        padding: var(--space-sm) var(--space-md);
    }

    .kpi-value {
        font-size: 1.125rem;
    }

    .chart-container {
        height: 180px;
    }
}

/* Large screens (1400px+) */
@media (min-width: 1400px) {
    .kpi-value {
        font-size: 2rem;
    }

    .chart-container {
        height: 400px;
    }

    .kpi-card {
        padding: var(--space-xl);
    }
}

/* Ultra-wide screens */
@media (min-width: 1800px) {
    :root {
        --sidebar-width: 300px;
        --content-max-width: 1600px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .mobile-menu-btn,
    .filters-bar,
    .btn {
        display: none !important;
    }

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

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    body::before {
        display: none;
    }
}

/* 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;
    }
}
