/**
 * Main stylesheet for BowlingScoring v2
 * Base styles and common components
 */

:root {
    /* Professional warm color palette for center identification */
    /* Analogous warm color scheme with earth tones - WCAG AA compliant */
    --center-color-1: #D2691E;  /* Warm Terracotta - Professional orange-brown */
    --center-color-2: #FA8072;  /* Salmon Coral - Warm coral, non-aggressive */
    --center-color-3: #DAA520;  /* Golden Amber - Warm yellow-orange */
    --center-color-4: #FFBE98;  /* Peach Fuzz - 2024 trending warm neutral */
    --center-color-5: #A0522D;  /* Burnt Sienna - Deep warm brown */
    --center-color-6: #FF8C69;  /* Soft Coral - Warm pink-orange */
    --center-color-7: #D2B48C;  /* Warm Tan - Neutral warm beige */
    --center-color-8: #CD853F;  /* Russet Orange - Warm brown-orange */
    
    /* RGB values for transparency effects */
    --center-color-1-rgb: 210, 105, 30;   /* Warm Terracotta RGB */
    --center-color-2-rgb: 250, 128, 114;  /* Salmon Coral RGB */
    --center-color-3-rgb: 218, 165, 32;   /* Golden Amber RGB */
    --center-color-4-rgb: 255, 190, 152;  /* Peach Fuzz RGB */
    --center-color-5-rgb: 160, 82, 45;    /* Burnt Sienna RGB */
    --center-color-6-rgb: 255, 140, 105;  /* Soft Coral RGB */
    --center-color-7-rgb: 210, 180, 140;  /* Warm Tan RGB */
    --center-color-8-rgb: 205, 133, 63;   /* Russet Orange RGB */
    
    /* Theme colors */
    --bg-primary: #111;
    --bg-secondary: #1a1a1a;
    --text-primary: #fff;
    --text-secondary: #ccc;
    --border-color: #333;
    
    /* Additional theme colors for enhanced UI */
    --background-color: #0a0a0a;
    --panel-background: #1a1a1a;
    --card-background: #222;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --primary-background: rgba(0, 123, 255, 0.1);
    --primary-rgb: 0, 123, 255;
    --success-color: #28a745;
    --success-background: rgba(40, 167, 69, 0.1);
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --info-background: rgba(23, 162, 184, 0.1);
    
    /* Additional spacing */
    --gap-xs: calc(0.23 * var(--scale-base));   /* 0.25rem = ~2.5px = 0.23vh on FHD */
    
    /* Responsive scaling system - maintains FHD proportions across all resolutions */
    --scale-base: var(--vh, 1vh);  /* Zoom-adjusted base unit (prevents double-scaling on 4K) */
    
    /* Text Scaling - Uses clamp() for readability across all screen sizes */
    --text-scale-sm: clamp(0.75rem, 1.5vw, 0.875rem);   /* 12px - 14px */
    --text-scale-md: clamp(0.875rem, 2vw, 1.125rem);    /* 14px - 18px */
    --text-scale-lg: clamp(1rem, 2.5vw, 1.25rem);       /* 16px - 20px */
    --text-scale-xl: clamp(1.125rem, 3vw, 1.5rem);      /* 18px - 24px */
    
    /* Spacing (converted from rem to responsive) */
    --gap-sm: calc(0.46 * var(--scale-base));   /* 0.5rem = ~5px = 0.46vh on FHD */
    --gap-md: calc(0.93 * var(--scale-base));   /* 1rem = ~10px = 0.93vh on FHD */
    --gap-lg: calc(1.39 * var(--scale-base));   /* 1.5rem = ~15px = 1.39vh on FHD */
    
    /* UI Element Sizing */
    --border-width: calc(0.19 * var(--scale-base));    /* 2px = 0.19vh on FHD */
    --border-radius: calc(0.74 * var(--scale-base));   /* 8px = 0.74vh on FHD */
    --scrollbar-width: calc(0.56 * var(--scale-base)); /* 6px = 0.56vh on FHD */
    
    /* Z-index scale - standardized layering system */
    --z-base: 1;              /* Basic layering */
    --z-overlay: 10;          /* Floating elements */
    --z-modal-backdrop: 100;  /* Modal backgrounds */
    --z-modal: 110;           /* Modal content */
    --z-tooltip: 200;         /* Tooltips, popovers */
    --z-critical: 1000;       /* Critical overlays like loading */
    
    /* Common overlay/transparency colors */
    --overlay-dark: rgba(0, 0, 0, 0.8);
    --overlay-medium: rgba(0, 0, 0, 0.7);
    --overlay-light: rgba(0, 0, 0, 0.3);
    --border-light: rgba(255, 255, 255, 0.2);
    --border-subtle: rgba(255, 255, 255, 0.1);
    
    /* Panel and Modal Sizing */
    --panel-width: min(29.6vw, 320px);                 /* 320px = 16.7vw on FHD, cap at 320px */
    --panel-spacing: calc(1.85 * var(--scale-base));   /* 20px = 1.85vh on FHD */
    --modal-max-height: min(37 * var(--vh, 1vh), 400px);
    
    /* Z-index layers */
    --z-content: 1;
    --z-controls: 100;
    --z-panel: 200;
    --z-modal: 300;
}

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* Main app container */
#app-container,
.v2-app {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Main display area */
#main-display,
.main-display {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Center color classes with RGB values for transparency effects */
.center-color-0 { --center-color: var(--center-color-1); --center-color-rgb: var(--center-color-1-rgb); }
.center-color-1 { --center-color: var(--center-color-2); --center-color-rgb: var(--center-color-2-rgb); }
.center-color-2 { --center-color: var(--center-color-3); --center-color-rgb: var(--center-color-3-rgb); }
.center-color-3 { --center-color: var(--center-color-4); --center-color-rgb: var(--center-color-4-rgb); }
.center-color-4 { --center-color: var(--center-color-5); --center-color-rgb: var(--center-color-5-rgb); }
.center-color-5 { --center-color: var(--center-color-6); --center-color-rgb: var(--center-color-6-rgb); }
.center-color-6 { --center-color: var(--center-color-7); --center-color-rgb: var(--center-color-7-rgb); }
.center-color-7 { --center-color: var(--center-color-8); --center-color-rgb: var(--center-color-8-rgb); }
.center-color-custom { /* Custom colors use inline styles set by JavaScript */ }

/* Floating streams panel */
.floating-streams-panel {
    position: fixed;
    right: var(--panel-spacing);
    top: calc(7.41 * var(--scale-base));  /* 80px = 7.41vh on FHD */
    width: var(--panel-width);
    max-height: calc(var(--viewport-height, 100vh) - 9.26 * var(--vh, 1vh));
    background: rgba(255, 255, 255, 0.95);
    /*backdrop-filter: blur(10px);*/
    border-radius: var(--border-radius);
    box-shadow: 0 calc(0.37 * var(--scale-base)) calc(1.85 * var(--scale-base)) rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    z-index: var(--z-panel);
    display: flex;
    flex-direction: column;
    color: #333;
}

.floating-streams-panel.hidden {
    transform: translateX(calc(100% + calc(3.7 * var(--scale-base))));  /* 40px = 3.7vh on FHD */
}

/* Force hide floating-streams-panel in grid layouts */
.layout-grid .floating-streams-panel {
    display: none !important;
}

.floating-streams-panel .panel-header {
    padding: var(--gap-md);
    border-bottom: calc(0.09 * var(--scale-base)) solid rgba(0, 0, 0, 0.1);  /* 1px = 0.09vh on FHD */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.floating-streams-panel .panel-header h5 {
    margin: 0;
    font-size: var(--text-scale-lg);  /* 16px - 20px responsive */
    font-weight: 600;
}

.floating-streams-panel .panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--gap-md);
}

.floating-streams-panel .panel-footer {
    padding: calc(0.69 * var(--scale-base)) var(--gap-md);  /* 0.75rem ≈ 7.5px = 0.69vh on FHD */
    border-top: calc(0.09 * var(--scale-base)) solid rgba(0, 0, 0, 0.1);
    text-align: center;
    font-size: var(--text-scale-sm);  /* 12px - 14px responsive */
}

/* Enhanced Center Selector Modal */
.modal-content {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    box-shadow: 0 calc(0.93 * var(--scale-base)) calc(2.78 * var(--scale-base)) rgba(0, 0, 0, 0.5);  /* 0 10px 30px */
}

.modal-header {
    border-bottom: calc(0.09 * var(--scale-base)) solid var(--border-color);  /* 1px */
    padding: calc(1.39 * var(--scale-base)) calc(1.85 * var(--scale-base));  /* 1.5rem 2rem */
}

.modal-footer {
    border-top: calc(0.09 * var(--scale-base)) solid var(--border-color);  /* 1px */
    padding: calc(1.39 * var(--scale-base)) calc(1.85 * var(--scale-base));  /* 1.5rem 2rem */
}

.modal-title-section .modal-title {
    font-size: var(--text-scale-xl);  /* 18px - 24px responsive */
    font-weight: 600;
    margin-bottom: calc(0.46 * var(--scale-base));  /* 5px */
}

.modal-subtitle {
    font-size: var(--text-scale-sm);  /* 12px - 14px responsive */
    color: var(--text-secondary);
}

/* Center Selector Actions */
.center-selector-actions {
    display: flex;
    align-items: center;
    gap: calc(0.46 * var(--scale-base));  /* 5px */
    padding: calc(0.93 * var(--scale-base));  /* 10px */
    background: rgba(255, 255, 255, 0.02);
    border-radius: calc(0.74 * var(--scale-base));  /* 8px */
    border: calc(0.09 * var(--scale-base)) solid var(--border-color);  /* 1px */
}

.selected-count-info {
    display: flex;
    align-items: center;
    font-size: var(--text-scale-sm);  /* 12px - 14px responsive */
}

/* Enhanced Center Selector Actions */
.center-selector-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: calc(0.46 * var(--scale-base)); /* 5px */
}

