/* ==========================================================================
   OVERLAYS.CSS - v4 | REDES + PROGRAMACIÓN PREMIUM + RESPONSIVE LANDSCAPE
   ✅ Grid dinámico para redes y programación
   ✅ Tarjetas compactas con fondo cristal rgba(255,255,255,0.06)
   ✅ Clase .is-live con glow en avatar y badge "EN VIVO" + radar ping
   ✅ text-overflow:ellipsis en todos los textos variables
   ✅ Modal con scroll interno en landscape
   ========================================================================== */

/* ==========================================================================
   BASE DEL OVERLAY
   ========================================================================== */

.social-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.social-overlay.active {
    display: flex;
    opacity: 1;
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL
   ========================================================================== */

.social-content,
.schedule-modal,
.overlay-content {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-large);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    padding: 30px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ==========================================================================
   BOTÓN DE CIERRE
   ========================================================================== */

.close-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-white);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.close-overlay:hover {
    background: rgba(255, 50, 50, 0.3);
    border-color: #ff3333;
    transform: rotate(90deg);
}

/* ==========================================================================
   TÍTULOS
   ========================================================================== */

.overlay-title,
.modal-title {
    font-family: var(--font-titulo);
    font-size: 1.8rem;
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
    letter-spacing: 2px;
}

/* ==========================================================================
   REDES SOCIALES — GRID DINÁMICO
   ========================================================================== */

.social-icons-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
}

.social-item {
    --social-color: var(--primary-color);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-medium);
    text-decoration: none;
    color: var(--text-white);
    min-width: 0;
    overflow: hidden;
    transition: transform 0.25s ease, background 0.25s ease,
                border-color 0.25s ease, box-shadow 0.25s ease;
}

.social-item:hover,
.social-item:focus-visible {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--social-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4),
                0 0 0 1px var(--social-color) inset;
    outline: none;
}

.social-item i {
    font-size: 2rem;
    flex-shrink: 0;
    color: var(--social-color);
    transition: transform 0.25s ease;
    line-height: 1;
}

.social-item:hover i { transform: scale(1.15); }

.social-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.social-item span,
.social-item .social-label {
    font-family: var(--font-artista);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.social-item .social-url {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    line-height: 1.2;
}

/* ==========================================================================
   PROGRAMACIÓN — PESTAÑAS
   ========================================================================== */

.schedule-modal {
    /* En desktop/tablet el modal de programación necesita más ancho
       para que las 2 columnas respiren y el texto no se trunque */
    max-width: 860px;
    padding: 30px 22px;
}

.tabs-container {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    justify-content: center;
}

.tab-btn {
    flex: 1;
    max-width: 120px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);
    font-family: var(--font-artista);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.tab-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-white);
}

.schedule-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.tab-content {
    display: none;
    flex-direction: column;
}

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

/* ==========================================================================
   PROGRAMACIÓN — GRID DE TARJETAS
   ========================================================================== */

.schedule-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
}

.sin-prog {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    padding: 20px 0;
    font-size: 0.85rem;
    grid-column: 1 / -1;
}

.schedule-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-medium);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    min-width: 0;
    overflow: hidden;
}

.schedule-row:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.2);
}

.schedule-row.is-live {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: var(--primary-color);
    box-shadow: 0 0 18px rgba(var(--primary-rgb), 0.2);
}

/* ==========================================================================
   AVATAR CON GLOW "EN VIVO"
   ========================================================================== */

.prog-visual {
    position: relative;
    flex-shrink: 0;
}

.mini-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: block;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.mini-avatar.avatar-live {
    border-color: var(--primary-color);
    box-shadow:
        0 0 0 3px rgba(var(--primary-rgb), 0.35),
        0 0 14px rgba(var(--primary-rgb), 0.5);
    animation: avatar-glow-pulse 2.5s ease-in-out infinite;
}

@keyframes avatar-glow-pulse {
    0%,  100% {
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.35),
                    0 0 14px rgba(var(--primary-rgb), 0.5);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(var(--primary-rgb), 0.5),
                    0 0 22px rgba(var(--primary-rgb), 0.7);
    }
}

.radar-live-mini {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ff2222;
    border: 2px solid rgba(26, 26, 26, 0.9);
    animation: radar-ping 2s ease-in-out infinite;
}

.radar-live-mini::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(255, 34, 34, 0.45);
    animation: radar-ring 2s ease-out infinite;
}

