:root[data-theme="dark"] {
    --bg-desktop: radial-gradient(circle at center, #0a192f 0%, #020617 100%);
    --top-bar-bg: rgba(10, 25, 47, 0.7);
    --dock-bg: rgba(10, 25, 47, 0.5);
    --window-bg: rgba(15, 23, 42, 0.9);
    --window-header: rgba(30, 41, 59, 0.7);
    --window-border: rgba(56, 189, 248, 0.2);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --selection: rgba(56, 189, 248, 0.3);
    --google-bg: #0f172a;
    --google-text: #f1f5f9;
    --google-border: #1e293b;
}

:root[data-theme="light"] {
    --bg-desktop: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
    --top-bar-bg: rgba(248, 250, 252, 0.75);
    --dock-bg: rgba(248, 250, 252, 0.5);
    --window-bg: rgba(255, 255, 255, 0.98);
    --window-header: rgba(241, 245, 249, 0.9);
    --window-border: rgba(148, 163, 184, 0.2);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent: #0284c7;
    --selection: rgba(2, 132, 199, 0.15);
    --google-bg: #ffffff;
    --google-text: #1e293b;
    --google-border: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-desktop);
    color: var(--text-primary);
}

/* Pantalla de Inicio (Secuencia de Arranque) */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease;
}

.boot-content {
    text-align: center;
    color: white;
    font-family: 'JetBrains Mono', monospace;
}

.boot-title { font-size: 2.5rem; margin-bottom: 20px; }
.boot-subtitle { font-size: 1.2rem; margin-bottom: 30px; letter-spacing: 5px; opacity: 0.8; }

.boot-loader {
    width: 300px;
    height: 4px;
    background: #333;
    margin: 0 auto 10px;
    overflow: hidden;
    border-radius: 2px;
}

.boot-progress {
    width: 0%;
    height: 100%;
    background: white;
    box-shadow: 0 0 10px white;
    animation: bootProgress 3s forwards;
}

@keyframes bootProgress {
    0% { width: 0%; }
    20% { width: 15%; }
    50% { width: 60%; }
    100% { width: 100%; }
}

.boot-wait { font-size: 0.9rem; opacity: 0.6; }
.boot-footer { margin-top: 50px; font-size: 0.8rem; opacity: 0.4; }

/* Fondo de Código Animado (Lluvia de Código) */
#bg-code-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
    background-image: 
        linear-gradient(rgba(56, 189, 248, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
}

.bg-code-line {
    position: absolute;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    white-space: nowrap;
    animation: codeRain 15s linear infinite;
    opacity: 0;
}

@keyframes codeRain {
    0% { transform: translateY(-100px); opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.5; }
    100% { transform: translateY(100vh); opacity: 0; }
}

/* Barra de Menú Superior (Glassmorphism) */
#top-bar {
    width: 100%;
    height: 30px;
    background: var(--top-bar-bg);
    backdrop-filter: blur(25px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    position: fixed;
    top: 0;
    z-index: 2000;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 0.5px solid var(--window-border);
}

.top-bar-left, .top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-menu-item {
    position: relative;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.top-bar-icon {
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.top-bar-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .top-bar-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Estadísticas del Centro de Control */
.cc-stat-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cc-stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
}

[data-theme="light"] .cc-stat-item {
    background: rgba(0, 0, 0, 0.03);
}

.cc-stat-item i { font-size: 16px; }

/* Selectores de Filtros Visuales */
.filter-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
}

/* Interfaz de Interruptor (Switch Estilo iOS) */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.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: 20px;
}

[data-theme="light"] .slider { background-color: rgba(0,0,0,0.1); }

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(16px); }

/* Filtros de Renderizado del Sistema */
body.grayscale { filter: grayscale(1) !important; }
body.sepia { filter: sepia(0.8) !important; }
body.nightshift { filter: sepia(0.3) hue-rotate(-20deg) brightness(0.9) !important; }

.top-menu-item:hover {
    background: rgba(255,255,255,0.1);
}

.apple-icon { font-size: 16px; margin-top: -2px; }

/* Menús Desplegables del Sistema */
.dropdown-menu {
    position: absolute;
    top: 25px;
    left: 0;
    background: var(--window-bg);
    backdrop-filter: blur(40px);
    border: 0.5px solid var(--window-border);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    min-width: 200px;
    padding: 5px;
    z-index: 3000;
}

.dropdown-option {
    padding: 6px 15px;
    border-radius: 4px;
    font-size: 13px;
}

.dropdown-option:hover {
    background: var(--accent);
    color: white;
}

.dropdown-divider {
    height: 0.5px;
    background: var(--window-border);
    margin: 4px 10px;
}

.hidden { display: none !important; }

/* Entorno de Escritorio */
#desktop {
    width: 100%;
    height: 100%;
    padding-top: 30px;
    padding-bottom: 90px;
    position: relative;
    z-index: 1;
}