.action-buttons-left,
.action-buttons-right {
    display: flex;
    align-items: center;
    gap: calc(0.46 * var(--scale-base)); /* 5px */
}

.action-buttons-left .vr {
    height: calc(1.39 * var(--scale-base)); /* 15px */
}

/* Enhanced Center List - Single Column Design */
.center-list-enhanced {
    max-height: calc(50 * var(--scale-base));  /* 540px = 50vh on FHD */
    overflow-y: auto;
    padding: calc(0.93 * var(--scale-base));  /* 10px */
    display: flex;
    flex-direction: column;
    gap: calc(0.74 * var(--scale-base));  /* 8px */
    /* Remove grid - always single column */
}


/* Center Card Design - Taller, Professional Layout */
.center-card {
    display: flex;
    align-items: stretch;
    padding: calc(1.85 * var(--scale-base));  /* 20px - increased padding */
    background: var(--bg-primary);
    border: calc(0.19 * var(--scale-base)) solid var(--border-color);  /* 2px */
    border-radius: calc(0.93 * var(--scale-base));  /* 10px - slightly more rounded */
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: calc(6.48 * var(--scale-base)); /* 70px - taller cards */
    width: 100%; /* Full width for single column */
}

.center-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: calc(0.37 * var(--scale-base));  /* 4px */
    height: 100%;
    background: var(--center-color, #666);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.center-card:hover {
    transform: translateY(calc(-0.19 * var(--scale-base)));  /* -2px */
    box-shadow: 0 calc(0.74 * var(--scale-base)) calc(1.85 * var(--scale-base)) rgba(0, 0, 0, 0.15);  /* 0 8px 20px */
    border-color: var(--center-color, #666);
}

.center-card:hover::before {
    width: calc(0.74 * var(--scale-base));  /* 8px */
}

.center-card.selected {
    background: rgba(var(--center-color-rgb, 102, 102, 102), 0.1);
    border-color: var(--center-color, #666);
    box-shadow: 0 0 0 calc(0.19 * var(--scale-base)) rgba(var(--center-color-rgb, 102, 102, 102), 0.2);  /* 0 0 0 2px */
}

.center-card.selected::before {
    width: calc(0.74 * var(--scale-base));  /* 8px */
}

/* Removed drag handle - now using full card dragging */

/* Center Card Content */
.center-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(4.63 * var(--scale-base)); /* 50px - ensure content height */
}

.center-card-title {
    font-size: var(--text-scale-lg);  /* 16px - 20px responsive */
    font-weight: 600;
    margin-bottom: calc(0.23 * var(--scale-base));  /* 2.5px */
    display: flex;
    align-items: center;
    gap: calc(0.46 * var(--scale-base));  /* 5px */
}

.center-card-details {
    display: flex;
    align-items: center;
    gap: calc(0.93 * var(--scale-base));  /* 10px */
    font-size: var(--text-scale-sm);  /* 12px - 14px responsive */
    color: var(--text-secondary);
}

.center-card-lanes {
    display: flex;
    align-items: center;
    gap: calc(0.23 * var(--scale-base));  /* 2.5px */
}

.center-card-streams {
    display: flex;
    align-items: center;
    gap: calc(0.23 * var(--scale-base));  /* 2.5px */
    color: var(--success-color, #28a745);
}

/* Center Card Selection Indicator - Now Standalone and Prominent */
.center-card-selector {
    width: calc(3.24 * var(--scale-base)); /* 35px - same size as color button */
    height: calc(3.24 * var(--scale-base)); /* 35px */
    border: calc(0.28 * var(--scale-base)) solid var(--border-color); /* 3px */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-secondary);
    cursor: pointer;
    box-shadow: 0 calc(0.19 * var(--scale-base)) calc(0.56 * var(--scale-base)) rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.center-card-selector:hover {
    transform: scale(1.1);
    border-color: var(--center-color, var(--primary-color));
    box-shadow: 0 calc(0.37 * var(--scale-base)) calc(0.93 * var(--scale-base)) rgba(0, 0, 0, 0.25);
}

.center-card.selected .center-card-selector {
    background: var(--center-color, var(--primary-color));
    border-color: var(--center-color, var(--primary-color));
    color: #fff;
    transform: scale(1.05);
}

.center-card.selected .center-card-selector:hover {
    transform: scale(1.15);
}

.center-card-selector i {
    font-size: calc(1.39 * var(--scale-base)); /* 15px - much bigger icon */
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: bold;
}

.center-card.selected .center-card-selector i {
    opacity: 1;
    transform: scale(1);
}

/* Center Card Controls - Much More Prominent */
.center-card-controls {
    display: flex;
    align-items: center;
    gap: calc(0.93 * var(--scale-base)); /* 10px */
    margin-left: calc(0.93 * var(--scale-base)); /* 10px */
}

/* Color Picker - Much More Prominent and Obvious */
.center-card-color-btn {
    width: calc(3.24 * var(--scale-base)); /* 35px - much bigger */
    height: calc(3.24 * var(--scale-base)); /* 35px */
    border: calc(0.28 * var(--scale-base)) solid #fff; /* 3px white border */
    border-radius: 50%; /* Full circle */
    background: var(--center-color, #666);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 calc(0.19 * var(--scale-base)) calc(0.56 * var(--scale-base)) rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.center-card-color-btn:hover {
    transform: scale(1.15);
    border-color: var(--center-color, #666);
    box-shadow: 0 calc(0.37 * var(--scale-base)) calc(0.93 * var(--scale-base)) rgba(0, 0, 0, 0.25);
}

.center-card-color-btn::after {
    content: '🎨';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: calc(1.2 * var(--scale-base)); /* 13px - much bigger emoji */
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.center-card-color-btn:hover::after {
    opacity: 0.8;
}

/* Order Controls - Much Bigger and More Intuitive */
.center-card-order-controls {
    display: flex;
    flex-direction: column;
    gap: calc(0.28 * var(--scale-base)); /* 3px */
}

.center-card-order-btn {
    width: calc(2.78 * var(--scale-base)); /* 30px - much bigger */
    height: calc(2.31 * var(--scale-base)); /* 25px */
    border: calc(0.09 * var(--scale-base)) solid var(--border-color); /* 1px */
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(0.37 * var(--scale-base)); /* 4px */
    transition: all 0.2s ease;
    box-shadow: 0 calc(0.09 * var(--scale-base)) calc(0.28 * var(--scale-base)) rgba(0, 0, 0, 0.1);
}

.center-card-order-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(calc(-0.09 * var(--scale-base))); /* 1px lift */
    box-shadow: 0 calc(0.19 * var(--scale-base)) calc(0.46 * var(--scale-base)) rgba(0, 0, 0, 0.15);
}

.center-card-order-btn:active {
    transform: translateY(0);
    box-shadow: 0 calc(0.09 * var(--scale-base)) calc(0.28 * var(--scale-base)) rgba(0, 0, 0, 0.1);
}

.center-card-order-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.center-card-order-btn:disabled:hover {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border-color);
    transform: none;
}

.center-card-order-btn i {
    font-size: calc(0.93 * var(--scale-base)); /* 10px - much bigger icons */
    font-weight: bold;
}


/* Drag and Drop States */
.center-card.dragging {
    opacity: 0.7;
    transform: rotate(2deg) scale(1.02);
    box-shadow: 0 calc(1.11 * var(--scale-base)) calc(2.22 * var(--scale-base)) rgba(0, 0, 0, 0.25);
    z-index: 1000;
}

.center-card.drag-over {
    transform: translateY(calc(-0.37 * var(--scale-base))); /* -4px */
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.05);
}

.center-list-enhanced.sortable {
    cursor: default;
}

.center-list-enhanced.sortable .center-card {
    transition: transform 0.2s ease;
}

/* Enhanced Color Picker Modal */
.color-section {
    border-radius: calc(0.46 * var(--scale-base)); /* 5px */
}

.color-section-title {
    font-size: var(--text-scale-sm); /* 12px - 14px responsive */
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: calc(0.56 * var(--scale-base)); /* 6px */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, calc(3.24 * var(--scale-base))); /* 4 columns of 35px each */
    gap: calc(0.56 * var(--scale-base)); /* 6px */
    justify-content: center; /* Center the grid horizontally */
    margin: 0 auto; /* Additional centering */
    width: fit-content; /* Only take space needed */
}

.color-option {
    width: calc(3.24 * var(--scale-base)); /* 35px */
    height: calc(3.24 * var(--scale-base)); /* 35px */
    border: calc(0.28 * var(--scale-base)) solid #fff; /* 3px white border */
    border-radius: 50%; /* Full circle for better look */
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 calc(0.19 * var(--scale-base)) calc(0.46 * var(--scale-base)) rgba(0, 0, 0, 0.15);
}

.color-option:hover {
    transform: scale(1.15);
    border-color: var(--primary-color);
    box-shadow: 0 calc(0.37 * var(--scale-base)) calc(0.93 * var(--scale-base)) rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.color-option:active {
    transform: scale(0.95);
}

.color-option.predefined {
    border-color: #fff;
}

.color-option.custom {
    border-color: var(--border-color);
}

/* Custom Color Creator */
.custom-color-creator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(0.93 * var(--scale-base)); /* 10px */
}

.color-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(0.46 * var(--scale-base)); /* 5px */
}

