/* ============================================
   SISTEMA DE AUDIO PERSONALIZADO
   Tutorium - Orbix Systems
   ============================================ */

/* Variables específicas para audio */
:root {
    --audio-primary: #00d4ff;
    --audio-secondary: #0099cc;
    --audio-success: #00ff88;
    --audio-warning: #ffaa00;
    --audio-error: #ff4444;
    --audio-bg: rgba(26, 31, 58, 0.9);
    --audio-border: rgba(0, 212, 255, 0.3);
}

/* ============================================
   Controles de Audio
   ============================================ */
.audio-system {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--audio-bg);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 15px 20px;
    border: 2px solid var(--audio-border);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.2);
    transition: all 0.3s ease;
    user-select: none;
}

.audio-system:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.3);
    border-color: var(--audio-primary);
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.audio-toggle {
    background: linear-gradient(135deg, var(--audio-primary), var(--audio-secondary));
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 18px;
    position: relative;
    overflow: hidden;
}

.audio-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.audio-toggle:hover::before {
    left: 100%;
}

.audio-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
}

.audio-toggle:active {
    transform: scale(0.95);
}

.audio-toggle.muted {
    background: linear-gradient(135deg, var(--audio-error), #cc3333);
    animation: pulse-error 1s infinite;
}

@keyframes pulse-error {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7); }
    50% { box-shadow: 0 0 0 8px rgba(255, 68, 68, 0); }
}

.audio-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

#audioStatus {
    font-size: 13px;
    color: var(--audio-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.audio-visualizer {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 20px;
}

.audio-bar {
    width: 3px;
    background: var(--audio-primary);
    border-radius: 2px;
    animation: audio-wave 1s ease-in-out infinite;
    opacity: 0.7;
}

.audio-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.audio-bar:nth-child(2) { height: 12px; animation-delay: 0.1s; }
.audio-bar:nth-child(3) { height: 16px; animation-delay: 0.2s; }
.audio-bar:nth-child(4) { height: 10px; animation-delay: 0.3s; }
.audio-bar:nth-child(5) { height: 14px; animation-delay: 0.4s; }

@keyframes audio-wave {
    0%, 100% { 
        transform: scaleY(1);
        opacity: 0.7;
    }
    50% { 
        transform: scaleY(1.5);
        opacity: 1;
    }
}

/* ============================================
   Efectos de Sonido Visual
   ============================================ */
.sound-effect {
    position: relative;
    overflow: hidden;
}

.sound-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 212, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: sound-ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes sound-ripple {
    to {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* ============================================
   Indicadores de Audio por Tipo
   ============================================ */
.audio-feedback {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--audio-bg);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 10px 20px;
    border: 2px solid var(--audio-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--audio-primary);
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.audio-feedback.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

.audio-feedback.success {
    border-color: var(--audio-success);
    color: var(--audio-success);
}

.audio-feedback.warning {
    border-color: var(--audio-warning);
    color: var(--audio-warning);
}

.audio-feedback.error {
    border-color: var(--audio-error);
    color: var(--audio-error);
}

/* ============================================
   Efectos de Hover con Audio
   ============================================ */
[data-sound] {
    position: relative;
    transition: all 0.3s ease;
}

[data-sound]:hover {
    transform: translateY(-2px);
}

[data-sound="menu-hover"]:hover {
    color: var(--audio-primary);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

[data-sound="click"]:hover {
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

[data-sound="card-hover"]:hover {
    border-color: var(--audio-primary);
    box-shadow: 0 8px 40px rgba(0, 212, 255, 0.2);
}

[data-sound="success"]:hover {
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

[data-sound="ai"]:hover {
    box-shadow: 0 4px 20px rgba(255, 170, 0, 0.3);
}

[data-sound="security"]:hover {
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
}

/* ============================================
   Animaciones de Audio Activo
   ============================================ */
.audio-active {
    animation: audio-pulse 0.5s ease-out;
}

@keyframes audio-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ============================================
   Configuración de Audio por Usuario
   ============================================ */
.audio-settings {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--audio-bg);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 20px;
    border: 2px solid var(--audio-border);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.2);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    min-width: 250px;
}

.audio-settings.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.audio-settings h3 {
    color: var(--audio-primary);
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.audio-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}

.audio-option:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.audio-option label {
    color: #a0a8b8;
    font-size: 14px;
    font-weight: 500;
}

.audio-switch {
    position: relative;
    width: 40px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.audio-switch.active {
    background: var(--audio-primary);
}

.audio-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.audio-switch.active::before {
    transform: translateX(20px);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.volume-slider {
    flex: 1;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--audio-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--audio-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

/* ============================================
   Responsive para Audio
   ============================================ */
@media (max-width: 768px) {
    .audio-system {
        top: 10px;
        right: 10px;
        padding: 10px 15px;
    }

    .audio-toggle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .audio-controls {
        gap: 10px;
    }

    #audioStatus {
        font-size: 12px;
    }

    .audio-settings {
        top: 70px;
        right: 10px;
        padding: 15px;
        min-width: 220px;
    }

    .audio-feedback {
        bottom: 20px;
        padding: 8px 15px;
        font-size: 12px;
    }
}

/* ============================================
   Estados de Carga de Audio
   ============================================ */
.audio-loading {
    position: relative;
}

.audio-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--audio-primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: audio-spin 1s linear infinite;
}

@keyframes audio-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Efectos de Transición de Audio
   ============================================ */
.audio-transition {
    transition: all 0.3s ease;
}

.audio-transition.fade-in {
    animation: audio-fade-in 0.5s ease-out;
}

.audio-transition.fade-out {
    animation: audio-fade-out 0.5s ease-out;
}

@keyframes audio-fade-in {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes audio-fade-out {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.8); }
}

/* ============================================
   Accesibilidad para Audio
   ============================================ */
.audio-system:focus-within {
    outline: 2px solid var(--audio-primary);
    outline-offset: 4px;
}

.audio-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.5);
}

@media (prefers-reduced-motion: reduce) {
    .audio-bar {
        animation: none;
    }
    
    .audio-toggle::before {
        display: none;
    }
    
    .sound-effect::after {
        display: none;
    }
}
