/* Premium Backoffice Theme */
:root {
    /* Refined Palette */
    --bg-body: #f1f5f9; /* Slate 100 */
    --bg-surface: #ffffff;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%); /* Indigo to Blue */
    --sidebar-bg: #0f172a; /* Slate 900 */
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: rgba(255, 255, 255, 0.15);
    
    /* Loader Colors */
    --loader-bg: rgba(255, 255, 255, 0.9);
    --loader-blur: 20px;
    
    /* Shadows */
    --shadow-soft: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Typography */
    --font-heading: 'Outfit', 'Inter', sans-serif; /* Suggesting Outfit for headings if available, else Inter */
}

/* Page Loader Styles */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--loader-bg);
    backdrop-filter: blur(var(--loader-blur));
    -webkit-backdrop-filter: blur(var(--loader-blur));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}

.page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
    max-width: 320px;
    width: 100%;
}

.loader-logo {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.loader-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.loader-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent
    );
    animation: loader-shimmer 1.5s infinite;
}

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

.loader-text {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px;
}

.loader-progress {
    height: 4px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin: 12px auto;
}

.loader-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--brand-primary, var(--primary-gradient));
    border-radius: 10px;
    transition: width 0.4s ease;
}

.loader-error {
    margin-top: 20px;
    padding: 16px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    color: #991b1b;
}

.loader-error p {
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.retry-btn {
    padding: 8px 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.retry-btn:hover {
    background: #dc2626;
}

.hidden {
    display: none !important;
}

/* Global Polish */
body {
    background-color: var(--bg-body);
    color: #334155; /* Slate 700 */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    letter-spacing: -0.025em;
    color: #1e293b; /* Slate 800 */
}

/* Sidebar Enhancements */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,0.05);
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
}

.sidebar-link {
    margin: 4px 16px;
    border-radius: 8px;
    padding: 12px 16px;
    color: #94a3b8; /* Slate 400 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover);
    color: #f8fafc;
    transform: translateX(4px);
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #ffffff;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
}

.sidebar-link.active::before {
    background-color: #60a5fa; /* Blue 400 */
    box-shadow: 0 0 8px #60a5fa;
    height: 20px;
    border-radius: 4px;
    left: -16px; /* Adjust based on padding */
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

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

/* Header Polish */
/* Header Polish */
.backoffice-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    position: relative !important; /* Force natural flow */
    z-index: 5 !important; /* Lower than modals (which are 1000+) */
}

/* Card Modernization */
.card, .dashboard-card, .branding-current, .branding-editor, .reports-table-container {
    background: var(--bg-surface);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: #cbd5e1;
}



/* Dashboard Header Layout */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Dashboard Stats Cards */
.dashboard-card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto;
    min-height: 140px;
}

.dashboard-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 1;
}

.dashboard-card p {
    font-size: 3rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 8px;
    z-index: 1;
}

/* Add subtle background patterns/blobs to cards */
.dashboard-card::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.05;
    z-index: 0;
}

/* Buttons */
.action-btn, .save-btn {
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.025em;
    padding: 10px 20px;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.action-btn:hover, .save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.action-btn.secondary {
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
}

.action-btn.secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Inputs */
input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    padding: 12px;
    transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
    background-color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Table Polish */
table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
}

table tbody tr {
    transition: background-color 0.1s;
}

table tbody tr:hover {
    background-color: #f1f5f9;
}

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

.management-section {
    animation: fadeIn 0.4s ease-out forwards;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Login Page Styles */
body.login-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.login-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 48px;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.login-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.login-title {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}


/* Modals Enhancement */
/* Center modal relative to workspace (280px sidebar offset) */
.modal-backdrop {
    display: flex;
   justify-content: center;
    align-items: flex-start;
    padding-top: 70px; /* Start modal below header (header ~60-70px high) */
    padding-bottom: 20px;
    z-index: 1000 !important; /* Force modals above header */
    scroll-behavior: smooth; /* Smooth scroll when opening modal */
}

@media (min-width: 769px) {
    .modal-backdrop {
        padding-left: 280px; /* Offset for sidebar */
    }
}

.modern-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: calc(100vh - 60px); /* Leave space top/bottom */
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s ease-out forwards;
    margin: 0 auto;
}

.modern-modal.lg {
    max-width: 800px;
}