.custom-color-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(0.56 * var(--scale-base)); /* 6px */
}

.color-preview-circle {
    width: calc(4.63 * var(--scale-base)); /* 50px */
    height: calc(4.63 * var(--scale-base)); /* 50px */
    border-radius: 50%;
    border: calc(0.28 * var(--scale-base)) solid #fff; /* 3px white border */
    box-shadow: 0 calc(0.19 * var(--scale-base)) calc(0.37 * var(--scale-base)) rgba(0, 0, 0, 0.3);
}

.custom-color-input {
    width: calc(5.56 * var(--scale-base)); /* 60px */
    height: calc(5.56 * var(--scale-base)); /* 60px */
    border-radius: calc(0.74 * var(--scale-base)); /* 8px */
    border: calc(0.19 * var(--scale-base)) solid var(--border-color); /* 2px */
    cursor: pointer;
    background: none;
    padding: 0;
}

.custom-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: calc(0.56 * var(--scale-base)); /* 6px */
}

.custom-color-input::-webkit-color-swatch {
    border: none;
    border-radius: calc(0.56 * var(--scale-base)); /* 6px */
}

.custom-color-input::-moz-color-swatch {
    border: none;
    border-radius: calc(0.56 * var(--scale-base)); /* 6px */
}

.color-input-label {
    font-size: var(--text-scale-sm);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
}

