/* ==========================================
   FUTURISTIC 3D CONFIGURATOR - ADVANCED CSS
   ========================================== */

/* Futuristic Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700&family=Rajdhani:wght@500;600;700&display=swap');

/* CSS Variables for Easy Theme Management */
:root {
    --bg-main: #0a0a0f;
    --bg-panel: rgba(15, 20, 30, 0.85);
    --bg-viewer: #050510;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-subtitle: #8892b0;
    
    --neon-red: #ff4d4d;
    --neon-red-glow: rgba(255, 77, 77, 0.4);
    --neon-red-dim: rgba(211, 47, 47, 0.2);
    --neon-blue: #00bfff;
    --neon-blue-glow: rgba(0, 191, 255, 0.4);
    
    --glass-border: rgba(255, 255, 255, 0.1);
    --transition-speed: 0.3s;
}

/* Box-Sizing Fix */
*, *::before, *::after { 
    box-sizing: border-box; 
}

body { 
    margin: 0; 
    overflow: hidden; 
    font-family: 'Rajdhani', sans-serif; 
    background-color: var(--bg-main); 
    color: var(--text-main);
}

/* FLOATING BACK BUTTON FIX */
.floating-back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 500; 
    background: rgba(15, 20, 30, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--neon-red-glow);
    color: var(--neon-red);
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(211, 47, 47, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.floating-back-btn:hover, .floating-back-btn:focus-visible {
    background: var(--neon-red-dim);
    box-shadow: 0 0 15px rgba(211, 47, 47, 0.6);
    color: #ffffff;
    transform: scale(1.05);
    outline: 2px solid var(--neon-red);
}

/* PC MODE: Menu aur Back Button Slide Animation */
@media (min-width: 769px) {
    .main-panel-toggle-btn.shifted,
    .floating-back-btn.shifted {     
        left: 320px; 
    }
}

/* ==========================================
   NEW TOGGLE BUTTONS (MENU & CLOSE)
   ========================================== */

/* Main Toggle Button (Floating on screen when panel is hidden) */
.main-panel-toggle-btn {
    position: absolute;
    top: 75px; 
    left: 20px;
    z-index: 1000;
    background: rgba(15, 20, 30, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 18px;
    border-radius: 30px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-panel-toggle-btn:hover {
    background: var(--neon-red-dim);
    border-color: var(--neon-red);
    box-shadow: 0 0 15px rgba(211, 47, 47, 0.5);
}

/* Close Sidebar Button (Inside the panel) */
.close-sidebar-btn {
    position: absolute;
    top: 15px;
    left: 15px; /* FIX: Overlap rokne ke liye ise right se left kar diya gaya hai */
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    z-index: 101;
    transition: color 0.3s ease, transform 0.3s ease;
}

.close-sidebar-btn:hover {
    color: var(--neon-red);
    transform: rotate(90deg) scale(1.2);
}

/* LAYOUT */
#container { 
    display: flex; 
    height: 100vh; 
    flex-direction: row; 
    position: relative;
}

/* ==========================================
   PC MODE PANEL SPECIFICS (Left Slide Animation)
   ========================================== */
@media (min-width: 769px) {
    #sidebar {
        width: 300px; 
        height: 100vh;
        background: var(--bg-panel); 
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-right: 1px solid var(--glass-border);
        padding: 25px 15px; 
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
        overflow-y: auto; 
        z-index: 200; 
        display: flex; 
        flex-direction: column; 
        gap: 15px;
        
        /* Smooth Hide/Show Animation from LEFT (PC Only) */
        position: absolute;
        top: 0;
        left: -320px; /* Initially Hidden */
        transition: left 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
        
        scrollbar-width: thin;
        scrollbar-color: #d32f2f rgba(0,0,0,0.2);
    }

    #sidebar.show-panel {
        left: 0;
    }
}

/* Custom Scrollbar Webkit */
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
#sidebar::-webkit-scrollbar-thumb { background: #d32f2f; border-radius: 10px; }

#viewer3d { 
    flex-grow: 1; 
    width: 100%; 
    background-color: var(--bg-viewer); 
    cursor: crosshair; 
    position: relative; 
    z-index: 1; 
    transition: background-color 0.5s ease;
}
#viewer3d:active { cursor: grabbing; }

/* UI OVERLAP FIX */
.header-section { 
    text-align: center; 
    border-bottom: 1px solid var(--neon-red-glow); 
    padding-bottom: 15px; 
    margin-bottom: 5px; 
    position: relative;
    padding-top: 15px; 
}