/* Muelle de Aplicaciones (Dock Premium) */
#dock-container {
    width: 100%;
    height: 85px;
    position: fixed;
    bottom: 5px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 2000;
    pointer-events: none;
}

#dock {
    background: var(--dock-bg);
    backdrop-filter: blur(35px);
    border: 0.5px solid var(--window-border);
    padding: 8px;
    border-radius: 20px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    pointer-events: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.dock-item {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    transition: all 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
    transform-origin: bottom;
}

.dock-item:hover {
    transform: scale(1.4) translateY(-10px);
    margin: 0 12px;
}

.dock-divider {
    width: 0.5px;
    height: 40px;
    background: var(--window-border);
    margin: 0 5px;
}

.dot {
    width: 4px;
    height: 4px;
    background: var(--text-primary);
    border-radius: 50%;
    position: absolute;
    bottom: -8px;
    opacity: 0;
}

.dock-item.active .dot { opacity: 0.6; }

/* Sistema de Ventanas */
.window {
    position: absolute;
    background: var(--window-bg);
    backdrop-filter: blur(45px);
    border: 0.5px solid var(--window-border);
    border-radius: 12px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    min-width: 320px;
    min-height: 250px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    will-change: transform, opacity, top, left;
}

.window.window-moving {
    transition: none !important;
    user-select: none;
    cursor: move;
}

/* Clases para Animación de Minimizado (Efecto Genio) */
.window.minimizing {
    transform: scale(0.1) translateY(800px) skewX(20deg);
    opacity: 0;
    pointer-events: none;
}

.window.maximizing {
    transform: scale(1) translateY(0) skewX(0);
    opacity: 1;
}

.window-header {
    height: 38px;
    background: var(--window-header);
    display: flex;
    align-items: center;
    padding: 0 12px;
    cursor: move;
}

.window-controls { display: flex; gap: 8px; margin-right: 20px; }
.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 7px;
    color: rgba(0,0,0,0.5);
    cursor: pointer;
}