/* Color Remove Button */
.color-remove-btn {
    position: absolute;
    top: calc(-0.28 * var(--scale-base)); /* -3px */
    right: calc(-0.28 * var(--scale-base)); /* -3px */
    width: calc(1.67 * var(--scale-base)); /* 18px */
    height: calc(1.67 * var(--scale-base)); /* 18px */
    border: none;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(0.69 * var(--scale-base)); /* 7.5px */
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 20;
}

.color-option.custom:hover .color-remove-btn {
    opacity: 1;
}

.color-remove-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Loading State */
.center-loading {
    text-align: center;
    padding: calc(2.78 * var(--scale-base));  /* 30px */
    color: var(--text-secondary);
    font-size: var(--text-scale-sm);  /* 12px - 14px responsive */
}

/* Responsive Design */
@media (max-width: 768px) {
    .center-list-enhanced {
        grid-template-columns: 1fr;
        max-height: calc(37.04 * var(--scale-base));  /* 400px = 37.04vh on FHD */
    }
    
    .center-card {
        padding: calc(0.93 * var(--scale-base));  /* 10px */
    }
    
    .modal-header,
    .modal-footer {
        padding: calc(0.93 * var(--scale-base)) calc(1.39 * var(--scale-base));  /* 1rem 1.5rem */
    }
}

