/* ═══════════════════════════════════════════════════════════════════════════
   GeoStats Lab - Estilos CSS Completos
   Incluye: Editor, Interpolación 2D, Terreno 3D, Teoría
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-elevated: #21262d;
    --bg-hover: #30363d;
    
    --accent-cyan: #00d4ff;
    --accent-green: #3fb950;
    --accent-purple: #a371f7;
    --accent-orange: #f0883e;
    --accent-red: #f85149;
    --accent-yellow: #d29922;
    
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    --border-default: #30363d;
    --border-muted: #21262d;
    
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Outfit', sans-serif;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Layout Principal
   ═══════════════════════════════════════════════════════════════════════════ */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-default);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 40px;
    height: 40px;
}

.logo-text h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

.logo-text span {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.header-info {
    display: flex;
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}

.info-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

/* Navigation Tabs */
.main-nav {
    display: flex;
    gap: 4px;
    padding: 8px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-default);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.nav-tab.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.tab-icon {
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Tab 1: Editor
   ═══════════════════════════════════════════════════════════════════════════ */

.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.editor-panel, .preview-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-default);
}

.panel-header {
    margin-bottom: 16px;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.panel-header p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 14px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.control-group input[type="range"] {
    width: 80px;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-dark);
    border-radius: 3px;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-cyan);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-cyan);
}

.value-display {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-cyan);
    min-width: 35px;
}

.mode-buttons {
    display: flex;
    gap: 4px;
}

.mode-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
    font-family: var(--font-sans);
    background: var(--bg-dark);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--text-primary);
}

.mode-btn.active {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.action-btn {
    padding: 7px 12px;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-cyan);
}

.action-btn.danger:hover {
    background: rgba(248, 81, 73, 0.15);
    border-color: var(--accent-red);
}

.action-btn.full-width {
    width: 100%;
    margin-top: 10px;
}

/* Grid Container */
.grid-container, .preview-canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-dark);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-default);
    cursor: crosshair;
}

.grid-container canvas, .preview-canvas-container canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

.color-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.legend-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.legend-bar {
    flex: 1;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg,
        #1a472a 0%, #2d7d46 15%, #4caf50 30%, #8bc34a 45%,
        #cddc39 55%, #ffeb3b 65%, #ff9800 75%, #e65100 85%,
        #8d4e2a 95%, #ffffff 100%
    );
}

.instructions, .preview-info {
    margin-top: 14px;
    padding: 12px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
}

.instructions h4 {
    color: var(--accent-cyan);
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.instructions ul {
    list-style: none;
    color: var(--text-secondary);
}

.instructions li {
    margin-bottom: 3px;
}

.preview-info p {
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Tab 2: Interpolation 2D
   ═══════════════════════════════════════════════════════════════════════════ */

.section-header {
    text-align: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.3rem;
    margin-bottom: 6px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.interpolation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
}

.interp-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s;
}

.interp-card:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.method-type {
    font-size: 0.6rem;
    padding: 2px 8px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    color: var(--accent-cyan);
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.card-canvas {
    aspect-ratio: 1;
    background: var(--bg-dark);
}

.card-canvas canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

.card-info {
    padding: 10px 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-default);
    background: var(--bg-elevated);
}

.param-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.param-control label {
    color: var(--text-secondary);
}

.param-control input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: var(--bg-dark);
    border-radius: 2px;
}

.param-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent-cyan);
    border-radius: 50%;
}

.param-control span {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    min-width: 30px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Tab 3: Terrain 3D
   ═══════════════════════════════════════════════════════════════════════════ */

.terrain3d-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.terrain3d-controls {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-default);
    overflow-y: auto;
}

.terrain3d-controls h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--accent-cyan);
}

.terrain3d-controls > p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.control-group-3d {
    margin-bottom: 16px;
}

.control-group-3d label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.control-group-3d select,
.control-group-3d input[type="range"] {
    width: 100%;
}

.control-group-3d select {
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.control-group-3d input[type="range"] {
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg-dark);
    border-radius: 3px;
}

.control-group-3d input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-cyan);
    border-radius: 50%;
    cursor: pointer;
}

.control-group-3d span {
    display: inline-block;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-cyan);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-cyan);
}