.header-section h2 { 
    margin: 0; 
    color: var(--neon-red); 
    font-family: 'Orbitron', sans-serif; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    font-size: 22px; 
    text-shadow: 0 0 10px rgba(211, 47, 47, 0.5);
}

.subtitle { 
    color: var(--text-subtitle); 
    font-size: 12px; 
    font-weight: 600; 
    margin-top: 5px; 
    letter-spacing: 1px; 
    text-transform: uppercase;
}

/* Unit Switcher Button FIX */
.unit-btn {
    position: absolute;
    right: 0;
    top: 0px; 
    background: rgba(0, 191, 255, 0.1);
    border: 1px solid var(--neon-blue-glow);
    color: var(--neon-blue);
    padding: 4px 6px;
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    z-index: 1000; 
}

.unit-btn:hover, .unit-btn:focus-visible { 
    background: rgba(0, 191, 255, 0.3); 
    color: #ffffff;
    outline: none;
    box-shadow: 0 0 8px var(--neon-blue-glow);
}

/* ACCORDION MENUS STYLING */
.accordion {
    background-color: rgba(0, 0, 0, 0.4);
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px 12px;
    width: 100%;
    border: 1px solid var(--glass-border);
    text-align: left;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    transition: var(--transition-speed);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion:focus-visible {
    outline: 2px solid var(--neon-red);
    outline-offset: -2px;
}

.accordion.active, .accordion:hover {
    background-color: var(--neon-red-dim);
    color: #ffffff;
    border-color: rgba(255, 77, 77, 0.5);
    box-shadow: inset 0 0 10px var(--neon-red-dim);
}

.accordion:after {
    content: '\002B'; 
    color: var(--neon-red);
    font-weight: bold;
    font-size: 18px;
    margin-left: 5px;
}

.accordion.active:after { content: "\2212"; }

.panel {
    padding: 0 5px;
    background-color: transparent;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

/* Futuristic Select Dropdown */
.cyber-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    color: #ffffff;
    border: 1px solid var(--neon-red-glow);
    padding: 8px 10px;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ff4d4d%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 10px auto;
    transition: all 0.2s ease;
}

.cyber-select:hover, .cyber-select:focus-visible {
    border-color: var(--neon-red);
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.3);
    outline: none;
}

.cyber-select option { background: var(--bg-main); color: #ffffff; }

/* Futuristic Control Groups */
.control-group { 
    background: rgba(255, 255, 255, 0.03); 
    padding: 12px; 
    border-radius: 12px; 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
    margin-top: 10px; margin-bottom: 5px;
}

label { 
    display: flex; justify-content: space-between; margin-bottom: 8px; 
    font-weight: 600; color: var(--text-muted); font-size: 13px; align-items: center;
}

.value-display { 
    color: #ffffff; background: rgba(211, 47, 47, 0.8); padding: 3px 6px; 
    border-radius: 6px; font-family: 'Orbitron', sans-serif; font-size: 11px; 
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.4);
}

/* Fixed Sliders */
input[type=range] { 
    -webkit-appearance: none; appearance: none; width: 100%; height: 6px; 
    background: rgba(255,255,255,0.1); border-radius: 10px; outline: none; 
    touch-action: pan-y; margin-bottom: 10px;
}
input[type=range]:focus-visible {
    outline: 2px solid var(--neon-red); outline-offset: 4px;
}
input[type=range]::-webkit-slider-thumb { 
    -webkit-appearance: none; appearance: none; width: 18px; height: 18px; 
    border-radius: 50%; background: var(--neon-red); cursor: pointer; transition: 0.2s; 
    box-shadow: 0 0 10px var(--neon-red); 
}
input[type=range]::-webkit-slider-thumb:active { transform: scale(1.2); }
input[type=range]::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%; background: var(--neon-red); 
    cursor: pointer; transition: 0.2s; box-shadow: 0 0 10px var(--neon-red); border: none;
}

/* Color Swatches & Pickers */
.color-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-col { text-align: center; display: flex; flex-direction: column; align-items: center;}
.color-col span { font-size: 11px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted);}
input[type=color] { 
    width: 100%; height: 35px; border: 1px solid rgba(255,255,255,0.2); 
    border-radius: 8px; cursor: pointer; padding: 0; background: transparent; 
}

.preset-colors {
    display: flex; justify-content: space-around; margin-top: 15px;
    padding-top: 15px; border-top: 1px dashed var(--glass-border);
}

