/* Archivo de estilos centralizado creado a partir de los estilos existentes */
/* Usa fondo por defecto y variables de color */
:root {
    --primary-color: #d10000;
    --secondary-color: #000;
    --text-color: #fff;
    --bg-color: #111;
    --card-bg: #1a1a1a;
    --border-color: #333;
}

/* Estilos base */
html, body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    height: 100%;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    
    /* Imagen de fondo */
    background-image: url('imagen/fondo.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Banner responsive */
.site-banner {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 120px;
    width: auto;
    margin: 0 auto 10px auto;
}

/* Header */
.header {
    background: transparent;
    color: var(--text-color);
    padding: 0.5rem 0;
    border-bottom: none;
    width: 100%;
}

.header h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.header .subtitle {
    font-size: clamp(0.65rem, 2vw, 0.9rem);
    margin: 0.3rem 0 0;
    font-weight: 300;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.4), 0 0 8px rgba(209, 0, 0, 0.4);
    position: relative;
    font-style: italic;
    font-family: 'Times New Roman', serif;
    line-height: 1.3;
}

/* Contenedor principal */
.container-main {
    padding: clamp(1rem, 3vw, 2rem);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Selector de categorías */
.category-selector {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    padding: 0.5rem 0;
}

.category-btn {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.category-btn:hover, .category-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Tooltip para categorías */
.category-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 10px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}

.category-btn:hover::after {
    visibility: visible;
    opacity: 1;
}

.category-btn:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% - 5px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #333;
    z-index: 101;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}

.category-btn:hover::before {
    visibility: visible;
    opacity: 1;
}

/* Grid de estaciones */
.stations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: clamp(0.8rem, 2vw, 1.5rem);
    margin-bottom: 100px;
    width: 100%;
}

/* Tarjetas de estaciones */
.station-card {
    /* Nuevo fondo en gradiente para combinar con el fondo de la página */
    background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(10,10,10,0.45) 45%, rgba(209,0,0,0.10) 100%);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
}

.station-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border-color: rgba(209,0,0,0.55);
}

.station-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.station-card.dragging {
    opacity: 0.7;
    transform: scale(0.98);
}

.station-img-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
}

.station-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.station-info {
    padding: 0.9rem 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.station-name {
    color: #ffffff; /* texto blanco puro */
    font-weight: 800;
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    margin: 0;
    line-height: 1.05;
    letter-spacing: 0.2px;
    text-shadow: 0 3px 10px rgba(0,0,0,0.7);
    display: inline-block;
    padding: 0.18rem 0.5rem;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(0,0,0,0.25), rgba(0,0,0,0.12));
}

.station-location {
    color: #e6e6e6;
    font-size: clamp(0.75rem, 1.5vw, 0.88rem);
    margin: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    opacity: 0.95;
}

/* Si se necesita aún más contraste en ciertas fichas (clase .high-contrast) */
.station-card.high-contrast .station-name {
    background: linear-gradient(90deg, rgba(0,0,0,0.45), rgba(209,0,0,0.12));
    color: #fff;
}

/* Reproductor */
.player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--secondary-color);
    border-top: 3px solid var(--primary-color);
    padding: clamp(0.5rem, 2vw, 1rem);
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 1.5rem);
    z-index: 1000;
    flex-wrap: wrap;
}

.player-cover {
    width: clamp(40px, 8vw, 60px);
    height: clamp(40px, 8vw, 60px);
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    transition: transform 0.5s;
}

.player-cover.playing {
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.player-info {
    flex-grow: 1;
    color: #aaa;
    min-width: 150px;
}

.player-title {
    font-size: clamp(0.8rem, 2vw, 1rem);
    margin: 0;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.player-station {
    font-size: clamp(0.6rem, 1.5vw, 0.7rem);
    color: #aaa;
    margin: 0.2rem 0 0 0;
}

.station-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1.5vw, 1rem);
    justify-content: center;
}

.player-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: clamp(0.8rem, 2vw, 1rem);
    cursor: pointer;
    transition: color 0.3s;
    width: clamp(30px, 6vw, 40px);
    height: clamp(30px, 6vw, 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.player-btn:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
}

.player-btn i {
    pointer-events: none;
}

.visualizer {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
    margin-left: clamp(0.5rem, 1.5vw, 1rem);
}

.visualizer-bar {
    width: 4px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: height 0.1s;
}

.player-meta {
    text-align: center;
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    color: #aaa;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.top-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.player-meta div {
    margin-bottom: 0.2rem;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: clamp(0.5rem, 1.5vw, 1rem);
}

.volume-slider {
    width: clamp(60px, 10vw, 80px);
}

.no-stations {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: #777;
}

/* Estado de conexión */
.connection-status {
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    margin-top: 0.3rem;
}

.status-connecting {
    color: #ffcc00;
}

.status-playing {
    color: #4CAF50;
}

.status-error {
    color: #f44336;
}

/* Favoritos */
.favorite-control {
    margin-left: 10px;
}

.favorite-control .fa-star {
    color: #ccc;
    transition: all 0.3s;
}

.favorite-control .favorited {
    color: red;
}

.station-card .favorite-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    color: red;
    font-size: 12px;
    display: none;
    z-index: 2;
}

.station-card.favorited .favorite-badge {
    display: block;
}

/* Categorías flotantes */
.floating-categories-container {
    position: fixed;
    left: -60px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
    transition: left 0.3s ease;
    display: none;
}

.floating-categories-container.visible {
    left: 10px;
    display: block;
}