/* Zero-CLS Loading Overlay */
.loading-overlay {
    /* Fixed positioning - out of document flow */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* Visual styling - balanced opacity for loading visibility */
    background-color: rgba(0, 0, 0, 0.85); /* 85% opacity - good balance */
    z-index: 10000;
    
    /* Initial hidden state */
    opacity: 0;
    visibility: hidden;
    
    /* Subtle scale for smoother transition */
    transform: scale(0.98);
    
    /* Smooth transitions for all properties */
    transition: 
        opacity 0.3s ease,
        visibility 0.3s,
        transform 0.3s ease;
    
    /* Disable interactions when hidden */
    pointer-events: none;
    
    /* Flexbox for centering content */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Active/visible state */
.loading-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    pointer-events: auto;
}

/* Loading content container */
.loading-content {
    text-align: center;
    transform: translateZ(0); /* Force GPU layer */
    /* No background - fully transparent to see through to page content */
    padding: calc(3.7 * var(--scale-base)); /* 40px */
}

/* Lottie Animation Container */
.lottie-container,
#lottie-container {
    width: calc(27.78 * var(--scale-base)); /* 300px on FHD */
    height: calc(27.78 * var(--scale-base)); /* 300px on FHD */
    margin: 0 auto;
    position: relative;
    transform: translateZ(0); /* Force GPU layer */
}

