/**
 * Estilos específicos para Simulador de Batería Virtual vs Batería Física
 * Fijate Tools
 */

:root {
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Colores temáticos */
    --color-primary: #0284c7;
    --color-primary-hover: #0369a1;
    --color-vb: #06b6d4;
    --color-physical: #f59e0b;
    --color-wallet: #10b981;
    --color-danger: #ef4444;

    /* Superficies y bordes (tema claro por defecto) */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-heading: #1e293b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-page: #0b0f17;
    --bg-card: #131b2b;
    --bg-input: #1a2438;
    --border-color: #243048;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-heading: #ffffff;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* Reset y base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-page);
    color: var(--text-main);
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, .brand-title, .calc-title, .section-title {
    font-family: var(--font-heading);
    color: var(--text-heading);
    letter-spacing: -0.02em;
}

.text-mono {
    font-family: var(--font-mono);
}

/* Layout canónico */
.tool-layout {
    max-width: 1200px;
    margin: 1.5rem auto 3rem;
    padding: 0 1rem;
    box-sizing: border-box;
    flex: 1 0 auto;
    width: 100%;
}

.tool-with-sidebar {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    width: 100%;
}

.tool-main-content {
    flex: 1 1 0%;
    min-width: 0;
    width: 100%;
}

/* Tarjeta contenedora de la herramienta */
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}

@media (max-width: 640px) {
    .tool-card {
        padding: 1.25rem;
    }
}

.tool-header-block {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.25rem;
}

.calc-title {
    font-size: 1.6rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.calc-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Presets rápidos */
.presets-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.btn-preset {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}

.btn-preset:hover, .btn-preset.active {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

/* Grid de configuración del formulario */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-heading);
}

.field-hint {
    font-size: 0.775rem;
    color: var(--text-muted);
}

.input-with-unit {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.input-with-unit input[type="number"] {
    flex: 1 1 0%;
    width: 0;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0.65rem 0.85rem;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text-main);
    min-height: 40px;
}

.input-unit {
    padding: 0 0.85rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.03);
    height: 100%;
    display: flex;
    align-items: center;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--color-primary);
    cursor: pointer;
    margin-top: 0.25rem;
}

select.custom-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    padding: 0.65rem 2.5rem 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-input);
    color: var(--text-main);
    border-radius: 0.5rem;
    font-family: var(--font-main);
    font-size: 0.9rem;
    min-height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 16px;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.875rem;
    user-select: none;
    min-height: 40px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* Veredicto de diagnóstico */
.verdict-banner {
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    border-left: 5px solid transparent;
}

.verdict-warning {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: var(--color-physical);
}

.verdict-info {
    background: rgba(6, 182, 212, 0.08);
    border-left-color: var(--color-vb);
}

.verdict-success {
    background: rgba(16, 185, 129, 0.08);
    border-left-color: var(--color-wallet);
}

.verdict-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.4rem 0;
}

.verdict-desc {
    margin: 0;
    font-size: 0.925rem;
    line-height: 1.55;
    color: var(--text-main);
}

/* Grid de resultados y KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.2rem;
    text-align: center;
}

.kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    display: block;
}

.kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-heading);
    margin: 0;
}

.text-vb { color: var(--color-vb) !important; }
.text-phys { color: var(--color-physical) !important; }
.text-wallet { color: var(--color-wallet) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-physical) !important; }
.text-success { color: var(--color-wallet) !important; }

/* Contenedor de gráfica Canvas */
.chart-container-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.chart-title {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 700;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    min-height: 280px;
}

canvas#projection-chart {
    width: 100%;
    height: 320px;
    display: block;
}

/* Tabla mensual interactiva */
.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table th {
    background: var(--bg-input);
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-heading);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

/* Botón de acción para informe */
.action-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s ease;
    min-height: 44px;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
}

.btn-icon-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-textarea {
    width: 100%;
    height: 240px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    resize: vertical;
    box-sizing: border-box;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Guía SEO y acordeones FAQ */
.seo-guide-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.seo-guide-title {
    font-size: 1.5rem;
    margin: 0 0 1rem 0;
}

.seo-guide-content p {
    line-height: 1.7;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.faq-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-input);
    overflow: hidden;
}

.faq-question {
    padding: 1rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-heading);
}

.faq-answer {
    padding: 0 1rem 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.925rem;
}
