/* ============================================================
   UI-Library.css
   Styles pour les composants UI-Library
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: radial-gradient(circle at 0% 0%, #0f0c29, #1a1a3e, #0a0a15);
    overflow: hidden;
    font-family: 'Segoe UI', 'Poppins', system-ui, sans-serif;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(125deg, #ff6b6b 0%, #4ecdc4 25%, #45b7d1 50%, #96ceb4 75%, #ffeead 100%);
    opacity: 0.15;
    z-index: -2;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { opacity: 0.1; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(1.05); }
    100% { opacity: 0.1; transform: scale(1); }
}

/* Theme Light */
body.light-theme {
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
}

body.light-theme::before {
    opacity: 0.05;
}

body.light-theme .window,
body.light-theme .window-surface {
    background: rgba(25, 30, 45, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.light-theme .title-bar,
body.light-theme .window-titlebar {
    background: rgba(15, 20, 35, 0.8);
}

body.light-theme .title-text,
body.light-theme .window-title {
    color: #ffffff;
}

body.light-theme .window-content,
body.light-theme .window-content p,
body.light-theme .content,
body.light-theme .content p {
    color: #e0e0e0;
}

body.light-theme .window-content h2,
body.light-theme .content h2 {
    color: #ffffff;
}

body.light-theme .section-header h1,
body.light-theme .section-header p {
    color: #1a1a2e;
}

body.light-theme .control-panel,
body.light-theme .potentiometer-panel,
body.light-theme .double-panel {
    background: rgba(15, 20, 35, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
}

body.light-theme .control-panel h3,
body.light-theme .potentiometer-label,
body.light-theme .double-panel h4 {
    color: #ffbd2e;
}

body.light-theme .control-group label {
    color: #c0c0c0;
}

/* Background Wobbly et Combo */
.wobbly-container,
.combo-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a6b6b, #1a0a5e);
    border-radius: 0;
    overflow: hidden;
}

.wobbly-container::before,
.combo-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 40%, rgba(0,255,200,0.12), rgba(128,0,255,0.12));
    pointer-events: none;
}

/* Window Lampe Magique */
.window {
    position: absolute;
    width: 580px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 10;
}

