/**
 * Estilos para el Widget Flotante de RadioRías
 * Compatible con todos los navegadores
 */

/* Variables CSS para consistencia */
:root {
    --widget-bg: rgba(255, 255, 255, 0.95);
    --widget-border: rgba(20, 184, 166, 0.3);
    --widget-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --widget-teal: #14b8a6;
    --widget-cyan: #06b6d4;
    --widget-text: #1e293b;
    --widget-text-light: #64748b;
    --widget-hover: rgba(20, 184, 166, 0.1);
    --widget-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Widget flotante principal */
.floating-widget {
    position: fixed;
    z-index: 9999;
    background: var(--widget-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--widget-border);
    border-radius: 16px;
    box-shadow: var(--widget-shadow);
    transition: var(--widget-transition);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: move;
    min-width: 280px;
    max-width: 320px;
}

.floating-widget:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

/* Versión expandida */
.floating-widget.expanded {
    min-width: 400px;
    max-width: 450px;
}

/* Widget compacto */
.widget-compact {
    padding: 16px;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    cursor: move;
}

.radio-info {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.radio-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--widget-teal), var(--widget-cyan));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.radio-text {
    display: flex;
    flex-direction: column;
}

.radio-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--widget-text);
    line-height: 1.2;
}

.radio-status {
    font-size: 11px;
    color: var(--widget-text-light);
    font-weight: 500;
}

.widget-controls {
    display: flex;
    gap: 4px;
}

.expand-btn,
.minimize-btn,
.close-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--widget-hover);
    border-radius: 6px;
    color: var(--widget-teal);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: var(--widget-transition);
}

.expand-btn:hover,
.minimize-btn:hover {
    background: var(--widget-teal);
    color: white;
    transform: scale(1.1);
}

.close-btn:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* Controles compactos */
.widget-controls-compact {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

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

.volume-icon {
    color: var(--widget-teal);
    font-size: 14px;
}

.volume-slider-compact {
    width: 80px;
    height: 4px;
    border-radius: 2px;
    background: rgba(20, 184, 166, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: var(--widget-transition);
}

.volume-slider-compact:hover {
    background: rgba(20, 184, 166, 0.3);
}

.volume-slider-compact::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--widget-teal), var(--widget-cyan));
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(20, 184, 166, 0.4);
    transition: var(--widget-transition);
}

.volume-slider-compact::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.6);
}

.volume-slider-compact::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--widget-teal), var(--widget-cyan));
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 4px rgba(20, 184, 166, 0.4);
    transition: var(--widget-transition);
}

.volume-slider-compact::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.6);
}

.control-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: linear-gradient(135deg, var(--widget-teal), var(--widget-cyan));
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--widget-transition);
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
}

.control-btn:active {
    transform: translateY(0) scale(0.95);
}

.play-btn {
    width: 44px;
    height: 44px;
    font-size: 14px;
    background: linear-gradient(135deg, #10b981, #059669);
}

.play-btn.loading {
    position: relative;
    pointer-events: none;
}

.play-btn.loading i {
    animation: spin 1s linear infinite;
}

.play-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Widget expandido */
.widget-expanded {
    padding: 20px;
}

.expanded-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    cursor: move;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(20, 184, 166, 0.1);
}

.expanded-header-controls {
    display: flex;
    gap: 8px;
}

.radio-info-expanded {
    display: flex;
    align-items: center;
    gap: 16px;
}

.radio-logo-large {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--widget-teal), var(--widget-cyan));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.radio-details {
    display: flex;
    flex-direction: column;
}

.radio-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--widget-text);
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.radio-subtitle {
    font-size: 12px;
    color: var(--widget-text-light);
    margin: 0 0 6px 0;
    font-weight: 500;
}

.radio-status-expanded {
    font-size: 11px;
    color: var(--widget-teal);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.minimize-btn-large,
.close-btn-large {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--widget-hover);
    border-radius: 8px;
    color: var(--widget-teal);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--widget-transition);
}