/* Modal header - fixed at top, doesn't scroll */
.modern-modal > h3 {
    padding: 24px 24px 16px;
    margin: 0;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

/* Modal body - scrollable content */
.modern-modal > .form-vertical {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Bottom Drawer Styles */
/* Full Screen Panel Below Header */
.drawer-backdrop {
    display: none !important;
}

.bottom-drawer {
    position: fixed;
    top: 70px; /* Header height approx */
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: auto !important;
    max-height: none !important; 
    max-width: none !important;
    background: #f8fafc;
    border-radius: 0;
    transform: none !important;
    display: flex;
    flex-direction: column;
    z-index: 900; /* Below header if header is 1000 */
    border-top: 1px solid #e2e8f0;
}

/* Override media query constraints */
@media (min-width: 1024px) {
    .bottom-drawer {
        left: 0;
        transform: none;
        width: 100%;
        max-width: none;
    }
}

.drawer-handle-bar {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 8px;
    flex-shrink: 0;
    cursor: grab;
}

.drawer-handle {
    width: 48px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 28px 20px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.drawer-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.drawer-subtitle {
    color: #64748b;
    font-size: 0.875rem;
    margin-top: 4px;
}

.drawer-close-btn {
    background: #f8fafc;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: #64748b;
    margin-left: 16px;
}

.drawer-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    overscroll-behavior: contain;
}

.drawer-footer {
    display: flex;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: #fff;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.option-row-drawer {
    display: grid;
    grid-template-columns: 24px 1fr 1fr 24px;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

/* Reusing existing btn styles */

.prize-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.15s;
}

.prize-checkbox-label:hover {
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.prize-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.prize-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #0f172a;
    display: block;
}

.prize-client {
    font-size: 0.6875rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-top: 2px;
}

.login-subtitle {
    color: #94a3b8;
    margin-top: 8px;
    font-size: 0.875rem;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-group label {
    display: block;
    color: #cbd5e1;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.2s;
}

.login-form input:focus {
    outline: none;
    background: rgba(15, 23, 42, 0.8);
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.input-group {
    position: relative;
}

.input-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
}

.input-toggle:hover {
    color: white;
}

#error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 12px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 0.875rem;
    text-align: center;
    display: none;
}

/* Tree View Polish */
.pq-tree {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

.pq-tree-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}



/* Responsive Design */
@media (max-width: 768px) {
    /* Layout */
    .backoffice-layout {
        display: block; /* Switch to block/flow for mobile */
    }

    .backoffice-container {
        margin-left: 0 !important;
        width: 100% !important;
        padding-right: 0 !important;
        max-width: 100% !important;
    }

    /* Sidebar - Mobile Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

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

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none; /* Hidden on desktop */
    }
    
    @media (max-width: 768px) {
        .sidebar-overlay {
            display: block;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(4px);
            z-index: 40;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s;
        }
    }

    .sidebar.open + .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    /* Header */
    .backoffice-header {
        padding: 16px;
        position: sticky;
        top: 0;
        z-index: 30;
    }

    .header-content {
        flex-direction: row; /* Keep row but allow wrapping if needed */
        align-items: center;
        gap: 12px;
    }

    .mobile-menu-btn {
        display: flex !important; /* Show on mobile */
    }

    /* Dashboard Grid */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Management Sections */
    .management-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .management-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

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

    /* Tables */
    .table-container {
        overflow-x: auto;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
    }

    table {
        min-width: 600px; /* Force scroll */
    }
}

/* Mobile Menu Button (Hidden on Desktop) */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: #64748b;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
}


.mobile-menu-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

/* --- New Dashboard V2 Styles --- */
.no-card-style {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.stats-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card-premium {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

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

.chart-container {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0,0,0,0.05);
}

.activity-log-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    padding: 24px;
    border: 1px solid rgba(0,0,0,0.05);
}
/* Version Badge */
.version-badge {
    display: inline-block;
    font-size: 0.6em;
    font-weight: 500;
    color: white;
    background: var(--primary-color, #4f46e5);
    padding: 2px 8px;
    border-radius: 12px;
    vertical-align: middle;
    margin-left: 10px;
    opacity: 0.9;
}

/* Version Timeline */
.version-timeline {
    position: relative;
    padding: 20px 0 20px 20px;
    border-left: 2px solid #e2e8f0;
    margin-left: 10px;
}

.version-item {
    position: relative;
    margin-bottom: 30px;
}

.version-item::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-color, #4f46e5);
    box-shadow: 0 0 0 4px white;
}