.floating-categories-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.floating-categories-container .category-btn {
    width: 50px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.categories-container {
    position: relative;
    z-index: 1000;
    transition: all 0.3s ease;
}

.floating-categories-container .category-btn svg,
.categories-container .category-btn svg {
    width: 24px !important;
    height: 24px !important;
    transform: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Compatibilidad: usar la misma estructura de grid para .radio-grid (lista integrada) */
.radio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(0.6rem, 2vw, 1rem);
    margin-bottom: 100px;
    width: 100%;
}

@media (max-width: 992px) {
    .radio-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.8rem;
    }
}

@media (max-width: 768px) {
    .radio-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.6rem;
    }
}

@media (max-width: 576px) {
    .radio-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }
    .station-img {
        width: 48px;
        height: 48px;
    }
    .station-info { padding: 0.6rem; }
    .station-name { font-size: 0.78rem; }
}

@media (max-width: 320px) {
    .radio-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.3rem;
    }
    .station-img { width: 44px; height: 44px; }
    .station-name { font-size: 0.72rem; }
}

/* Media queries para responsividad */
@media (max-width: 992px) {
    .stations-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .stations-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .player {
        flex-wrap: wrap;
        gap: 0.8rem;
        padding: 0.8rem;
    }
    
    .player-controls {
        order: 1;
        width: 100%;
        justify-content: center;
    }
    
    .visualizer {
        order: 2;
        width: 100%;
        justify-content: center;
        margin: 0;
    }
    
    .player-meta {
        order: 3;
        width: 100%;
        text-align: center;
    }
    
    .volume-control {
        margin: 0.5rem auto;
    }
}

@media (max-width: 576px) {
    .stations-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.8rem;
    }
    
    .station-img {
        width: 60px;
        height: 60px;
    }
    
    .station-info {
        padding: 0.8rem;
    }
}

/* Ajustes específicos para header y categorías en pantallas pequeñas */
@media (max-width: 480px) {
    .header {
        padding: 0.5rem 0.3rem;
        text-align: center;
    }
    
    .header h1 {
        font-size: clamp(1.1rem, 3vw, 1.3rem);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0 0.5rem;
    }
    
    .header .subtitle {
        font-size: clamp(0.6rem, 1.5vw, 0.65rem);
        white-space: normal;
        line-height: 1.2;
        max-width: 100%;
        padding: 0 0.5rem;
        margin: 0.2rem 0 0;
    }
    
    .category-selector {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0.5rem 0;
    }
    
    .category-selector::-webkit-scrollbar {
        display: none;
    }
    
    .category-btn {
        flex: 0 0 auto;
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
    
    .stations-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .player-title {
        max-width: 100%;
    }
    
    .player-cover {
        width: 40px;
        height: 40px;
    }
}

/* Ajustes adicionales para pantallas muy estrechas */
@media (max-width: 320px) {
    .header h1 {
        font-size: 1.1rem;
    }
    
    .header .subtitle {
        font-size: 0.6rem;
    }
    
    .category-btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
    
    .stations-grid {
        grid-template-columns: 1fr;
    }
    
    .player {
        padding: 0.5rem;
    }
}

/* Ajuste específico para nombres de radios en móviles: conservar tamaño en escritorio */
@media (max-width: 480px) {
    .radio-name, .station-name {
        font-size: 0.85rem; /* un poco más pequeño en móvil */
        line-height: 1.1;
    }
}

/* Estilos para el slider de volumen */
input[type="range"] {
    -webkit-appearance: none;
    width: 100px;
    background: transparent;
    height: 6px;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: var(--primary-color);
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 1px solid var(--primary-color);
    border-radius: 50%;
    margin-top: -4px;
    cursor: pointer;
}

input[type="range"]::-moz-range-track {
    height: 6px;
    background: var(--primary-color);
    border-radius: 3px;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #fff;
    border: 1px solid var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

/* Tooltip general */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
}

/* Estilos para arrastrar tarjetas */
.station-card {
    touch-action: pan-y;
    -webkit-user-drag: none;
    user-select: none;
    cursor: grab;
}
.station-card.dragging {
    opacity: 0.7;
    transform: scale(0.98);
}

/* Área drop placeholder */
.sortable-ghost {
    opacity: 0.4;
}

/* Ajustes específicos para celular: reducir tipografía dentro de las fichas */
@media (max-width: 576px) {
    .station-name {
        font-size: 0.72rem !important;
        line-height: 1.02;
    }
    .station-location {
        font-size: 0.65rem !important;
    }
    .station-info {
        padding: 0.45rem !important;
    }
    .station-img {
        width: 40px !important;
        height: 40px !important;
    }
}

/* Ajustes específicos para el player en móvil */
@media (max-width: 768px) {
    .player {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        padding: 0.5rem 0.6rem;
        gap: 0.5rem;
        align-items: center;
        z-index: 1200;
        border-top: 3px solid var(--primary-color);
    }

    .player-cover {
        width: 44px;
        height: 44px;
    }

    .player-info {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        min-width: 0;
        flex: 1 1 auto;
    }

    .player-title {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 0;
    }

    .player-station { display: none; }

    .player-controls {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        flex: 0 0 auto;
    }

    .volume-control { display: none; }

    .player-meta { display: none; }

    /* Asegurar que el grid no quede tapado por el player fijo */
    .radio-grid { margin-bottom: 140px; }
}

/* Ajustes extra para pantallas muy pequeñas */
@media (max-width: 420px) {
    .player-cover { width: 40px; height: 40px; }
    .player-title { font-size: 0.82rem; }
    .player-btn { width: 34px; height: 34px; }
}

/* Si el layout necesita más separación en móvil, incrementar espacio inferior del main */
@media (max-width: 576px) {
    main.container-main { padding-bottom: 6rem; }
}