@keyframes radar-ping {
    0%, 100% { transform: scale(1);    opacity: 1;   }
    50%       { transform: scale(1.25); opacity: 0.8; }
}

@keyframes radar-ring {
    0%   { transform: scale(0.8); opacity: 0.7; }
    100% { transform: scale(2);   opacity: 0;   }
}

/* ==========================================================================
   INFO DEL PROGRAMA
   ========================================================================== */

.prog-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.prog-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;       /* máximo 2 líneas, nunca se corta a "T..." */
    overflow: hidden;
    font-family: var(--font-titulo);
    font-size: 0.88rem;
    color: var(--text-white);
    line-height: 1.25;
    word-break: break-word;
}

.prog-host {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.25;
    word-break: break-word;
}

.prog-dias {
    display: block;
    font-size: 0.66rem;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1.2;
    white-space: nowrap;
}

/* ==========================================================================
   BLOQUE DE HORARIO / BADGE EN VIVO
   ========================================================================== */

.prog-time {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
}

.prog-rango {
    font-family: var(--font-artista);
    font-size: 0.65rem;          /* más pequeño para dejar espacio al texto */
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 1.2;
}

/* Badge "EN VIVO" restaurado */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(var(--primary-rgb), 0.2);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    padding: 2px 8px;
    font-family: var(--font-artista);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--primary-color);
    white-space: nowrap;
}

.live-ping {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
    animation: ping-dot 1.4s ease-in-out infinite;
}

@keyframes ping-dot {
    0%, 100% { opacity: 1;   transform: scale(1);   }
    50%       { opacity: 0.4; transform: scale(0.7); }
}

/* ==========================================================================
   RADIO INSTITUCIONAL
   ========================================================================== */

.radio-institutional-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.radio-logo-square {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: var(--radius-medium);
    border: 2px solid var(--glass-border);
}

.radio-text-content h2 {
    font-family: var(--font-titulo);
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.slogan {
    font-family: var(--font-artista);
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 20px;
}

.contact-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-white);
}

.contact-item i { color: var(--primary-color); }