/* Ensure Lottie SVG fills container */
.lottie-container svg,
#lottie-container svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* Loading text */
.loading-text {
    color: #fff;
    margin-top: calc(1.85 * var(--scale-base)); /* 20px */
    font-size: var(--text-scale-lg);
    opacity: 0.9;
    font-weight: 300;
    text-align: center;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .loading-overlay {
        transition-duration: 0.01ms;
    }
    
    .lottie-container {
        /* Will show static frame for reduced motion */
    }
}

/* Connection status */
.connection-status {
    background: rgba(0, 0, 0, 0.8);
    /*backdrop-filter: blur(10px);*/
}

/* Stream content organization */
.streams-content {
    display: flex;
    flex-direction: column;
    gap: var(--gap-lg);
}

.stream-center-group {
    border-left: calc(0.28 * var(--scale-base)) solid var(--center-color);  /* 3px = 0.28vh on FHD */
    padding-left: var(--gap-md);
}

.stream-center-group h6 {
    font-size: var(--text-scale-md);  /* 14px - 18px responsive */
    font-weight: 600;
    margin-bottom: var(--gap-sm);
    color: var(--center-color);
}

.stream-list {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}

.stream-item {
    padding: var(--gap-sm);
    background: rgba(0, 0, 0, 0.05);
    border-radius: calc(0.37 * var(--scale-base));  /* 4px = 0.37vh on FHD */
    font-size: var(--text-scale-sm);      /* 12px - 14px responsive */
    cursor: move;
    transition: background-color 0.2s;
}

.stream-item:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Responsive utilities */
@media (max-width: 768px) {
    .floating-streams-panel {
        width: min(26vw, 280px);  /* 280px with viewport scaling */
        right: calc(0.93 * var(--scale-base));   /* 10px = 0.93vh on FHD */
        top: calc(6.48 * var(--scale-base));     /* 70px = 6.48vh on FHD */
    }
    
    .floating-controls {
        top: calc(0.93 * var(--scale-base));     /* 10px = 0.93vh on FHD */
        left: calc(0.93 * var(--scale-base));    /* 10px = 0.93vh on FHD */
    }
    
    .floating-controls .btn {
        padding: calc(0.35 * var(--scale-base)) calc(0.69 * var(--scale-base));  /* 0.375rem 0.75rem */
        font-size: var(--text-scale-sm);  /* 12px - 14px responsive */
    }
}

/* Dark mode form controls */
.form-check-input {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.form-check-label {
    color: var(--text-primary);
}

/* Scrollbar styling */
.panel-body::-webkit-scrollbar,
.center-list::-webkit-scrollbar {
    width: var(--scrollbar-width);
}

.panel-body::-webkit-scrollbar-track,
.center-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.panel-body::-webkit-scrollbar-thumb,
.center-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: calc(0.28 * var(--scale-base));  /* 3px = 0.28vh on FHD */
}

.panel-body::-webkit-scrollbar-thumb:hover,
.center-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Animation classes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(calc(1.85 * var(--scale-base))); opacity: 0; }  /* 20px = 1.85vh on FHD */
    to { transform: translateY(0); opacity: 1; }
}

/* Consolidated animation keyframes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pinPulse {
    0%, 100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Bootstrap modal zoom fix — override 100vh that breaks under CSS zoom */
.modal-dialog {
    max-height: calc(var(--viewport-height, 100vh) - 3.5rem);
}
.modal-dialog-centered {
    min-height: calc(var(--viewport-height, 100vh) - 3.5rem);
}
.modal-body {
    max-height: calc(var(--viewport-height, 100vh) - 12rem);
    overflow-y: auto;
}

/* Layout Selector Modal */
.layout-selector-content {
    padding: var(--gap-sm);
}

.layout-group {
    border-top: calc(0.09 * var(--scale-base)) solid var(--border-color);  /* 1px = 0.09vh on FHD */
    padding-top: var(--gap-md);
}

.layout-group:first-child {
    border-top: none;
    padding-top: 0;
}

.layout-option {
    background: var(--card-background);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--gap-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    height: 100%;
}

.layout-option:hover {
    border-color: var(--primary-color);
    transform: translateY(calc(-0.19 * var(--scale-base)));  /* -2px = -0.19vh on FHD */
    box-shadow: 0 calc(0.37 * var(--scale-base)) calc(1.11 * var(--scale-base)) rgba(var(--primary-color-rgb), 0.2);  /* 0 4px 12px */
}

.layout-option.active {
    border-color: var(--primary-color);
    background: var(--primary-background);
}

.layout-preview {
    height: calc(7.41 * var(--scale-base));  /* 80px = 7.41vh on FHD */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--gap-sm);
}

.layout-preview i {
    color: var(--text-secondary);
}