.version-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.version-number {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--primary-color, #4f46e5);
}

.version-date {
    font-size: 0.85em;
    color: #64748b;
}

.version-type {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #475569;
}

.version-changes {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.version-changes ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.version-changes li {
    position: relative;
    padding-left: 15px;
    margin-bottom: 6px;
    line-height: 1.5;
    color: #334155;
}

.version-changes li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-color, #f59e0b);
}

/* Modal Overflow Fixes */
.modern-modal,
.modal-content,
.modal-content.card-style {
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* Ensure padding doesn't break width */
    box-sizing: border-box;
}

/* Ensure modal body takes available space but allows scrolling */
.modal-body,
.form-vertical {
    overflow-y: auto;
    flex: 1;
}

/* Ensure header and footer stay visible if possible, or just scroll naturally */
.modal-header,
.modal-actions {
    flex-shrink: 0;
}

/* Scrollbar refinement for modals */
.modern-modal::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modern-modal::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 3px;
}

/* Game Mode Selector Styles */
.game-mode-option input[type="radio"]:checked + .mode-card {
    border-color: var(--primary-glow, #4ECDC4) !important;
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.08), rgba(107, 40, 217, 0.08)) !important;
    box-shadow: 0 4px 20px rgba(78, 205, 196, 0.3) !important;
    transform: translateY(-2px);
}

.game-mode-option input[type="radio"]:checked + .mode-card .mode-icon {
    filter: grayscale(0) !important;
    transform: scale(1.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-mode-option .mode-card:hover {
    border-color: #cbd5e0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
    transform: translateY(-1px);
}

.game-mode-option .mode-icon {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- New Premium UI Additions --- */

/* Premium Card (Glassmorphism + Gradient Border) */
.premium-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.premium-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--primary-gradient);
}

.premium-card h3 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* AI Studio Specifics */
.ai-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
    transition: all 0.3s ease;
}

.ai-status-pill.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.ai-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.ai-status-pill.active .ai-status-indicator {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Data Action Grid */
.data-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.data-action-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    height: 100%;
}

.data-action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.data-action-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 8px;
    background: #f1f5f9;
    color: #475569;
}

.data-action-card.primary .data-action-icon {
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
}

.data-action-card.danger .data-action-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.data-action-card h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
}

.data-action-card p {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Brands Grid Enhancements */
.brand-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    padding: 0;
}

.brand-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(0,0,0,0.1);
}

.brand-card-header {
    height: 120px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid #e2e8f0;
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
}

