/* ==========================================================================
   LABORATORIO GEOLÓGICO - ESTILOS PRINCIPALES (DISEÑO PREMIUM OSCURO)
   ========================================================================== */

:root {
    --bg-main: #07090e;
    --bg-card: #0d121c;
    --border-color: #1a2538;
    --text-primary: #f1f5f9;
    --text-secondary: #7f8e9e;
    
    --neon-blue: #00d2ff;
    --neon-green: #00f5a0;
    --neon-gold: #ffbe0b;
    --neon-red: #ff2a5f;
    
    --font-family: 'Space Grotesk', sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 15px 35px rgba(0, 0, 0, 0.7);
}

/* Reset y Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

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

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 2px dashed rgba(255,255,255,0.05);
}

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

.geology-icon {
    font-size: 2.2rem;
    color: var(--neon-blue);
    text-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
}

.header-logo h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

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

/* Workspace Grid (Doble panel) */
.workspace-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
}

@media (min-width: 900px) {
    .workspace-grid {
        grid-template-columns: 1fr 1.3fr;
    }
}

/* Panel Card */
.panel-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}

.panel-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background: rgba(0, 210, 255, 0.08);
    border: 1px solid rgba(0, 210, 255, 0.2);
    color: var(--neon-blue);
    border-radius: 20px;
    padding: 2px 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge.green {
    background: rgba(0, 245, 160, 0.08);
    border-color: rgba(0, 245, 160, 0.2);
    color: var(--neon-green);
}

/* ==========================================================================
   MICROSCOPIO PETROGRÁFICO
   ========================================================================== */
.microscope-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Eyepiece / Ocular */
.eyepiece-circle {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 8px solid #1a2233;
    outline: 2px solid var(--border-color);
    box-shadow: inset 0 0 35px rgba(0,0,0,0.95), 0 8px 24px rgba(0,0,0,0.6);
    position: relative;
    overflow: hidden;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Cruz de hilos reticulares */
.reticle-line {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.3);
    z-index: 5;
    pointer-events: none;
}

.reticle-line.vert {
    width: 1px;
    height: 100%;
    left: 50%;
    top: 0;
    border-left: 1px dashed rgba(255, 255, 255, 0.4);
}

.reticle-line.horiz {
    width: 100%;
    height: 1px;
    top: 50%;
    left: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.4);
}

/* Vista de lente de roca */
.lens-view {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.lens-view img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center center;
    transition: transform 0.05s linear;
}

/* Dial metálico de control */
.dial-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.dial-bezel {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d283c 0%, #0d121c 100%);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.4), inset 0 0 10px rgba(0,0,0,0.8);
    position: relative;
}

.dial-knob {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #2a3852 0%, #151d2a 90%);
    border: 3px solid #000;
    position: relative;
    cursor: grab;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5), inset 0 0 8px rgba(255,255,255,0.08);
}

.dial-knob:active {
    cursor: grabbing;
}

/* Indicador de aguja/puntero */
.dial-marker {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 25px;
    background-color: var(--neon-blue);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--neon-blue);
}

.dial-labels {
    display: flex;
    justify-content: space-between;
    width: 150px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Datos ópticos */
.optical-data-panel {
    width: 100%;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.data-row strong {
    color: #fff;
}

.status-bright {
    color: var(--neon-green) !important;
}

.status-extinct {
    color: var(--neon-red) !important;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==========================================================================
   VISOR 3D (THREE.JS)
   ========================================================================== */
.canvas-3d-container {
    flex: 1;
    position: relative;
    background: #06090e;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    min-height: 480px;
    overflow: hidden;
}

#canvas-3d {
    width: 100%;
    height: 100%;
    display: block;
}

/* Drag and drop overlay */
.drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 9, 14, 0.92);
    border: 2px dashed rgba(0, 210, 255, 0.25);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    text-align: center;
    padding: 24px;
    z-index: 10;
    transition: var(--transition);
}

.drop-overlay.dragover {
    background: rgba(0, 210, 255, 0.05);
    border-color: var(--neon-blue);
}

.upload-icon {
    font-size: 4rem;
    color: var(--neon-blue);
    animation: pulseIcon 2s infinite;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

.drop-help-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.drop-help-text code {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Controles flotantes de Three.js */
.viewer-controls {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none; /* Let clicks pass where not on buttons */
}

.control-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    pointer-events: auto;
}

.toggle-btn {
    background: rgba(13, 18, 28, 0.85);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
    transition: var(--transition);
}

.toggle-btn:hover {
    border-color: var(--neon-blue);
    background: rgba(0, 210, 255, 0.08);
}

.toggle-btn.active {
    background: var(--neon-blue);
    color: #000;
    border-color: #000;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.toggle-btn.reset:hover {
    border-color: var(--neon-green);
    background: rgba(0, 245, 160, 0.08);
}

.toggle-btn.reset-file:hover {
    border-color: var(--neon-gold);
    background: rgba(255, 190, 11, 0.08);
}

/* Leyenda */
.legend-box {
    align-self: flex-start;
    background: rgba(13, 18, 28, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    max-width: 250px;
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.legend-box h4 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--neon-blue);
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 4px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 100px;
    overflow-y: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.3);
    flex-shrink: 0;
}

/* Tooltip 3D flotante */
.tooltip-3d {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(13, 18, 28, 0.92);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    width: 200px;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(4px);
    z-index: 5;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.tooltip-3d h4 {
    font-size: 0.85rem;
    color: var(--neon-blue);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.tooltip-body p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tooltip-body strong {
    color: #fff;
}

.hidden {
    display: none !important;
}