.layout-option h6 {
    margin: var(--gap-sm) 0 calc(0.23 * var(--scale-base));  /* 0.5rem 0 0.25rem */
    color: var(--text-primary);
}

.layout-option small {
    color: var(--text-secondary);
    font-size: var(--text-scale-sm);  /* 12px - 14px responsive */
}

/* Grid preview styles - scoped to layout selector modal only */
.grid-preview {
    padding: calc(0.93 * var(--scale-base));  /* 10px = 0.93vh on FHD */
}

.grid-preview > div {
    width: calc(5.56 * var(--scale-base));   /* 60px = 5.56vh on FHD */
    height: calc(5.56 * var(--scale-base));
    position: relative;
    margin: 0 auto;
}

.grid-preview .grid-1x1::before {
    content: '';
    position: absolute;
    inset: 0;
    border: var(--border-width) solid var(--text-secondary);
    border-radius: calc(0.37 * var(--scale-base));  /* 4px = 0.37vh on FHD */
}

.grid-preview .grid-2x1::before,
.grid-preview .grid-2x1::after {
    content: '';
    position: absolute;
    width: calc(50% - var(--border-width));
    height: 100%;
    border: var(--border-width) solid var(--text-secondary);
    border-radius: calc(0.37 * var(--scale-base));  /* 4px = 0.37vh on FHD */
}

.grid-preview .grid-2x1::before {
    left: 0;
}

.grid-preview .grid-2x1::after {
    right: 0;
}

.grid-preview .grid-2x2::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--text-secondary) var(--border-width), transparent var(--border-width)),
        linear-gradient(90deg, var(--text-secondary) var(--border-width), transparent var(--border-width));
    background-size: 50% 50%;
    background-position: center;
    border: var(--border-width) solid var(--text-secondary);
    border-radius: calc(0.37 * var(--scale-base));  /* 4px = 0.37vh on FHD */
}

.grid-preview .grid-3x2::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--text-secondary) var(--border-width), transparent var(--border-width)),
        linear-gradient(90deg, var(--text-secondary) var(--border-width), transparent var(--border-width));
    background-size: 33.33% 50%;
    background-position: center;
    border: var(--border-width) solid var(--text-secondary);
    border-radius: calc(0.37 * var(--scale-base));  /* 4px = 0.37vh on FHD */
}

.grid-preview .grid-3x3::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--text-secondary) var(--border-width), transparent var(--border-width)),
        linear-gradient(90deg, var(--text-secondary) var(--border-width), transparent var(--border-width));
    background-size: 33.33% 33.33%;
    background-position: center;
    border: var(--border-width) solid var(--text-secondary);
    border-radius: calc(0.37 * var(--scale-base));  /* 4px = 0.37vh on FHD */
}

.grid-preview .grid-4x4::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--text-secondary) var(--border-width), transparent var(--border-width)),
        linear-gradient(90deg, var(--text-secondary) var(--border-width), transparent var(--border-width));
    background-size: 25% 25%;
    background-position: center;
    border: var(--border-width) solid var(--text-secondary);
    border-radius: calc(0.37 * var(--scale-base));  /* 4px = 0.37vh on FHD */
}

.grid-preview .grid-5x5::before {
    content: '5×5';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    background-image: 
        linear-gradient(to right, rgba(var(--bs-secondary-rgb), 0.2) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(var(--bs-secondary-rgb), 0.2) 1px, transparent 1px);
    background-size: 20% 20%;
    background-position: center;
    border: var(--border-width) solid var(--text-secondary);
    border-radius: calc(0.37 * var(--scale-base));  /* 4px = 0.37vh on FHD */
}

.grid-preview .grid-6x4::before {
    content: '6×4';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    background-image: 
        linear-gradient(to right, rgba(var(--bs-secondary-rgb), 0.2) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(var(--bs-secondary-rgb), 0.2) 1px, transparent 1px);
    background-size: 16.67% 25%;
    background-position: center;
    border: var(--border-width) solid var(--text-secondary);
    border-radius: calc(0.37 * var(--scale-base));  /* 4px = 0.37vh on FHD */
}

/* ========================================
   Enhanced Color Picker Styles
   ======================================== */

/* Enhanced unified color grid */
.color-picker-grid-enhanced {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: calc(0.93 * var(--scale-base)); /* 10px */
    padding: calc(0.93 * var(--scale-base)); /* 10px */
    background: rgba(var(--bs-gray-100-rgb), 0.5);
    border-radius: calc(0.74 * var(--scale-base)); /* 8px */
    border: 1px solid var(--bs-border-color);
}

