:root {
    --primary: #4f46e5;       
    --primary-dark: #3730a3;
    --accent: #06b6d4;        
    --bg-body: #f3f4f6;       
    --surface: #ffffff;
    --text-main: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;
}

/* Fondo decorativo */
.background-decor {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 300px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    z-index: -1;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 0 100%);
}

.app-wrapper {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header { text-align: center; color: white; margin-bottom: 10px; }
.logo-area { display: flex; justify-content: center; align-items: center; gap: 15px; margin-bottom: 5px; }
.logo-icon { font-size: 2rem; opacity: 0.9; }
h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -1px; text-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.subtitle { font-size: 1.1rem; font-weight: 300; opacity: 0.9; }

/* Layout Principal */
.main-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 25px;
}
@media (max-width: 850px) { .main-grid { grid-template-columns: 1fr; } }

/* Paneles */
.panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.5);
}
.panel-header h2 {
    font-size: 1.1rem; color: var(--primary); margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 2px solid var(--bg-body); padding-bottom: 10px;
}

/* Inputs y Botones (Mismo estilo anterior) */
.input-group { margin-bottom: 15px; }
.row-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-light); margin-bottom: 6px; }
input[type="number"], select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-family: inherit; font-size: 0.95rem; transition: all 0.2s; background-color: #f9fafb;
}
input[type="number"]:focus, select:focus { outline: none; border-color: var(--primary); background-color: white; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
.select-wrapper { position: relative; }
.select-wrapper i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-light); font-size: 0.8rem; }
select { appearance: none; cursor: pointer; }

/* Toggle */
.toggle-container { display: flex; background: var(--bg-body); padding: 4px; border-radius: 8px; border: 1px solid var(--border); }
.toggle-container input { display: none; }
.toggle-container label {
    flex: 1; text-align: center; padding: 8px; margin: 0; border-radius: 6px; cursor: pointer;
    font-size: 0.85rem; transition: all 0.2s; color: var(--text-light);
}
.toggle-container input:checked + label { background: white; color: var(--primary); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Botones */
.btn-primary {
    width: 100%; padding: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; border: none; border-radius: 8px; font-weight: 600; font-size: 1rem; cursor: pointer; margin-top: 10px;
    transition: transform 0.2s, box-shadow 0.2s; display: flex; justify-content: center; align-items: center; gap: 10px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }
.btn-secondary {
    background: white; border: 1px solid var(--border); color: var(--text-main); padding: 10px 18px; border-radius: 8px;
    font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 8px;
}
.btn-secondary:hover { background: var(--bg-body); border-color: var(--text-light); }

/* --- COLUMNA DERECHA --- */
.right-column { display: flex; flex-direction: column; gap: 20px; }

/* 1. PARÁMETROS ESTADÍSTICOS (Resaltados Arriba) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}
@media (max-width: 768px) { .stats-grid { grid-template-columns: 1fr 1fr; } }

.stat-card {
    padding: 15px;
    border-radius: var(--radius);
    color: white;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-card.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-card.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-card.pink { background: linear-gradient(135deg, #ec4899, #db2777); }

.stat-label { font-size: 0.75rem; letter-spacing: 0.5px; opacity: 0.9; margin-bottom: 5px; }
.stat-value { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }


/* 2. RESULTADOS N (Abajo, más discretos) */
.n-results-container {
    display: flex;
    gap: 15px;
    background: rgba(255,255,255,0.7);
    padding: 15px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
@media (max-width: 600px) { .n-results-container { flex-direction: column; } }

.n-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--border);
}
.n-card.final {
    border: 2px solid var(--success);
    background: #f0fdf4;
    position: relative;
    overflow: hidden;
}
.n-label { font-size: 0.75rem; color: var(--text-light); margin-bottom: 2px; }
.n-value { font-size: 1.3rem; font-weight: 700; color: var(--text-main); }
.n-card.final .n-value { color: #166534; font-size: 1.5rem; }
.n-icon { position: absolute; right: 8px; bottom: 8px; font-size: 1.5rem; color: var(--success); opacity: 0.2; }

/* Info y Gráfico */
.info-note { background: #eff6ff; color: #1d4ed8; padding: 10px; border-radius: 6px; font-size: 0.85rem; text-align: center; }
.chart-panel { flex-grow: 1; min-height: 400px; padding: 10px; display: flex; flex-direction: column; }
#powerCurveChart { width: 100%; flex-grow: 1; min-height: 380px; }
.actions-bar { display: flex; justify-content: flex-end; gap: 10px; }
.error-box { margin-top: 15px; padding: 10px; background: #fef2f2; color: #ef4444; border-left: 4px solid #ef4444; border-radius: 4px; font-size: 0.9rem; display: none; }

footer { text-align: center; color: var(--text-light); font-size: 0.85rem; margin-top: 20px; padding-bottom: 10px; font-weight: 500; }