/* ==========================================================================
   S.D. VILLAESCUSA | ENTERPRISE DESIGN SYSTEM v15.0
   ========================================================================== */

:root {
    /* 🎨 PALETA CROMÁTICA */
    --color-gold: #D4AF37;
    --color-gold-light: rgba(212, 175, 55, 0.15);
    --color-dark-base: #0a0a0a;
    --color-dark-panel: #141414;
    --color-dark-surface: #1e1e1e;
    --color-text-primary: #ffffff;
    --color-text-secondary: #a0a0a0;
    --color-success: #2ecc71;
    --color-danger: #e74c3c;
    --color-border: rgba(255, 255, 255, 0.08);

    /* 📐 ESTRUCTURA */
    --glass-bg: rgba(30, 30, 30, 0.6);
    --glass-blur: blur(25px);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

/* RESET & BASE */
#sdv-os-root { font-family: var(--font-main); color: var(--color-text-primary); line-height: 1.5; }
#sdv-os-root * { box-sizing: border-box; }

/* 1. TRIGGER (BOTÓN FLOTANTE) */
#sdv-trigger-btn {
    position: fixed; bottom: 30px; left: 30px;
    width: 64px; height: 64px;
    background: white; border-radius: 50%;
    cursor: pointer; z-index: 99990;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 4px;
}
#sdv-trigger-btn:hover { transform: scale(1.1); }
.sdv-trigger-icon { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* 2. VENTANA PRINCIPAL (APP SHELL) */
#sdv-main-window {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--color-dark-base);
    z-index: 99999; opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.4s ease;
    background-image: radial-gradient(circle at 50% 0%, #1a1a1a 0%, #000 80%);
}
#sdv-os-root.active #sdv-main-window { opacity: 1; visibility: visible; pointer-events: all; }

/* LOADER GLOBAL */
#sdv-loader-overlay {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.7); z-index: 1000;
    display: none; align-items: center; justify-content: center;
}
.sdv-spinner {
    width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--color-gold); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 3. COMPONENTES UI */

/* Botones */
.sdv-btn {
    padding: 12px 24px; border-radius: 8px; border: none;
    font-weight: 600; cursor: pointer; transition: 0.2s;
    font-size: 14px; display: inline-flex; align-items: center; gap: 8px;
}
.sdv-btn-primary { background: var(--color-gold); color: black; }
.sdv-btn-primary:hover { background: white; }
.sdv-btn-ghost { background: transparent; color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.sdv-btn-ghost:hover { border-color: white; color: white; }

/* Inputs */
.sdv-input {
    width: 100%; padding: 14px; background: rgba(0,0,0,0.3);
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    color: white; outline: none; transition: 0.3s;
}
.sdv-input:focus { border-color: var(--color-gold); background: black; }

/* Tablas de Datos (DataGrids) */
.sdv-table { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 14px; }
.sdv-table th { text-align: left; color: var(--color-text-secondary); padding: 15px; border-bottom: 1px solid var(--color-border); font-weight: 500; }
.sdv-table td { padding: 15px; border-bottom: 1px solid var(--color-border); color: white; }
.sdv-table tr:hover { background: rgba(255,255,255,0.02); }
.sdv-badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; text-transform: uppercase; }
.badge-fit { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }
.badge-injured { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }

/* 4. VISTAS ESPECÍFICAS */

/* Login View */
.view-login { height: 100%; display: flex; align-items: center; justify-content: center; }
.login-box {
    width: 380px; padding: 40px;
    background: var(--glass-bg); backdrop-filter: var(--glass-blur);
    border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* Dashboard Layout */
.layout-app { display: flex; width: 100%; height: 100%; }
.app-sidebar {
    width: 260px; height: 100%; background: var(--color-dark-panel);
    border-right: 1px solid var(--color-border);
    display: flex; flex-direction: column; padding: 20px;
}
.app-content { flex: 1; padding: 40px; overflow-y: auto; background: var(--color-dark-base); }

/* Sidebar Navigation */
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; margin-bottom: 5px;
    color: var(--color-text-secondary); border-radius: var(--radius-sm);
    cursor: pointer; transition: 0.2s;
}
.nav-link:hover, .nav-link.active { background: var(--color-gold-light); color: var(--color-gold); }
.user-profile { margin-top: auto; display: flex; align-items: center; gap: 10px; padding-top: 20px; border-top: 1px solid var(--color-border); }

/* Dashboard Widgets */
.grid-dashboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 40px; }
.widget-card {
    background: var(--color-dark-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); padding: 24px;
}
.widget-label { font-size: 12px; text-transform: uppercase; color: var(--color-text-secondary); letter-spacing: 1px; }
.widget-value { font-size: 32px; font-weight: 700; color: white; margin-top: 8px; }

/* 5. RESPONSIVE (MOBILE) */
@media (max-width: 768px) {
    .layout-app { flex-direction: column; }
    .app-sidebar {
        width: 100%; height: 70px; flex-direction: row; justify-content: space-around;
        position: absolute; bottom: 0; left: 0; z-index: 100;
        background: black; border-top: 1px solid var(--color-border); border-right: none;
        padding: 0;
    }
    .user-profile { display: none; }
    .nav-link span { display: none; } /* Solo iconos */
    .nav-link { justify-content: center; width: 100%; }
    .app-content { padding: 20px; padding-bottom: 90px; }
    .grid-dashboard { grid-template-columns: 1fr; }
}

@keyframes spin { to { transform: rotate(360deg); } }