.color-swatch {
    width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3);
    cursor: pointer; transition: transform 0.2s, border-color 0.2s; box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.color-swatch:hover, .color-swatch:focus-visible {
    transform: scale(1.15); border-color: #ffffff; box-shadow: 0 0 10px rgba(255,255,255,0.5); outline: none;
}

/* Futuristic Toggle Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { 
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; 
    background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 24px; 
    border: 1px solid rgba(255,255,255,0.2);
}
.slider:before { 
    position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; 
    background-color: var(--text-subtitle); transition: .4s; border-radius: 50%; 
}
input:checked + .slider { background-color: var(--neon-red-dim); border-color: var(--neon-red); }
input:checked + .slider:before { transform: translateX(18px); background-color: var(--neon-red); box-shadow: 0 0 8px var(--neon-red); }
input:focus-visible + .slider { outline: 2px solid #ffffff; outline-offset: 2px; }

/* Tech Dashboard */
.dashboard { 
    background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(100, 149, 237, 0.2);
    padding: 12px; border-radius: 12px; margin-top: 10px; 
}
.dash-row { 
    display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; 
    padding-bottom: 8px; border-bottom: 1px dashed var(--glass-border); 
}
.dash-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.highlight-green { color: #00ffcc; font-weight: bold; text-shadow: 0 0 5px rgba(0,255,204,0.4); }
.highlight-yellow { color: #ffd700; font-weight: bold; }
.highlight-red { color: var(--neon-red); font-weight: bold; text-shadow: 0 0 5px rgba(255,77,77,0.4); }

.warning-msg { 
    color: var(--neon-red); font-weight: 700; font-size: 11px; text-align: center; margin-top: 10px; 
    display: none; background: rgba(255, 77, 77, 0.1); padding: 8px; border-radius: 6px; 
    border: 1px solid rgba(255,77,77,0.3);
}

/* Cyber Buttons */
.action-btn { 
    background: linear-gradient(90deg, #b71c1c, #d32f2f); color: white; border: none; 
    text-align: center; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 700; 
    font-size: 14px; width: 100%; margin-top: 10px; text-transform: uppercase;
    letter-spacing: 1px; transition: all var(--transition-speed) ease; border: 1px solid var(--neon-red);
    box-shadow: 0 0 15px rgba(211, 47, 47, 0.2);
}
.action-btn:hover, .action-btn:focus-visible { 
    box-shadow: 0 0 20px rgba(211, 47, 47, 0.6); transform: translateY(-2px); outline: none;
}
.action-btn.reset-btn { 
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.2); 
    box-shadow: none; color: #cbd5e1; 
}
.action-btn.reset-btn:hover { background: rgba(255,255,255,0.1); }
.action-btn.lang-btn { 
    background: rgba(0, 191, 255, 0.1); border: 1px solid var(--neon-blue-glow); 
    color: var(--neon-blue); box-shadow: none; 
}
.action-btn.lang-btn:hover { background: rgba(0, 191, 255, 0.2); }

/* ==========================================
   RIGHT FLOATING QUICK TOGGLES
   ========================================== */
#quick-toggles {
    position: absolute; top: 20px; right: 20px; 
    background: transparent; 
    padding: 0;
    border: none;
    box-shadow: none;
    z-index: 100; min-width: 40px; height: 40px; overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column;
}

#quick-toggles.open {
    background: var(--bg-panel);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border-radius: 12px;
    min-width: 220px; height: auto; padding: 12px 15px;
}

.toggle-header {
    font-size: 0; margin-bottom: 0; border-bottom: none; padding-bottom: 0;
    text-align: center; cursor: pointer; display: flex; align-items: center; justify-content: flex-end;
    width: 100%; height: 40px; flex-shrink: 0; color: #cbd5e1;
}

.toggle-header::after { 
    content: '⚙️'; 
    font-size: 26px; 
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); 
    text-shadow: 0 2px 10px rgba(0,0,0,0.8); 
}
#quick-toggles.open .toggle-header::after { transform: rotate(90deg); text-shadow: none; }

#quick-toggles.open .toggle-header {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 10px; border-bottom: 1px solid var(--glass-border);
    padding-bottom: 5px; height: auto; justify-content: center;
}
#quick-toggles.open .toggle-header::after { content: ''; } 

.toggle-content {
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column; gap: 12px;
}

#quick-toggles.open .toggle-content {
    opacity: 1; visibility: visible; transform: translateY(0);
}

.quick-label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 0; width: 100%;
}