.control-close { background: #ff5f57; }
.control-min { background: #ffbd2e; }
.control-max { background: #28c840; }

.window-title {
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 40px;
}

.window-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* Rediseño de la Aplicación de Búsqueda (Estilo Google) */
.google-window {
    background: var(--google-bg) !important;
    color: var(--google-text) !important;
}

.google-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding-bottom: 50px;
}

.google-logo {
    font-size: 80px;
    font-weight: 700;
    margin-bottom: 30px;
}

.google-logo span:nth-child(1) { color: #4285F4; }
.google-logo span:nth-child(2) { color: #EA4335; }
.google-logo span:nth-child(3) { color: #FBBC05; }
.google-logo span:nth-child(4) { color: #EA4335; }
.google-logo span:nth-child(5) { color: #34A853; }

.search-box {
    width: 100%;
    max-width: 580px;
    height: 44px;
    background: var(--google-bg);
    border: 1px solid var(--google-border);
    border-radius: 24px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 15px;
}

.search-box:hover { box-shadow: 0 1px 6px rgba(32,33,36,0.28); }

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 16px;
    outline: none;
}

.vscode-container {
    display: flex;
    height: 100%;
    background: #1e1e1e;
    overflow: hidden;
}

.vscode-sidebar {
    width: 180px;
    background: #252526;
    color: #cccccc;
    font-size: 11px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
    padding: 10px 15px;
    font-weight: 700;
    opacity: 0.6;
    font-size: 10px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.folder-title {
    padding: 2px 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
}

.file-list {
    list-style: none;
    padding: 5px 0;
}

.file-list li {
    padding: 6px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    font-size: 12px;
}

.file-list li:hover { background: rgba(255, 255, 255, 0.05); }
.file-list li.active { background: #37373d; color: #ffffff; }

.vscode-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
}

.editor-tabs {
    height: 35px;
    background: #252526;
    display: flex;
    border-bottom: 1px solid rgba(0,0,0,0.2);
}

.tab {
    padding: 0 25px;
    display: flex;
    align-items: center;
    background: #2d2d2d;
    color: #969696;
    font-size: 12px;
    cursor: pointer;
    border-right: 1px solid #1e1e1e;
    transition: all 0.2s;
}

.tab.active {
    background: #1e1e1e;
    color: #ffffff;
}

.editor-main {
    flex: 1;
    padding: 25px;
    color: #d4d4d4;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    overflow-y: auto;
}

.search-buttons {
    margin-top: 30px;
    display: flex;
    gap: 12px;
}

.search-buttons button {
    background: #f8f9fa;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #3c4043;
    font-size: 14px;
    padding: 0 16px;
    height: 36px;
    cursor: pointer;
}

[data-theme="dark"] .search-buttons button {
    background: #303134;
    color: #e8eaed;
}

.res-item h3 { margin-bottom: 4px; }
.res-item:hover h3 { text-decoration: underline; }

/* Chat de IA Premium Refinado (TomasIA) */
#ai-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
}

.ai-msg {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: msgIn 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-bottom-left-radius: 4px;
}

.ai-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #007aff, #00c6ff);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Aplicación de Contacto Premium Versión 3 */
.contact-window-premium .window-content {
    padding: 0;
    overflow: hidden;
}

.contact-v3-container {
    display: flex;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
}

.contact-v3-sidebar {
    width: 220px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-right: 1px solid var(--window-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

[data-theme="light"] .contact-v3-sidebar { background: rgba(0, 0, 0, 0.05); }

.v3-sidebar-item {
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    opacity: 0.7;
}

.v3-sidebar-item:hover, .v3-sidebar-item.active {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.server-status-pill-floating {
    position: absolute;
    top: -15px;
    right: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 6px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #4cd137;
    z-index: 10;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4cd137;
    border-radius: 50%;
}

.status-dot.pulse {
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% { box-shadow: 0 0 0 0 rgba(76, 209, 55, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(76, 209, 55, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 209, 55, 0); }
}

.contact-v3-main {
    flex: 1;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.v3-hero-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 30px;
    display: flex;
    gap: 30px;
    max-width: 600px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    transition: transform 0.3s;
    position: relative;
}

.chat-btn {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.v3-hero-card:hover { transform: translateY(-5px); }

.v3-card-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.v3-card-left img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent);
}

.ping-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.v3-contact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 25px 0;
}

.v3-contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 12px;
    transition: all 0.2s;
    font-size: 12px;
}

.v3-contact-item:hover {
    background: var(--accent);
    color: white;
}

.v3-contact-item i { font-size: 20px; }

.v3-availability-info {
    font-size: 13px;
    opacity: 0.7;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.v3-availability-info i { width: 20px; color: var(--accent); }

[data-theme="light"] .v3-hero-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Animations & Effects */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

/* TomasAI Elite Card Styles */
.ai-cards-container {
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
}

.ai-cards-scroll {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding: 5px;
}

/* Hide scrollbar for the grid but allow scrolling if needed */
.ai-cards-scroll::-webkit-scrollbar {
    width: 4px;
}
.ai-cards-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.ai-card {
    flex: 0 1 auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    backdrop-filter: blur(5px);
}

.ai-card:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.ai-card:active {
    transform: scale(0.95);
}

/* Responsividad Móvil y Adaptabilidad del Sistema */
@media screen and (max-width: 768px) {
    #top-bar { padding: 0 5px; font-size: 11px; }
    .top-menu-item:not(.apple-menu), .top-bar-icon:not([onclick*="control-center"]):not(#lang-btn) { display: none; }
    
    #dock-container { height: 75px; bottom: 0; padding: 0 5px; }
    #dock { gap: 5px; padding: 5px; border-radius: 15px; }
    .dock-item { width: 42px; height: 42px; font-size: 20px; }
    .dock-item:hover { transform: scale(1.1) translateY(-5px); margin: 0 2px; }
    .dock-divider { height: 30px; }
    
    .window { 
        border-radius: 15px 15px 0 0 !important; 
        box-shadow: 0 -10px 30px rgba(0,0,0,0.5) !important; 
        width: 100% !important; 
        height: calc(100% - 105px) !important; 
        top: 30px !important; 
        left: 0 !important; 
        min-width: 0 !important; 
        border-bottom: none !important; 
        border-left: none !important; 
        border-right: none !important; 
        transform: none !important;
    }
    .window-header { height: 32px; padding: 0 8px; }
    .window-title { font-size: 11px; margin-right: 20px; }
    .control { width: 10px; height: 10px; }
    
    /* Bio App Responsive */
    .app-bio-macos { flex-direction: column !important; }
    .bio-sidebar { width: 100% !important; border-right: none !important; border-bottom: 1px solid var(--window-border); padding: 15px !important; }
    .bio-sidebar img { width: 80px !important; height: 80px !important; margin-bottom: 10px !important; }
    .bio-main { padding: 20px !important; }
    .bio-main h2 { font-size: 22px !important; }
    
    /* Grid Adjustments */
    div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    
    /* Google Search Responsive */
    .google-logo { font-size: 40px !important; }
    .search-box { max-width: 90% !important; }
    
    /* AI Chat Responsive */
    .ai-msg { max-width: 95% !important; font-size: 13px !important; }
    #ai-input-container { padding: 10px !important; }
    
    /* Contact Responsive */
    .contact-v3-container { flex-direction: column !important; }
    .contact-v3-sidebar { width: 100% !important; height: auto !important; border-right: none !important; border-bottom: 1px solid var(--window-border); flex-direction: row !important; overflow-x: auto; padding: 10px !important; }
    .v3-sidebar-item { padding: 8px 12px !important; white-space: nowrap; }
    .v3-hero-card { flex-direction: column !important; padding: 20px !important; gap: 20px !important; }
    .v3-card-left img { width: 100px !important; height: 100px !important; }
}

@media screen and (max-width: 480px) {
    #top-time { display: none; }
    .google-logo { font-size: 32px !important; }
    .btn-download { width: 100%; justify-content: center; }
}
