/* --- Variables y Reset --- */
:root {
    --bg-color: #050505;
    --card-bg: #111;
    --card-inner: #1a1a1a;
    --text-primary: #eee;
    --text-secondary: #888;
    --accent-usd: #2ecc71;
    --accent-eur: #f1c40f;
    --border-color: #222;
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

/* --- Contenedor Principal --- */
.app {
    width: 90%;
    max-width: 340px;
    background: var(--card-bg);
    padding: 25px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    position: relative;
    z-index: 1;
}

/* --- Cabecera Flexible --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
}

h1 {
    font-size: 18px;
    color: #fff;
    margin: 0;
    letter-spacing: 1px;
    font-weight: 800;
    text-transform: uppercase;
}

/* --- Botón de WhatsApp Sutil --- */
.btn-compact {
    width: 40px;
    height: 40px;
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.3);
    color: #25D366;
    border-radius: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    cursor: pointer;
    transition: 0.2s;
}

.btn-compact svg.icon-share {
    position: absolute;
    top: 5px;
    right: 5px;
    opacity: 0.6;
    width: 10px;
    height: 10px;
}

.btn-compact:hover {
    background: rgba(37, 211, 102, 0.2);
}

.btn-compact:active {
    transform: scale(0.9);
}

/* --- Tarjetas de Tasas --- */
.card {
    background: var(--card-inner);
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 15px;
    border-left: 5px solid #333;
    transition: transform 0.3s ease;
    text-align: center;
}

.card:hover { transform: translateY(-2px); }
.usd { border-color: var(--accent-usd); }
.eur { border-color: var(--accent-eur); }

.label {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    font-weight: bold;
    display: block;
}

.value {
    font-size: 28px;
    font-weight: bold;
    margin: 5px 0;
    color: #fff;
    display: block;
}

/* --- Botones de Acción --- */
.actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

button:not(.btn-compact) {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: #fff;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
}

button.secondary {
    background: #222;
    color: #fff;
    border: 1px solid #333;
}

button:active {
    transform: scale(0.96);
    opacity: 0.8;
}

/* --- Estado y Consola --- */
.status-bar {
    font-size: 11px;
    color: #555;
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

.online { background: var(--accent-usd); box-shadow: 0 0 8px var(--accent-usd); }
.loading { background: var(--accent-eur); box-shadow: 0 0 8px var(--accent-eur); }

.console {
    margin-top: 20px;
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #0f0;
    text-align: left;
    height: 60px;
    overflow-y: auto;
    line-height: 1.4;
}

/* --- Modal y Calculadora --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.calc-content { 
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: var(--card-inner);
    border-radius: 30px 30px 0 0; 
    padding: 30px 20px;
    box-sizing: border-box;
    border-top: 1px solid #333;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

.modal.active .calc-content {
    transform: translateY(0);
}

.drag-handle {
    width: 40px;
    height: 5px;
    background: #333;
    border-radius: 10px;
    margin: 0 auto 20px;
}

.calc-grid { display: flex; flex-direction: column; gap: 15px; }

input, select { 
    width: 100%;
    padding: 15px;
    background: #111;
    border: 1px solid #333; 
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    box-sizing: border-box;
    outline: none;
}

.res-box { 
    background: #000;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px dashed #444;
    margin: 10px 0;
}

.res-val { font-size: 24px; font-weight: bold; color: var(--accent-usd); }

.main-footer {
    margin-top: 30px;
    font-size: 10px;
    color: #666;
    text-align: center;
}

.maint-overlay {
    position: fixed;
    inset: 0; /* Cubre toda la pantalla */
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: sans-serif;
}

/* LA REGLA MÁGICA: Si tiene la clase 'oculto', desaparece */
.maint-overlay.oculto {
    display: none;
}

.maint-card {
    background: #111;
    border: 1px solid #333;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.maint-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #333;
    border-top-color: #007bff;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

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

.maint-card h1 { margin: 0 0 10px 0; font-size: 1.4rem; }
.maint-card p { color: #888; margin-bottom: 20px; }
.maint-card strong { color: #007bff; }
.maint-card span { font-size: 0.8rem; color: #444; text-transform: uppercase; }