/* ================================
   TAB NAVIGATION SYSTEM
   ================================ */

.tab-navigation {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.tab-button {
    flex: 1;
    max-width: 200px;
    padding: 15px 30px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s ease;
}

.tab-button:hover::before {
    left: 0;
}

.tab-button:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}

.tab-button.active {
    color: #ffffff;
    border-bottom-color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* ================================
   TAB CONTENT
   ================================ */

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-in;
    padding-top: 85px; /* Space for fixed tab navigation */
    min-height: 100vh;
    position: relative;
    z-index: 2; /* Por encima de los fondos decorativos */
    overflow-y: auto;
    overflow-x: hidden;
}

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

/* Background específico para cada tab */
#tab-panelito {
    background: #87CEEB; /* Fallback color */
    position: relative;
    overflow: hidden;
}

/* Canvas Background for Animations */
.background-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none; /* Allow clicks to pass through to elements below */
}

/* Canvas Overlay for Panelito Effects */
.panelito-effects-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15; /* Above avatar but below controls */
    pointer-events: none;
}

/* Asegurar que fullscreen-container tenga contexto de posición */
#tab-panelito .fullscreen-container {
    position: relative;
    z-index: 10; /* Above canvas */
}

#tab-experimento {
    background: #f0f2f5;
    position: relative;
}

#tab-juegos {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

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

/* ================================
   SPLIT SCREEN (EXPERIMENTO TAB)
   ================================ */

.split-screen {
    display: flex;
    min-height: calc(100vh - 85px);
    background: transparent; /* Sin background, usa el del tab */
}

.split-left {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-right: 3px solid rgba(255, 255, 255, 0.3);
}

.split-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #ffffff;
    overflow-y: auto;
}

/* Avatar Container (Smaller for Experimento) */
.avatar-container-small {
    transform: scale(0.6);
    transform-origin: center center;
}

.avatar-container-small .avatar-main {
    position: relative;
    margin: 0 auto;
}

/* ================================
   SENSOR INTERFACE
   ================================ */

.sensor-container {
    width: 100%;
    max-width: 700px;
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.sensor-container h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

/* Sensor Controls */
.sensor-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.sensor-button {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    color: #666;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sensor-button:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.sensor-button.primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.sensor-button.primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.sensor-button.secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.sensor-button.secondary:hover {
    background: #545b62;
    border-color: #545b62;
}

.sensor-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Bluetooth Status */
.bluetooth-status {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.bluetooth-status.connected {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.bluetooth-status.disconnected {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

/* Voltage Readings */
.voltage-readings {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.voltage-display {
    flex: 1;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 3px solid;
    min-width: 150px;
}

.voltage-display.sensor1 {
    border-color: #007bff;
}

.voltage-display.sensor2 {
    border-color: #dc3545;
}

.voltage-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

.voltage-value {
    font-size: 32px;
    font-weight: bold;
}

.voltage-display.sensor1 .voltage-value {
    color: #007bff;
}

.voltage-display.sensor2 .voltage-value {
    color: #dc3545;
}

/* Graph Container */
.graph-container {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    overflow: hidden;
}

#sensorCanvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

/* Graph Legend */
.graph-legend {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.legend-color {
    width: 30px;
    height: 4px;
    border-radius: 2px;
}

/* Info Message */
.info-message {
    background: #e7f3ff;
    border: 2px solid #2196F3;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    text-align: center;
}

.info-message p {
    margin: 8px 0;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

.info-message strong {
    color: #2196F3;
}

.info-message code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #d63384;
    font-size: 13px;
}

/* ================================
   COMING SOON PAGE (JUEGOS)
   ================================ */

.coming-soon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 85px);
    color: white;
    text-align: center;
    padding: 40px;
}

.coming-soon-container h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.coming-soon-container p {
    font-size: 20px;
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.coming-soon-icon {
    font-size: 120px;
    margin: 30px 0;
    animation: pulse 2s ease-in-out infinite;
}

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

.coming-soon-subtitle {
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 20px;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

@media (max-width: 1024px) {
    .split-screen {
        flex-direction: column;
        min-height: calc(100vh - 85px);
    }

    .split-left {
        flex: 0 0 auto;
        min-height: 40vh;
        height: auto;
        border-right: none;
        border-bottom: 3px solid rgba(255, 255, 255, 0.3);
    }

    .split-right {
        flex: 1;
        min-height: 60vh;
        height: auto;
    }

    .avatar-container-small {
        transform: scale(0.5);
    }
}

@media (max-width: 768px) {
    .tab-content {
        padding-top: 75px; /* Menor padding para tabs más pequeños */
    }

    .tab-button {
        padding: 12px 20px;
        font-size: 14px;
        max-width: 150px;
    }

    .sensor-container {
        padding: 15px;
    }

    .sensor-container h2 {
        font-size: 20px;
    }

    .voltage-readings {
        flex-direction: column;
    }

    .voltage-value {
        font-size: 24px;
    }

    .sensor-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .sensor-button {
        width: 100%;
    }

    .coming-soon-container {
        min-height: calc(100vh - 75px);
    }

    .coming-soon-container h1 {
        font-size: 32px;
    }

    .coming-soon-container p {
        font-size: 16px;
    }

    .coming-soon-icon {
        font-size: 80px;
    }

    .avatar-container-small {
        transform: scale(0.4);
    }

    .split-left {
        min-height: 30vh;
    }

    .split-screen {
        min-height: calc(100vh - 75px);
    }
}

@media (max-width: 480px) {
    .tab-button {
        padding: 10px 15px;
        font-size: 12px;
        max-width: 120px;
    }

    .tab-navigation {
        padding: 0;
    }

    #sensorCanvas {
        max-width: 100%;
        height: auto;
    }

    .manual-input {
        flex-direction: column;
    }

    .avatar-container-small {
        transform: scale(0.3);
    }
}