.controls-help {
    margin-top: 20px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.controls-help h4 {
    font-size: 0.8rem;
    color: var(--accent-cyan);
    margin-bottom: 8px;
}

.controls-help ul {
    list-style: none;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.controls-help li {
    margin-bottom: 4px;
}

.terrain3d-viewport {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    overflow: hidden;
    position: relative;
}

#terrain3dContainer {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#terrain3dContainer:active {
    cursor: grabbing;
}

.viewport-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Tab 4: Theory
   ═══════════════════════════════════════════════════════════════════════════ */

.theory-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.theory-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.theory-tab {
    padding: 10px 16px;
    text-align: left;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.theory-tab.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.theory-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    padding: 30px;
    min-height: 600px;
}

.theory-article {
    display: none;
}

.theory-article.active {
    display: block;
}

.theory-article h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent-cyan);
}

.theory-section {
    margin-bottom: 28px;
}

.theory-section h3 {
    font-size: 1.1rem;
    color: var(--accent-cyan);
    margin-bottom: 12px;
}

.theory-section p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.7;
}

.theory-section ul {
    color: var(--text-secondary);
    margin-left: 20px;
    margin-bottom: 12px;
}

.theory-section li {
    margin-bottom: 6px;
}

.formula-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-left: 4px solid var(--accent-cyan);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin: 16px 0;
}

.formula-box h4 {
    font-size: 0.9rem;
    color: var(--accent-orange);
    margin-bottom: 10px;
}

.formula-box p {
    margin-bottom: 8px;
}

.formula-box blockquote {
    font-style: italic;
    color: var(--text-primary);
    padding-left: 16px;
    border-left: 2px solid var(--accent-purple);
    margin: 12px 0;
}

.formula {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--accent-green);
    background: var(--bg-dark);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin: 10px 0;
    overflow-x: auto;
}

.formula-box ul {
    margin-top: 12px;
}

.method-classification {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.classification-item {
    background: var(--bg-elevated);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}

.classification-item h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.classification-item ul {
    margin-left: 16px;
    margin-bottom: 10px;
}

.classification-item p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.references {
    list-style: none;
    margin-left: 0;
}

.references li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-muted);
    font-size: 0.85rem;
}

.references li em {
    color: var(--accent-cyan);
}

/* Algorithm Steps */
.algorithm-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-cyan);
    color: var(--bg-dark);
    font-weight: 700;
    border-radius: 50%;
    font-size: 0.9rem;
}

.step-content {
    flex: 1;
    background: var(--bg-elevated);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}

.step-content h4 {
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.step-content p {
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.step-content ul {
    margin-left: 16px;
    font-size: 0.85rem;
}

.step-content .formula {
    font-size: 0.85rem;
    padding: 8px 12px;
}

/* Pros and Cons */
.pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.pros, .cons {
    padding: 16px;
    border-radius: var(--radius-md);
}

.pros {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.cons {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.pros h4, .cons h4 {
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.pros ul, .cons ul {
    margin-left: 16px;
    font-size: 0.85rem;
}

/* Parameter Effects */
.parameter-effects {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.effect-item {
    background: var(--bg-elevated);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}

.effect-item h4 {
    font-size: 0.85rem;
    color: var(--accent-orange);
    margin-bottom: 6px;
}

.effect-item p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.variogram-params {
    background: var(--bg-elevated);
    padding: 14px;
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.variogram-params h4 {
    font-size: 0.9rem;
    color: var(--accent-purple);
    margin-bottom: 8px;
}

.variogram-params ul {
    margin-left: 16px;
}

.feature-list {
    list-style: none;
    margin-left: 0;
}

.feature-list li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--accent-green);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════════════════ */

.footer {
    padding: 16px 24px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-default);
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.author {
    font-size: 1rem;
    color: var(--accent-cyan);
    margin-bottom: 4px;
}

.author strong {
    color: var(--text-primary);
}

.app-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    .interpolation-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .theory-layout {
        grid-template-columns: 1fr;
    }
    
    .theory-nav {
        flex-direction: row;
        flex-wrap: wrap;
        position: static;
    }
}

@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
    
    .terrain3d-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .terrain3d-viewport {
        height: 400px;
    }
    
    .method-classification,
    .pros-cons {
        grid-template-columns: 1fr;
    }
    
    .parameter-effects {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }
    
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .interpolation-grid {
        grid-template-columns: 1fr;
    }
    
    .controls-bar {
        flex-direction: column;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}