.title-bar {
    height: 56px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 28px 28px 0 0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    cursor: grab;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.title-bar:active { cursor: grabbing; }

.window-buttons { display: flex; gap: 10px; }
.window-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.window-btn:hover { transform: scale(1.2); }
.close { background: #ff5f56; }
.minimize-btn { background: #ffbd2e; }
.maximize { background: #27c93f; }

.title-text {
    color: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    font-weight: 600;
}

.content {
    padding: 32px;
    color: rgba(255, 255, 255, 0.9);
}
.content h2 {
    margin-bottom: 16px;
    font-size: 32px;
    background: linear-gradient(135deg, #ffd89b, #c7e9fb, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.feature-list {
    list-style: none;
    margin: 24px 0;
}
.feature-list li {
    padding: 10px 0 10px 34px;
    position: relative;
}
.feature-list li::before {
    content: "🧞";
    position: absolute;
    left: 0;
    top: 8px;
}

/* Control Button */
.control-btn {
    position: fixed;
    bottom: 40px;
    right: 40px;
    padding: 14px 32px;
    background: rgba(255, 189, 46, 0.25);
    backdrop-filter: blur(16px);
    color: #ffbd2e;
    border: 1px solid rgba(255, 189, 46, 0.5);
    border-radius: 60px;
    font-size: 15px;
    font-weight: 700;
    cursor: grab;
    z-index: 100;
    font-family: monospace;
    transition: all 0.3s;
}
.control-btn:hover {
    transform: translateY(-3px);
    background: rgba(255, 189, 46, 0.35);
}
.control-btn.dragging {
    cursor: grabbing;
}
.control-btn.restore-mode {
    background: rgba(102, 126, 234, 0.25);
    color: #a78bfa;
    border-color: rgba(102, 126, 234, 0.5);
}

/* Potentiometer Panel */
.potentiometer-panel {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 20px 28px;
    display: flex;
    gap: 28px;
    z-index: 90;
}
.potentiometer-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.potentiometer-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    text-transform: uppercase;
}
.potentiometer {
    width: 130px;
    height: 5px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
.potentiometer::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffbd2e, #ff9d00);
    cursor: grab;
}
.potentiometer-value {
    color: #ffbd2e;
    font-family: monospace;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 20px;
}

/* Wobbly Window */
.wobbly-window {
    position: absolute;
    width: 460px;
    min-height: 380px;
    border-radius: 24px;
    cursor: default;
}

.window-surface {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(18, 22, 35, 0.92);
    backdrop-filter: blur(12px);
    box-shadow: 0 30px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.window-titlebar {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    background: rgba(30, 35, 55, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.window-titlebar:active { cursor: grabbing; }

.window-title {
    font-weight: 600;
    font-size: 14px;
    color: #f0f3fa;
}

.window-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.window-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}
.btn-close { background: #ff5f56; }
.btn-minimize { background: #ffbd2e; }
.btn-maximize { background: #27c93f; }

.window-content {
    padding: 24px;
    color: #cbd5e6;
}
.window-content h2 {
    margin-bottom: 12px;
    font-size: 20px;
    color: white;
}
.wobble-demo {
    background: linear-gradient(135deg, #3b82f6, #a855f7);
    padding: 16px;
    border-radius: 16px;
    text-align: center;
    font-weight: bold;
    margin: 16px 0;
    color: white;
}

/* Control Panel */
.control-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 20px;
    width: 290px;
    z-index: 2000;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.control-panel h3 {
    color: white;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}
.control-group {
    margin-bottom: 14px;
}
.control-group label {
    display: flex;
    justify-content: space-between;
    color: #cbd5e6;
    font-size: 12px;
    margin-bottom: 6px;
}
.control-group input[type="range"] {
    width: 100%;
    cursor: pointer;
    background: #334155;
    height: 4px;
    border-radius: 4px;
}
.control-group input[type="range"]::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
}
.value-display {
    color: #3b82f6;
    font-weight: bold;
}
.panel-select {
    width: 100%;
    background: #1e293b;
    border: 1px solid #334155;
    color: white;
    padding: 8px 12px;
    border-radius: 16px;
    cursor: pointer;
    margin-top: 8px;
}
.reset-btn {
    width: 100%;
    background: #3b82f6;
    border: none;
    padding: 8px;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    margin-top: 12px;
}

/* Combo Window */
.combo-window {
    position: absolute;
    width: 560px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 10;
}

.combo-window .title-bar {
    cursor: grab;
}

.double-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 20px;
    width: 320px;
    z-index: 90;
}

.double-panel h4 {
    color: #ffbd2e;
    margin-bottom: 12px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 6px;
}

.double-panel .control-group {
    margin-bottom: 12px;
}

.double-panel .control-group label {
    display: flex;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
}

.double-panel input {
    width: 100%;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    height: 4px;
    border-radius: 4px;
}

.double-panel input::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffbd2e;
    cursor: pointer;
}

.wobbly-toggle-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.wobbly-toggle-switch label {
    cursor: pointer;
    color: #ffbd2e;
    font-size: 12px;
}

.wobbly-toggle-switch input {
    width: auto;
    transform: scale(1.2);
    cursor: pointer;
}

/* Theme Button - Cache sur Wobbly par JS */
.global-theme-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 40px;
    color: #ffbd2e;
    cursor: pointer;
    z-index: 1001;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.global-theme-btn:hover {
    background: rgba(255, 189, 46, 0.3);
    transform: translateY(-2px);
}

/* Navigation */
.nav-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(16px);
    border-radius: 60px;
    padding: 8px 20px;
    display: flex;
    gap: 16px;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-btn {
    padding: 10px 24px;
    border-radius: 40px;
    border: none;
    background: transparent;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.nav-btn.active {
    background: linear-gradient(135deg, #ffbd2e, #a78bfa);
    color: #1a1a2e;
}

/* Demo sections */
.demo-container {
    position: relative;
    width: 100%;
    height: 100vh;
}

.demo-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow: hidden;
}

.demo-section.active {
    opacity: 1;
    visibility: visible;
}

.section-header {
    text-align: center;
    padding: 20px;
    color: white;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    pointer-events: none;
}

.section-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}
/* Control Button - Version optimisée */
.control-btn {
    position: fixed;
    bottom: 40px;
    right: 40px;
    padding: 14px 32px;
    background: rgba(255, 189, 46, 0.25);
    backdrop-filter: blur(16px);
    color: #ffbd2e;
    border: 1px solid rgba(255, 189, 46, 0.5);
    border-radius: 60px;
    font-size: 15px;
    font-weight: 700;
    cursor: grab;
    z-index: 100;
    font-family: monospace;
    transition: all 0.3s;
    will-change: transform;
    transform: translateZ(0);
}

.control-btn:hover {
    transform: translateY(-3px);
    background: rgba(255, 189, 46, 0.35);
}

.control-btn.dragging {
    cursor: grabbing;
    transition: none;
}

.control-btn.restore-mode {
    background: rgba(102, 126, 234, 0.25);
    color: #a78bfa;
    border-color: rgba(102, 126, 234, 0.5);
}
/* Responsive */
@media (max-width: 768px) {
    .window, .combo-window { width: 90%; }
    .wobbly-window { width: 90%; left: 5% !important; }
    .potentiometer-panel { flex-direction: column; gap: 16px; }
    .control-panel { width: 260px; }
    .double-panel { width: 280px; }
}