.minimize-btn-large:hover {
    background: var(--widget-teal);
    color: white;
    transform: scale(1.1);
}

.close-btn-large:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* Controles expandidos */
.expanded-controls {
    margin-bottom: 20px;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-btn-large {
    flex: 0 0 auto;
    width: 140px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, var(--widget-teal), var(--widget-cyan));
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    transition: var(--widget-transition);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
    gap: 4px;
}

.control-btn-large:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(20, 184, 166, 0.4);
}

.control-btn-large:active {
    transform: translateY(0) scale(0.98);
}

.control-btn-large i {
    font-size: 16px;
}

.control-btn-large span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.play-btn-large {
    background: linear-gradient(135deg, #10b981, #059669);
}

.play-btn-large.loading {
    position: relative;
    pointer-events: none;
}

.play-btn-large.loading i {
    animation: spin 1s linear infinite;
}

.play-btn-large.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.stop-btn-large {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.volume-btn-large {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

/* Información expandida */
.expanded-info {
    background: rgba(20, 184, 166, 0.05);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(20, 184, 166, 0.1);
}

.now-playing h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--widget-text-light);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.now-playing p {
    font-size: 14px;
    font-weight: 500;
    color: var(--widget-text);
    margin: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .floating-widget {
        min-width: 260px;
        max-width: 280px;
    }
    
    .floating-widget.expanded {
        min-width: 320px;
        max-width: 340px;
    }
    
    .control-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .control-btn-large {
        height: 44px;
    }
}

/* Animaciones */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.radio-status.playing {
    animation: pulse 2s infinite;
}

/* Estados de reproducción */
.playing .play-btn i {
    animation: pulse 1.5s infinite;
}

/* Mejoras de accesibilidad */
.control-btn:focus,
.control-btn-large:focus,
.expand-btn:focus,
.minimize-btn:focus,
.minimize-btn-large:focus {
    outline: 2px solid var(--widget-teal);
    outline-offset: 2px;
}

/* Soporte para navegadores antiguos */
.floating-widget {
    /* Fallback para navegadores sin soporte de backdrop-filter */
    background: rgba(255, 255, 255, 0.98);
}

@supports (backdrop-filter: blur(10px)) {
    .floating-widget {
        background: var(--widget-bg);
        backdrop-filter: blur(10px);
    }
}

/* Control de volumen */
.volume-control {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(20, 184, 166, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(20, 184, 166, 0.1);
}

.volume-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--widget-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.volume-label i {
    color: var(--widget-teal);
    font-size: 14px;
}

.volume-value {
    margin-left: auto;
    color: var(--widget-teal);
    font-weight: 700;
}

.volume-slider-container {
    position: relative;
}

.volume-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(20, 184, 166, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: var(--widget-transition);
}

.volume-slider:hover {
    background: rgba(20, 184, 166, 0.3);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--widget-teal), var(--widget-cyan));
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(20, 184, 166, 0.4);
    transition: var(--widget-transition);
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.6);
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--widget-teal), var(--widget-cyan));
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(20, 184, 166, 0.4);
    transition: var(--widget-transition);
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.6);
}

/* Mejoras para dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
    .control-btn,
    .control-btn-large {
        min-height: 44px;
        min-width: 44px;
    }
    
    .floating-widget {
        touch-action: none;
    }
    
    .volume-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .volume-slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    /* Mejoras específicas para móvil */
    .floating-widget {
        max-width: calc(100vw - 20px);
        min-width: 280px;
    }
    
    .widget-controls-compact {
        gap: 16px;
        justify-content: space-around;
    }
    
    .volume-control-compact {
        flex: 1;
        max-width: 120px;
    }
    
    .volume-slider-compact {
        width: 100%;
        min-width: 80px;
    }
    
    /* Mejor área de toque para el botón de cerrar */
    .close-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 12px;
    }
    
    /* Prevenir zoom en dispositivos iOS */
    .floating-widget * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

/* Animación de carga */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