.contact-item a {
    color: var(--text-white);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-item a:hover { color: var(--primary-color); }

/* ==========================================================================
   SONADAS
   ========================================================================== */

.sonadas-wrapper { width: 100%; }

/* ==========================================================================
   RESPONSIVE — TABLET (769–1024 px)
   ========================================================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .social-content,
    .overlay-content { max-width: 550px; padding: 25px 18px; }

    /* schedule-modal tiene su propio max-width: 720px definido arriba */
    .schedule-modal { padding: 25px 20px; }

    .overlay-title,
    .modal-title { font-size: 1.6rem; }

    .social-icons-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .schedule-grid     { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* ==========================================================================
   RESPONSIVE — DESKTOP (≥ 769 px)
   ========================================================================== */

@media (min-width: 769px) {
    .social-icons-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .schedule-grid     { grid-template-columns: repeat(2, 1fr); gap: 14px; }

    /* Con 860px de modal las columnas tienen ~380px: forzar 1 sola línea */
    .schedule-row { padding: 12px 15px; gap: 13px; }
    .mini-avatar  { width: 52px; height: 52px; }
    .prog-name    {
        font-size: 0.92rem;
        -webkit-line-clamp: 1;
        white-space: nowrap;
    }
    .prog-host    {
        font-size: 0.78rem;
        -webkit-line-clamp: 1;
        white-space: nowrap;
    }
}

/* ==========================================================================
   RESPONSIVE — MÓVIL VERTICAL (≤ 768 px)
   ========================================================================== */

@media (max-width: 768px) {
    .social-overlay { padding: 15px; }

    .social-content,
    .schedule-modal,
    .overlay-content {
        max-width: 100%;
        max-height: 90vh;
        padding: 25px 15px;
        border-radius: var(--radius-medium);
    }

    .overlay-title,
    .modal-title { font-size: 1.5rem; margin-bottom: 16px; }
    .close-overlay { width: 35px; height: 35px; font-size: 1.3rem; }

    .social-icons-grid { grid-template-columns: 1fr; gap: 10px; }
    .schedule-grid     { grid-template-columns: 1fr; gap: 10px; }

    .social-item   { padding: 10px 13px; }
    .social-item i { font-size: 1.8rem; }

    .schedule-row { padding: 10px 11px; gap: 10px; }
    .mini-avatar  { width: 44px; height: 44px; }
    .prog-name    { font-size: 0.85rem; }
    .prog-host    { font-size: 0.74rem; }
    .prog-rango   { font-size: 0.68rem; }

    .schedule-modal { padding: 25px 12px; }
    .tabs-container { gap: 8px; }
    .tab-btn { padding: 8px 15px; font-size: 0.85rem; }

    .radio-logo-square     { width: 100px; height: 100px; }
    .radio-text-content h2 { font-size: 1.7rem; }
    .slogan                { font-size: 0.9rem; }
    .contact-item          { font-size: 0.85rem; }
}

/* ==========================================================================
   RESPONSIVE — MÓVIL LANDSCAPE ← ★ girar el teléfono
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .social-overlay { padding: 8px; }

    .social-content,
    .schedule-modal,
    .overlay-content {
        max-height: 95vh;
        padding: 12px 14px;
        border-radius: var(--radius-medium);
    }

    .overlay-title,
    .modal-title { font-size: 1.05rem; margin-bottom: 10px; letter-spacing: 1.2px; }
    .close-overlay { width: 30px; height: 30px; font-size: 1rem; top: 10px; right: 10px; }

    .social-icons-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .schedule-grid     { grid-template-columns: repeat(2, 1fr); gap: 8px; }

    .social-item   { padding: 8px 11px; }
    .social-item i { font-size: 1.6rem; }
    .social-item span,
    .social-item .social-label { font-size: 0.74rem; }

    .schedule-row { padding: 8px 10px; gap: 8px; }
    .mini-avatar  { width: 36px; height: 36px; }
    .prog-name    { font-size: 0.78rem; }
    .prog-host    { font-size: 0.68rem; }
    .prog-rango   { font-size: 0.63rem; }
    .live-badge   { font-size: 0.57rem; padding: 1px 6px; }
    .live-ping    { width: 5px; height: 5px; }

    .schedule-modal { padding: 12px 10px; }
    .tabs-container { margin-bottom: 10px; gap: 6px; }
    .tab-btn { padding: 6px 12px; font-size: 0.8rem; }
}

/* ==========================================================================
   RESPONSIVE — MÓVIL MUY PEQUEÑO (≤ 380 px)
   ========================================================================== */

@media (max-width: 380px) {
    .social-overlay { padding: 8px; }

    .social-content,
    .schedule-modal,
    .overlay-content { padding: 18px 10px; }

    .overlay-title,
    .modal-title { font-size: 1.2rem; }

    .social-icons-grid { grid-template-columns: 1fr; gap: 8px; }
    .schedule-grid     { grid-template-columns: 1fr; gap: 8px; }

    .social-item   { padding: 9px 11px; }
    .social-item i { font-size: 1.6rem; }

    .schedule-row { padding: 9px 10px; }
    .mini-avatar  { width: 38px; height: 38px; }
    .prog-name    { font-size: 0.8rem; }
    .prog-host    { font-size: 0.7rem; }
    .prog-rango   { font-size: 0.66rem; }
    .live-badge   { font-size: 0.58rem; }
}

/* ==========================================================================
   SCROLLBAR PERSONALIZADO
   ========================================================================== */

.social-content::-webkit-scrollbar,
.schedule-modal::-webkit-scrollbar,
.overlay-content::-webkit-scrollbar { width: 6px; }

.social-content::-webkit-scrollbar-track,
.schedule-modal::-webkit-scrollbar-track,
.overlay-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.social-content::-webkit-scrollbar-thumb,
.schedule-modal::-webkit-scrollbar-thumb,
.overlay-content::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.5);
    border-radius: 10px;
}

.social-content::-webkit-scrollbar-thumb:hover,
.schedule-modal::-webkit-scrollbar-thumb:hover,
.overlay-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ==========================================================================
   ACCESIBILIDAD
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .social-overlay,
    .social-content,
    .schedule-modal,
    .overlay-content,
    .social-item,
    .schedule-row,
    .tab-btn {
        animation: none !important;
        transition: opacity 0.2s ease, background 0.2s ease !important;
    }

    .mini-avatar.avatar-live,
    .radar-live-mini,
    .radar-live-mini::after,
    .live-ping {
        animation: none !important;
    }
}

@media (prefers-contrast: high) {
    .social-content,
    .schedule-modal,
    .overlay-content { border: 2px solid var(--text-white); }

    .social-item,
    .schedule-row,
    .tab-btn { border: 2px solid rgba(255, 255, 255, 0.5); }

    .schedule-row.is-live { border: 2px solid var(--primary-color); }
}
