/* === WebOS — Estilos Base del Sistema Operativo ===
 * Variables CSS, reset, tema dark/light, wallpapers, tipografía, responsive
 */

:root {
    /* Colores primarios */
    --color-primary: #0078d4;
    --color-primary-hover: #1a8ae8;
    --color-danger: #e74c3c;
    --color-success: #2ecc71;
    --color-warning: #f39c12;

    /* Variables de tema dark (por defecto) */
    --bg-desktop: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --bg-surface: rgba(30, 30, 40, 0.85);
    --bg-surface-hover: rgba(50, 50, 60, 0.9);
    --bg-titlebar: rgba(40, 40, 55, 0.95);
    --bg-taskbar: rgba(20, 20, 30, 0.9);
    --bg-input: rgba(50, 50, 65, 0.7);
    --bg-card: rgba(30, 30, 45, 0.8);

    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a8;
    --text-titlebar: #d0d0d8;
    --text-on-primary: #ffffff;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-active: rgba(255, 255, 255, 0.25);

    --shadow-window: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glass: 0 4px 16px rgba(0, 0, 0, 0.3);

    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-blur: 20px;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* Tema claro */
[data-theme='light'] {
    --bg-desktop: linear-gradient(135deg, #667eea, #764ba2, #f093fb);
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-surface-hover: rgba(245, 245, 250, 0.95);
    --bg-titlebar: rgba(240, 240, 248, 0.95);
    --bg-taskbar: rgba(240, 240, 250, 0.92);
    --bg-input: rgba(240, 240, 248, 0.7);
    --bg-card: rgba(255, 255, 255, 0.8);

    --text-primary: #1a1a2e;
    --text-secondary: #555570;
    --text-titlebar: #2c2c3e;
    --text-on-primary: #ffffff;

    --border-color: rgba(0, 0, 0, 0.1);
    --border-active: rgba(0, 0, 0, 0.25);

    --shadow-window: 0 8px 32px rgba(0, 0, 0, 0.15);
    --shadow-glass: 0 4px 16px rgba(0, 0, 0, 0.1);

    --glass-bg: rgba(255, 255, 255, 0.5);
    --glass-border: rgba(255, 255, 255, 0.6);
}

/* Wallpapers */
[data-wallpaper='gradient-1'] {
    --bg-desktop: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}
[data-theme='light'][data-wallpaper='gradient-1'] {
    --bg-desktop: linear-gradient(135deg, #667eea, #764ba2, #f093fb);
}

[data-wallpaper='gradient-2'] {
    --bg-desktop: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
}
[data-theme='light'][data-wallpaper='gradient-2'] {
    --bg-desktop: linear-gradient(135deg, #56ab2f, #a8e063, #d4e09b);
}

[data-wallpaper='gradient-3'] {
    --bg-desktop: linear-gradient(135deg, #0c0c0c, #1a0a0a, #2d1010);
}
[data-theme='light'][data-wallpaper='gradient-3'] {
    --bg-desktop: linear-gradient(135deg, #ff9a9e, #fecfef, #a18cd1);
}

[data-wallpaper='gradient-4'] {
    --bg-desktop: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
}
[data-theme='light'][data-wallpaper='gradient-4'] {
    --bg-desktop: linear-gradient(135deg, #a1c4fd, #c2e9fb, #dfe6e9);
}

[data-wallpaper='gradient-5'] {
    --bg-desktop: linear-gradient(135deg, #0d1b2a, #1b263b, #415a77);
}
[data-theme='light'][data-wallpaper='gradient-5'] {
    --bg-desktop: linear-gradient(135deg, #fbc2eb, #a6c1ee, #d4fc79);
}

/* Reset y base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
}

body {
    background: var(--bg-desktop);
    background-size: cover;
    transition: background var(--transition-slow);
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Utilidades */
.hidden {
    display: none !important;
}

/* Boot screen */
#boot-screen {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    transition: opacity 0.5s ease;
}
#boot-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}
#boot-screen h1 {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2rem;
    letter-spacing: 4px;
}
.boot-bar-container {
    width: 220px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
}
.boot-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #58a6ff);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.boot-bar.complete {
    width: 100%;
}

/* Overlay responsive */
#responsive-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 1.3rem;
    text-align: center;
    padding: 2rem;
}
@media (max-width: 767px) {
    #responsive-overlay {
        display: flex;
    }
    #desktop-area {
        display: none !important;
    }
}

/* Glassmorphism base */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}
