/* ============================================================
   Smart Home IoT Dashboard — Design Tokens
   Variables CSS, temas oscuro/claro, tipografía, colores
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* ── Tipografía ─────────────────────────────── */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* ── Modo Oscuro (default) ──────────────────── */
    --bg-body: #060912;
    --bg-primary: #0b1120;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.85);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-sidebar: #0a0f1e;
    --bg-header: rgba(11, 17, 32, 0.92);
    --bg-input: rgba(30, 41, 59, 0.6);
    --bg-tooltip: rgba(15, 23, 42, 0.95);

    --border-color: rgba(255, 255, 255, 0.06);
    --border-active: rgba(59, 130, 246, 0.4);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-heading: #e2e8f0;

    /* ── Colores Funcionales ────────────────────── */
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.25);
    --accent-blue-soft: rgba(59, 130, 246, 0.12);

    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.25);
    --accent-green-soft: rgba(16, 185, 129, 0.12);

    --accent-yellow: #f59e0b;
    --accent-yellow-glow: rgba(245, 158, 11, 0.25);
    --accent-yellow-soft: rgba(245, 158, 11, 0.12);

    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.25);
    --accent-red-soft: rgba(239, 68, 68, 0.12);

    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.25);
    --accent-purple-soft: rgba(139, 92, 246, 0.12);

    --accent-cyan: #06b6d4;
    --accent-cyan-glow: rgba(6, 182, 212, 0.25);
    --accent-cyan-soft: rgba(6, 182, 212, 0.12);

    --accent-orange: #f97316;
    --accent-orange-glow: rgba(249, 115, 22, 0.25);

    --accent-pink: #ec4899;

    /* ── Gradientes ─────────────────────────────── */
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --gradient-green: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-red: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-card: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
    --gradient-sidebar: linear-gradient(180deg, #0a0f1e 0%, #0d1425 100%);

    /* ── Sombras ────────────────────────────────── */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
    --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.3);
    --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.3);

    /* ── Bordes ─────────────────────────────────── */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* ── Transiciones ──────────────────────────── */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ── Espaciado ─────────────────────────────── */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;

    /* ── Scrollbar ─────────────────────────────── */
    --scrollbar-thumb: rgba(100, 116, 139, 0.3);
    --scrollbar-track: transparent;
}

/* ── Tema Claro ───────────────────────────────────────── */
[data-theme="light"] {
    --bg-body: #f0f2f5;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(248, 250, 252, 1);
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-sidebar: #ffffff;
    --bg-header: rgba(248, 250, 252, 0.92);
    --bg-input: rgba(241, 245, 249, 0.8);
    --bg-tooltip: rgba(15, 23, 42, 0.9);

    --border-color: rgba(0, 0, 0, 0.08);
    --border-active: rgba(59, 130, 246, 0.5);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-heading: #0f172a;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);

    --gradient-card: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(248,250,252,0.8) 100%);
    --gradient-sidebar: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);

    --scrollbar-thumb: rgba(100, 116, 139, 0.2);
}

/* ── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Scrollbar Custom ─────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.5);
}

/* ── Selection ────────────────────────────────────────── */
::selection {
    background: var(--accent-blue);
    color: white;
}

/* ── Animaciones Globales ─────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 5px currentColor; }
    50% { box-shadow: 0 0 20px currentColor, 0 0 40px currentColor; }
}

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

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

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

/* ── Utility Classes ──────────────────────────────────── */
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-yellow { color: var(--accent-yellow); }
.text-blue { color: var(--accent-blue); }
.text-purple { color: var(--accent-purple); }
.text-cyan { color: var(--accent-cyan); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.bg-green-soft { background: var(--accent-green-soft); }
.bg-red-soft { background: var(--accent-red-soft); }
.bg-yellow-soft { background: var(--accent-yellow-soft); }
.bg-blue-soft { background: var(--accent-blue-soft); }
.bg-purple-soft { background: var(--accent-purple-soft); }

.animate-fade { animation: fadeIn var(--transition-slow) ease forwards; }
.animate-fade-up { animation: fadeInUp 0.5s ease forwards; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-bounce { animation: bounceIn 0.6s ease forwards; }