.brand-logo-preview {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.brand-status {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.brand-status.active { color: #10b981; }
.brand-status.inactive { color: #ef4444; }

.brand-card-body {
    padding: 16px;
}

.brand-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Backup Row enhancement */
.backup-row {
    transition: background-color 0.2s;
}
.backup-row:hover {
    background-color: #f8fafc;
}
.backup-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 8px;
    margin-right: 12px;
    font-size: 1.2rem;
}

.action-btn.small {
    padding: 6px;
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}
.action-btn.danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Premium Checkbox */
.premium-checkbox .checkbox-wrapper {
    position: relative;
    width: 20px;
    height: 20px;
}
.premium-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.premium-checkbox .checkbox-custom {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.2s;
}
.premium-checkbox:hover input ~ .checkbox-custom {
    border-color: #3b82f6;
}
.premium-checkbox input:checked ~ .checkbox-custom {
    background-color: #3b82f6;
    border-color: #3b82f6;
}
.premium-checkbox .checkbox-custom:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.premium-checkbox input:checked ~ .checkbox-custom:after {
    display: block;
}

/* Rotating icon */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.rotating {
    animation: rotate 2s linear infinite;
    display: inline-block;
}

/* AI Generator Visual Preview */
.gen-data-visual-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gen-item-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.gen-item-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.gen-item-icon {
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.gen-item-content {
    flex-grow: 1;
}

.gen-item-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    font-size: 0.95rem;
}

.gen-item-subtitle {
    font-size: 0.8rem;
    color: #64748b;
}

.gen-item-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.gen-item-badge.winner { background: #dcfce7; color: #166534; }
.gen-item-badge.loser { background: #fee2e2; color: #991b1b; }
.gen-item-badge.question { background: #e0e7ff; color: #3730a3; }

/* Prize Filter Chips */
.prize-filter-chips {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 4px 16px 4px;
    margin-bottom: 24px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    -webkit-overflow-scrolling: touch;
}

.prize-filter-chips::-webkit-scrollbar {
    height: 6px;
}

.prize-filter-chips::-webkit-scrollbar-track {
    background: transparent;
}

.prize-filter-chips::-webkit-scrollbar-thumb {
    background-color: #e2e8f0;
    border-radius: 10px;
}

.prize-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.prize-chip:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.prize-chip.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.prize-chip.active .chip-icon {
    background: rgba(255,255,255,0.2);
}

.prize-chip .chip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 1rem;
    transition: background 0.2s;
}

.prize-chip.general-chip {
    border-left: 4px solid #94a3b8;
}

.prize-chip.all-chip {
    border-left: 4px solid #3b82f6;
}

/* --- Branding Hub Premium Styles --- */
.branding-hub {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 1100px) {
    .branding-hub { grid-template-columns: 1fr; }
}

.branding-group {
    background: #ffffff;
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,0.03);
}

.branding-group h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.branding-group h3 i {
    color: var(--primary-color);
    font-size: 1.4rem;
}

/* Sidebar Preview */
.branding-sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.preview-card {
    background: #0f172a; /* Dark sleek preview */
    color: white;
    border-radius: 24px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.05);
}

.preview-card .logo-slot {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.03);
    border-radius: 16px;
    border: 1px dashed rgba(255,255,255,0.1);
}

.preview-card .title-slot {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.preview-card .slogan-slot {
    font-size: 0.9rem;
    opacity: 0.6;
    margin-bottom: 24px;
}

/* Color Hub */
.color-hub {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
}

.color-input-wrapper {
    background: #f8fafc;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    text-align: center;
    transition: all 0.2s;
}

.color-input-wrapper:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.color-input-wrapper label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.color-input-wrapper input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    cursor: pointer;
    background: none;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-input-wrapper input[type="color"]::-webkit-color-swatch { 
    border: 2px solid white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 12px;
}

/* Field Grid */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding: 8px;
}

.field-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f1f5f9;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    border: 1px solid #e2e8f0;
}

.field-pill:hover {
    background: #e2e8f0;
}

.field-pill input {
    margin: 0;
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

.field-pill span {
    font-size: 0.95rem;
    font-weight: 500;
    color: #334155;
}

/* Logo Actions */
.logo-actions {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    align-items: center;
}

.logo-file-input {
    flex: 1;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.logo-file-input:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.logo-file-input input { display: none; }
.logo-file-input span { font-size: 0.9rem; color: #64748b; font-weight: 500; }

.btn-delete-logo {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-logo:hover {
    background: #fee2e2;
}

/* --- Reimagined Management Dashboard Styles --- */
.kpi-grid { margin-top: 10px; }

.kpi-card-premium {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.kpi-card-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--card-accent, #6366f1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.kpi-card-premium:hover::before {
    opacity: 1;
}

.kpi-card-premium:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.kpi-card-premium::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg);
    transition: 0.8s;
    pointer-events: none;
    opacity: 0;
}

.kpi-card-premium:hover::after {
    left: 100%;
    top: 100%;
    opacity: 1;
}

.kpi-card-premium.danger {
    border-left: 5px solid #ef4444;
}

.kpi-icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.05);
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.kpi-value {
    margin: 5px 0;
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* Animated counter effect */
@keyframes countUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.kpi-value.animating {
    animation: countUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kpi-trend {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kpi-trend-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
}

.kpi-trend.positive { color: #15803d; }
.kpi-trend.positive .kpi-trend-icon { 
    background: #dcfce7; 
    color: #15803d;
    animation: trendPulse 2s ease-in-out infinite;
}

.kpi-trend.negative { color: #dc2626; }
.kpi-trend.negative .kpi-trend-icon { 
    background: #fee2e2; 
    color: #dc2626;
    animation: trendPulse 2s ease-in-out infinite;
}

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

/* Dashboard Panels */
.dashboard-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.92) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.dashboard-panel:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e293b;
}

.badge-premium {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-premium.info { background: #e0e7ff; color: #4338ca; }
.badge-premium.success { background: #dcfce7; color: #15803d; }

/* Event Stream */
.event-stream-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.event-item {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: #334155;
    animation: slideInLeft 0.3s ease-out;
}

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

.event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.event-time {
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 50px;
}

.event-desc {
    flex: 1;
}

.live-pulse {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

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

/* Scrollbar for dashboard panels */
.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }
