/**
 * Estilos específicos para la Calculadora de GAP Minetti
 * Estándar visual Fijate Tools - Midnight Slate
 */

:root {
    --bg-page: #0b0f17;
    --bg-card: #131a26;
    --bg-card-hover: #1a2333;
    --bg-input: #1b2434;
    --border-color: #232d3f;
    --border-focus: #3b82f6;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #10b981;
    --accent-blue: #3b82f6;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease-in-out;
}

body.theme-light {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --border-color: #e2e8f0;
    --border-focus: #2563eb;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
}

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

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

.font-bold {
    font-weight: 700;
}

/* 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%;
}

/* Pestañas de modo */
.mode-tabs-container {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.35rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 42px;
    transition: var(--transition);
}

.mode-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.mode-tab.active {
    background: var(--accent-blue);
    color: #ffffff;
    font-weight: 600;
}

/* Tarjetas */
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Formulario e inputs */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

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

.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-split {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-split input {
    flex: 1 1 0%;
    width: 0;
    min-width: 0;
}

.input-split span {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 600;
}

.input-control, select.input-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    padding: 0.6rem 0.85rem;
    min-height: 42px;
    box-sizing: border-box;
    width: 100%;
    transition: var(--transition);
}

select.input-control {
    appearance: none;
    -webkit-appearance: none;
    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='%2394a3b8' 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 14px center;
    padding-right: 40px;
}

.input-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Slider de pendiente */
.slope-slider-container {
    margin-top: 0.5rem;
}

.slope-range {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
    min-height: 24px;
}

.slope-markers {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 0.25rem;
}

/* Presets de pendiente */
.slope-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.btn-preset-slope {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    transition: var(--transition);
}

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

/* Tipo de pendiente (radio group) */
.radio-toggle-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Cuadrícula de KPIs */
.kpi-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.kpi-card.kpi-main {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.08));
    border-color: rgba(16, 185, 129, 0.3);
}

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

.kpi-value {
    font-family: var(--font-mono);
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.kpi-card.kpi-main .kpi-value {
    color: var(--accent);
}

.kpi-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

.kpi-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 600;
}

.badge-high {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-low {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

/* Gráfico Canvas */
.canvas-container {
    width: 100%;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
}

.canvas-container canvas {
    display: block;
    width: 100%;
}

/* Tarjetas de consejo biomecánico */
.advice-card {
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.advice-card p {
    margin: 0.5rem 0 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.advice-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.alert-extreme {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
}
.alert-high {
    background: rgba(245, 158, 11, 0.08);
    border-color: #f59e0b;
}
.alert-moderate {
    background: rgba(59, 130, 246, 0.08);
    border-color: #3b82f6;
}
.alert-optimal {
    background: rgba(16, 185, 129, 0.08);
    border-color: #10b981;
}
.alert-downhill-heavy {
    background: rgba(139, 92, 246, 0.08);
    border-color: #8b5cf6;
}

/* Tabla de equivalencias */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

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

.data-table th {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.data-table tr.row-highlight {
    background: rgba(59, 130, 246, 0.12);
    font-weight: 600;
}

.data-table tr.row-base {
    background: rgba(16, 185, 129, 0.08);
}

.table-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-red { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-orange { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }

/* Tabla de tramos */
.input-table {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    width: 70px;
}

.btn-remove-seg {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}

.btn-remove-seg:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.totals-summary-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.total-item {
    display: flex;
    flex-direction: column;
}

.total-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.total-val {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Botones de acción */
.action-buttons-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 42px;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--accent);
    color: #0b0f17;
}

.btn-primary:hover {
    background: #0ea5e9;
    color: #ffffff;
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

/* Bloque explicativo SEO */
.seo-guide-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 2rem;
    line-height: 1.7;
}

.seo-guide-section h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.seo-guide-section h2:first-child {
    margin-top: 0;
}

.seo-guide-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.seo-guide-section ul {
    color: var(--text-secondary);
    padding-left: 1.25rem;
    margin-bottom: 1.25rem;
}

.seo-guide-section li {
    margin-bottom: 0.4rem;
}

.formula-box {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.95rem;
    overflow-x: auto;
    margin: 1rem 0;
}

/* Modal */
.app-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.app-modal.is-active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.modal-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 2;
    padding: 1.75rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.modal-header h3 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text-primary);
}

.btn-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
}

.btn-modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .mode-tabs-container {
        flex-direction: column;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .kpi-results-grid {
        grid-template-columns: 1fr;
    }
    .kpi-value {
        font-size: 1.8rem;
    }
}
