/* --- SISTEMA DE DISEÑO: ESCALA DE ESPACIADO DE 8 PUNTOS --- */
:root {
    --s1: 4px;
    --s2: 8px;
    --s3: 16px;
    --s4: 24px;
    --s5: 32px;
    --s6: 48px;
    --s7: 64px;

    /* PALETA FINANCIERA - MODO CLARO (Regla 60-30-10) */
    --bg: #f8fafc;           /* 60% Fondo general tecnológico */
    --surface: #ffffff;      /* 30% Superficies / Tarjetas */
    --surface-2: #f1f5f9;    /* Elementos secundarios */
    --ink: #0f172a;          /* Texto principal */
    --muted: #64748b;        /* Texto secundario */
    --accent: #059669;       /* 10% Acento Financiero (Verde Éxito / Trading) */
    --accent-hover: #047857; /* Color al pasar el mouse */
    --border: #e2e8f0;       /* Líneas sutiles */
    --success: #10b981;      /* Variación positiva */
    --danger: #ef4444;       /* Variación negativa */
}

/* --- PALETA FINANCIERA - MODO OSCURO (Estilo Terminal / Trading) --- */
body.dark-mode {
    --bg: #030712;           /* Fondo negro/azulado ultra profundo tipo terminal */
    --surface: #0f172a;      /* Tarjetas en azul oscuro elegante */
    --surface-2: #1e293b;    /* Elementos secundarios */
    --ink: #f8fafc;          /* Texto principal brillante */
    --muted: #94a3b8;        /* Texto secundario */
    --accent: #34d399;       /* Acento verde esmeralda brillante en modo oscuro */
    --accent-hover: #10b981; 
    --border: #1e293b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

/* --- CABECERA (NAVEGACIÓN) --- */
.nav {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background-color 0.3s;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--s3) var(--s4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: var(--s2);
    letter-spacing: -0.01em;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

/* --- CONTENEDOR PRINCIPAL (Retícula centrada) --- */
.main-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: var(--s5) var(--s4);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--s4);
}

.hero-section {
    text-align: center;
    margin-bottom: var(--s2);
}

.hero-section h1 {
    font-size: clamp(26px, 4vw, 38px);
    margin-bottom: var(--s2);
    letter-spacing: -0.02em;
    font-weight: 800;
}

.hero-section h1 em {
    color: var(--accent);
    font-style: normal;
}

.lead {
    color: var(--muted);
    font-size: 15px;
    max-width: 600px;
    margin: 0 auto;
}

/* --- BARRA DE BÚSQUEDA --- */
.search-section {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.search-section input {
    width: 100%;
    padding: var(--s3);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background-color: var(--surface);
    color: var(--ink);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, background-color 0.3s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.search-section input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* --- RETÍCULA DE TARJETAS (Grid de 12 columnas adaptable) --- */
.crypto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--s4);
    margin-top: var(--s2);
}

/* Estilo individual de cada tarjeta de criptomoneda */
.crypto-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: var(--s4);
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s, border-color 0.3s;
}

.crypto-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.08);
    border-color: var(--accent);
}

.crypto-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.crypto-name h3 {
    font-size: 16px;
    font-weight: 700;
}

.crypto-symbol {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    background-color: var(--surface-2);
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.05em;
}

.crypto-price {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.crypto-change {
    font-size: 13px;
    font-weight: 600;
}

.crypto-change.positive {
    color: var(--success);
}

.crypto-change.negative {
    color: var(--danger);
}

.loading-text, .error-text {
    text-align: center;
    grid-column: 1 / -1;
    color: var(--muted);
    padding: var(--s6);
    font-size: 15px;
}

/* --- BOTÓN MODO OSCURO --- */
.btn-modo {
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: var(--s2) var(--s3);
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    background-color: var(--surface-2);
    color: var(--ink);
    transition: all 0.2s;
}

.btn-modo:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* --- FOOTER PROFESIONAL --- */
.footer-principal {
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: var(--s4);
    font-size: 13px;
    color: var(--muted);
    transition: background-color 0.3s;
}
/* --- ESTILOS DEL MODAL DE DETALLES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: var(--s5);
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.btn-cerrar {
    position: absolute;
    top: var(--s3);
    right: var(--s3);
    background: var(--surface-2);
    border: none;
    color: var(--ink);
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

.btn-cerrar:hover {
    background-color: var(--danger);
    color: white;
}

.crypto-card {
    cursor: pointer; /* Cambia el cursor para indicar que se puede hacer clic */
}

.modal-detalle-grid {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    margin-top: var(--s3);
}

.detalle-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: var(--s2);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}