:root {
    --primary: #4f46e5;       /* Indigo */
    --primary-dark: #3730a3;
    --accent: #06b6d4;        /* Cyan */
    --bg-body: #f3f4f6;       
    --surface: #ffffff;
    --text-main: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --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: hidden; /* Evitar scroll global si es posible */
}

.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: 1600px;
    display: flex; flex-direction: column; gap: 15px; height: 95vh;
}

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

/* Layout */
.main-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    flex-grow: 1;
    overflow: hidden; /* Contener el scroll */
}
@media (max-width: 950px) { .main-grid { grid-template-columns: 1fr; overflow-y: auto; } }

/* --- PANEL IZQUIERDO --- */
.panel {
    background: var(--surface); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,0.5);
}

.config-panel {
    overflow-y: auto; 
    padding-right: 10px;
    display: flex; flex-direction: column; gap: 20px;
}
.config-panel::-webkit-scrollbar { width: 5px; }
.config-panel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.panel-header h2 {
    font-size: 0.85rem; color: var(--primary); margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px; font-weight: 700; text-transform: uppercase;
}
.separator { border: 0; border-top: 1px solid var(--border); margin: 0; }

.status-text { font-size: 0.75rem; color: var(--text-light); font-style: italic; margin-top: 5px; }

/* Inputs */
.input-group { margin-bottom: 10px; }
.row-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-light); margin-bottom: 4px; }
.sub-label { font-size: 0.75rem; font-weight: 700; color: var(--text-main); margin-bottom: 6px; display: block; }

input[type="number"], select {
    width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
    font-family: inherit; font-size: 0.85rem; background-color: #f9fafb;
}
input:focus, select:focus { outline: none; border-color: var(--primary); background: white; }

.file-input { font-size: 0.75rem; padding: 4px; }
input[type="file"]::file-selector-button {
    margin-right: 8px; border: none; background: var(--primary); padding: 4px 8px; border-radius: 4px;
    color: #fff; cursor: pointer; font-size: 0.75rem;
}

.select-wrapper { position: relative; }
.select-wrapper i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-light); font-size: 0.7rem; }
select { appearance: none; cursor: pointer; }

/* Rangos */
.range-group { background: #f8fafc; padding: 8px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 10px; }
.range-row { display: flex; align-items: center; gap: 5px; margin-bottom: 5px; }
.range-row span { font-size: 0.8rem; color: var(--text-light); width: 20px; }
.range-row .placeholder-val { font-size: 0.75rem; color: var(--text-light); flex-grow: 1; text-align: center; font-style: italic; }
.small-input { width: 70px !important; text-align: right; }
.color-mini { width: 30px; height: 28px; padding: 0; border: none; cursor: pointer; border-radius: 4px; }
.color-input.full-width { width: 100%; height: 32px; padding: 2px; border-radius: 6px; border: 1px solid var(--border); }

.highlight-section { background: #eff6ff; border: 1px solid #bfdbfe; }

/* Botones */
.btn-primary {
    width: 100%; padding: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; border: none; border-radius: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s; display: flex; justify-content: center; align-items: center; gap: 8px;
}
.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: 8px 14px; border-radius: 6px;
    font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px; justify-content: center;
}
.btn-secondary:hover { background: var(--bg-body); border-color: var(--primary); color: var(--primary); }
.full-width { width: 100%; }

/* --- PANEL DERECHO --- */
.right-column { display: flex; flex-direction: column; gap: 15px; overflow: hidden; }

/* Pestañas */
.tabs-nav {
    display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px;
}
.tab-link {
    background: rgba(255,255,255,0.6); border: none; padding: 10px 15px; border-radius: 8px 8px 0 0;
    color: var(--text-light); font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.tab-link:hover { background: rgba(255,255,255,0.9); color: var(--primary); }
.tab-link.active { background: var(--surface); color: var(--primary); box-shadow: 0 -2px 5px rgba(0,0,0,0.05); }
.highlight-tab { color: var(--primary); }

/* Canvas Panel */
.canvas-panel {
    flex-grow: 1; position: relative; background: #e5e7eb; padding: 0;
    display: flex; flex-direction: column; overflow: hidden;
}

.view-content {
    display: none; width: 100%; height: 100%;
    justify-content: center; align-items: center; position: relative;
}
.view-content.active { display: flex; }

.canvas-panel canvas {
    max-width: 100%; max-height: 100%; background: white; box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.chart-wrapper { width: 90%; height: 90%; background: white; padding: 10px; border-radius: 8px; }

/* Overlays */
.info-overlay {
    position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    background: rgba(255,255,255,0.8); padding: 5px 10px; border-radius: 20px;
    font-size: 0.75rem; color: var(--text-light); pointer-events: none; backdrop-filter: blur(4px);
}

.action-overlay {
    position: absolute; bottom: 20px; right: 20px; pointer-events: auto;
}
.floating { box-shadow: 0 4px 15px rgba(0,0,0,0.2); }

.actions-container { display: flex; justify-content: flex-end; }

footer { text-align: center; color: var(--text-light); font-size: 0.75rem; margin-top: auto; flex-shrink: 0; }