/* Enhanced color option with better styling */
.color-option-enhanced {
    position: relative;
    width: calc(3.24 * var(--scale-base)); /* 35px */
    height: calc(3.24 * var(--scale-base)); /* 35px */
    border-radius: calc(0.74 * var(--scale-base)); /* 8px */
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.color-option-enhanced:hover {
    transform: scale(1.1);
    border-color: var(--bs-primary);
    box-shadow: 0 calc(0.37 * var(--scale-base)) calc(0.93 * var(--scale-base)) rgba(0, 0, 0, 0.15); /* 0 4px 10px */
    z-index: 10;
}

.color-option-enhanced:active {
    transform: scale(0.95);
}

/* Add custom color button styling */
.color-option-enhanced.add-color-btn {
    background: linear-gradient(135deg, var(--bs-light) 0%, var(--bs-gray-200) 100%);
    border: 2px dashed var(--bs-gray-400);
    color: var(--bs-gray-600);
    font-size: calc(1.39 * var(--scale-base)); /* 15px */
}

.color-option-enhanced.add-color-btn:hover {
    background: linear-gradient(135deg, var(--bs-primary-bg-subtle) 0%, var(--bs-primary) 20%);
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

/* Custom color indicator */
.custom-indicator {
    position: absolute;
    top: calc(0.19 * var(--scale-base)); /* 2px */
    right: calc(0.19 * var(--scale-base)); /* 2px */
    width: calc(0.93 * var(--scale-base)); /* 10px */
    height: calc(0.93 * var(--scale-base)); /* 10px */
    color: rgba(255, 255, 255, 0.9);
    font-size: calc(0.65 * var(--scale-base)); /* 7px */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Enhanced remove button */
.color-remove-btn-enhanced {
    position: absolute;
    top: calc(-0.37 * var(--scale-base)); /* -4px */
    right: calc(-0.37 * var(--scale-base)); /* -4px */
    width: calc(1.39 * var(--scale-base)); /* 15px */
    height: calc(1.39 * var(--scale-base)); /* 15px */
    background: var(--bs-danger);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: calc(0.65 * var(--scale-base)); /* 7px */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 3;
    cursor: pointer;
}

.color-option-enhanced:hover .color-remove-btn-enhanced {
    opacity: 1;
    transform: scale(1);
}

.color-remove-btn-enhanced:hover {
    background: var(--bs-danger);
    transform: scale(1.2);
}

/* Enhanced custom color creator */
.custom-color-creator-enhanced {
    display: flex;
    flex-direction: column;
    gap: calc(1.11 * var(--scale-base)); /* 12px */
    padding: calc(1.39 * var(--scale-base)); /* 15px */
    background: var(--bs-light);
    border-radius: calc(0.74 * var(--scale-base)); /* 8px */
    border: 1px solid var(--bs-border-color);
}

/* Color input group with hex input */
.color-input-group {
    display: flex;
    gap: calc(0.93 * var(--scale-base)); /* 10px */
    align-items: center;
}

.custom-color-input-enhanced {
    width: calc(4.63 * var(--scale-base)); /* 50px */
    height: calc(3.24 * var(--scale-base)); /* 35px */
    border: 2px solid var(--bs-border-color);
    border-radius: calc(0.56 * var(--scale-base)); /* 6px */
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-color-input-enhanced:hover {
    border-color: var(--bs-primary);
}

.color-input-group .form-control {
    font-family: 'Courier New', monospace;
    font-size: calc(1.11 * var(--scale-base)); /* 12px */
    text-transform: uppercase;
}

/* Action buttons */
.color-actions {
    display: flex;
    gap: calc(0.74 * var(--scale-base)); /* 8px */
    justify-content: flex-end;
}

.color-actions .btn-sm {
    padding: calc(0.37 * var(--scale-base)) calc(0.93 * var(--scale-base)); /* 4px 10px */
    font-size: calc(1.02 * var(--scale-base)); /* 11px */
    border-radius: calc(0.46 * var(--scale-base)); /* 5px */
}

/* Enhanced modal sizing - scoped to center selector modal only */
#center-selector-modal .modal-dialog {
    max-width: calc(44.44 * var(--scale-base)); /* 480px */
}

/* Responsive design for color picker */
@media (max-width: 768px) {
    .color-picker-grid-enhanced {
        grid-template-columns: repeat(4, 1fr);
        gap: calc(0.74 * var(--scale-base)); /* 8px */
        padding: calc(0.74 * var(--scale-base)); /* 8px */
    }
    
    .color-option-enhanced {
        width: calc(2.78 * var(--scale-base)); /* 30px */
        height: calc(2.78 * var(--scale-base)); /* 30px */
    }
    
    .color-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .color-actions {
        justify-content: stretch;
    }
    
    .color-actions .btn-sm {
        flex: 1;
    }
}