#quick-toggles.open input[type=range] { margin-top: 5px; height: 4px; }
#quick-toggles.open input[type=range]::-webkit-slider-thumb { width: 14px; height: 14px; }

/* ==========================================
   ADVANCED CAMERA UI (PC)
   ========================================== */
.camera-controls {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: var(--bg-panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: 10px 15px; border-radius: 40px; display: flex; gap: 10px;
    border: 1px solid rgba(255, 77, 77, 0.5); box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 100;
}

.camera-controls button {
    background: transparent; border: 1px solid rgba(255, 255, 255, 0.2); color: #cbd5e1; 
    padding: 8px 15px; border-radius: 20px; font-family: 'Rajdhani', sans-serif;
    font-weight: 700; font-size: 14px; cursor: pointer; transition: all var(--transition-speed) ease;
}

.camera-controls button:hover, .camera-controls button:focus-visible {
    background: #d32f2f; color: #ffffff; border-color: #d32f2f;
    box-shadow: 0 0 10px rgba(211, 47, 47, 0.6); outline: none;
}

/* ==========================================
   MOBILE APP UI (BOTTOM SHEET FIX)
   ========================================== */
@media (max-width: 768px) {
    #container { display: block; position: relative; }
    
    #viewer3d { 
        width: 100vw; height: 100vh; position: fixed; 
        top: 0; left: 0; z-index: 1; 
    }
    
    /* Floating Elements */
    .floating-back-btn { top: 15px; left: 15px; z-index: 100; font-size: 11px; padding: 6px 12px; }
    .main-panel-toggle-btn { top: 60px; left: 15px; font-size: 12px; padding: 8px 14px; }
    
    /* Quick Toggles Mobile Size Adjustment */
    #quick-toggles { top: 15px; right: 15px; }
    #quick-toggles.open { min-width: 180px; padding: 10px; }
    #quick-toggles.open .toggle-header { font-size: 11px; margin-bottom: 8px; }
    .quick-label { font-size: 11px; }
    
    /* MAIN SIDEBAR - PROPER BOTTOM SHEET ANIMATION */
    #sidebar { 
        position: fixed; 
        top: auto !important; 
        left: 50% !important; 
        transform: translateX(-50%) !important; 
        
        width: 95vw; height: auto; 
        max-height: 65vh; z-index: 200; padding: 15px;
        border-radius: 20px; border: 1px solid var(--neon-red-glow); 
        border-top: 1px solid var(--neon-red);
        background: var(--bg-panel); backdrop-filter: blur(15px);
        box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
        scrollbar-width: none; 
        
        bottom: -100%; 
        transition: bottom 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    
    /* When JS adds .show-panel class, it slides up properly */
    #sidebar.show-panel {
        bottom: 65px; 
    }

    #sidebar::-webkit-scrollbar { display: none; }
    
    .header-section { 
        padding-top: 0; padding-bottom: 10px; margin-bottom: 10px; 
        border-bottom: 1px solid rgba(255, 77, 77, 0.3); 
    }
    .header-section h2 { font-size: 18px; }
    .subtitle { font-size: 11px; margin-top: 2px; }
    .unit-btn { 
        top: 0; font-size: 10px; padding: 4px 6px; 
        position: relative; float: right; margin-top: -25px; 
    }
    
    /* Sleek Mobile Controls */
    .accordion { padding: 10px; font-size: 13px; border-radius: 8px; }
    .control-group { padding: 10px; margin-top: 5px; border-radius: 10px; }
    label { font-size: 12px; margin-bottom: 5px; }
    .value-display { font-size: 10px; padding: 2px 6px; }
    input[type=range] { margin-bottom: 5px; }
    
    /* Camera Controls Fixed at Bottom */
    .camera-controls { 
        position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%);
        width: 95vw; background: rgba(10, 10, 15, 0.95); backdrop-filter: blur(10px);
        padding: 8px 10px; border-radius: 25px; gap: 5px;
        border: 1px solid var(--neon-red-glow); box-shadow: 0 5px 25px rgba(0,0,0,0.9); 
        z-index: 100; justify-content: space-between;
    }
    .camera-controls button { 
        font-size: 10px; padding: 6px 8px; flex: 1; border-radius: 15px;
        background: rgba(255, 255, 255, 0.05); border: 1px solid transparent;
        letter-spacing: -0.5px;
    }
    .camera-controls button:hover, .camera-controls button:active {
        background: var(--neon-red-dim); border-color: var(--neon-red);
    }
}