/* ============================================ */

/* DISE�0�5O CLON RADIOS-PANAMA.COM - CHATARRARECORDS */

/* ============================================ */



* {

    margin: 0;

    padding: 0;

    box-sizing: border-box;

}



body {

    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;

    background: #f4f6f9;

    color: #1a1a2e;

    padding-bottom: 100px;

}



/* ========== HEADER ========== */

.main-header {

    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);

    color: white;

    padding: 2rem 1rem;

    text-align: center;

    box-shadow: 0 4px 15px rgba(0,0,0,0.1);

}



.logo-area {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 0.75rem;

    font-size: 1.8rem;

}



.logo-area i {

    font-size: 2.2rem;

}



.logo-area h1 {

    font-size: 1.8rem;

    font-weight: 700;

}



.tagline {

    margin-top: 0.5rem;

    opacity: 0.9;

    font-size: 0.9rem;

}



/* ========== CATEGORY BUTTONS ========== */

.category-buttons {

    display: flex;

    gap: 1rem;

    justify-content: center;

    padding: 1.5rem;

    background: white;

    border-bottom: 1px solid #e0e0e0;

    flex-wrap: wrap;

}



.category-btn {

    background: #f0f2f5;

    border: none;

    padding: 0.6rem 1.8rem;

    border-radius: 30px;

    font-weight: 600;

    cursor: pointer;

    transition: all 0.3s;

    font-size: 0.9rem;

    color: #1e3c72;

}



.category-btn.active {

    background: linear-gradient(135deg, #1e3c72, #2a5298);

    color: white;

    box-shadow: 0 2px 8px rgba(0,0,0,0.2);

}



.category-btn:hover {

    transform: translateY(-2px);

}



/* ========== CITIES FILTER ========== */

.cities-filter {

    background: white;

    padding: 1rem 1.5rem;

    border-bottom: 1px solid #e0e0e0;

    position: sticky;

    top: 0;

    z-index: 99;

}



.cities-header {

    display: flex;

    align-items: center;

    gap: 0.5rem;

    margin-bottom: 0.8rem;

    font-weight: 600;

    color: #1e3c72;

}



.cities-list {

    display: flex;

    flex-wrap: wrap;

    gap: 0.5rem;

    list-style: none;

}



.city-item {

    background: #f0f2f5;

    padding: 0.5rem 1.2rem;

    border-radius: 30px;

    cursor: pointer;

    transition: all 0.2s;

    font-size: 0.85rem;

    font-weight: 500;

    color: #333;

}



.city-item:hover {

    background: #e0e0e0;

    transform: translateY(-2px);

}



.city-item.active {

    background: linear-gradient(135deg, #1e3c72, #2a5298);

    color: white;

}



/* ========== STATIONS GRID ========== */

.stations-grid {

    display: grid;

    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));

    gap: 1.8rem;

    max-width: 1300px;

    margin: 2rem auto;

    padding: 0 1.5rem;

}



.station-card {

    background: white;

    border-radius: 16px;

    overflow: hidden;

    transition: all 0.3s ease;

    cursor: pointer;

    box-shadow: 0 4px 12px rgba(0,0,0,0.08);

    border: 1px solid #eee;

}



.station-card:hover {

    transform: translateY(-6px);

    box-shadow: 0 16px 28px rgba(0,0,0,0.12);

}



.card-logo {

    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);

    padding: 1.8rem;

    text-align: center;

    border-bottom: 1px solid #eee;

}



.card-logo img {

    max-width: 100px;

    max-height: 80px;

    object-fit: contain;

    transition: transform 0.3s;

}



.station-card:hover .card-logo img {

    transform: scale(1.05);

}



.card-info {

    padding: 1.2rem;

    text-align: center;

}



.card-info h3 {

    font-size: 1.1rem;

    margin-bottom: 0.3rem;

    font-weight: 700;

    color: #1e3c72;

}



.city-freq {

    color: #666;

    font-size: 0.8rem;

    margin-bottom: 1rem;

}



/* ========== BUTTONS ========== */

.play-btn, .ver-mas {

    display: inline-block;

    padding: 0.5rem 1.2rem;

    margin: 0.3rem;

    border-radius: 30px;

    font-size: 0.8rem;

    cursor: pointer;

    text-decoration: none;

    transition: all 0.2s;

    font-weight: 500;

}



.play-btn {

    background: linear-gradient(135deg, #1e3c72, #2a5298);

    color: white;

    border: none;

}



.play-btn:hover {

    transform: scale(1.02);

    box-shadow: 0 4px 10px rgba(30,60,114,0.3);

}



.ver-mas {

    background: #f0f2f5;

    color: #1e3c72;

    border: 1px solid #ddd;

}



.ver-mas:hover {

    background: #e0e0e0;

    transform: scale(1.02);

}



/* ========== PAGINATION ========== */

.pagination {

    display: flex;

    justify-content: center;

    gap: 0.6rem;

    margin: 3rem 0;

}



.page-link {

    padding: 0.5rem 1rem;

    background: white;

    border-radius: 8px;

    text-decoration: none;

    color: #1e3c72;

    cursor: pointer;

    border: 1px solid #ddd;

    transition: all 0.2s;

}



.page-link.active {

    background: linear-gradient(135deg, #1e3c72, #2a5298);

    color: white;

    border-color: transparent;

}



.page-link:hover {

    transform: translateY(-2px);

    box-shadow: 0 2px 6px rgba(0,0,0,0.1);

}



/* ========== DETALLE P�0�9GINA ========== */

.detalle-container {

    max-width: 1100px;

    margin: 2rem auto;

    padding: 0 1rem;

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 2rem;

}



.detalle-reproductor {

    background: white;

    border-radius: 24px;

    padding: 2rem;

    text-align: center;

    box-shadow: 0 8px 24px rgba(0,0,0,0.1);

}



.detalle-logo {

    max-width: 180px;

    margin-bottom: 1rem;

    border-radius: 16px;

}



.play-big {

    background: linear-gradient(135deg, #1e3c72, #2a5298);

    color: white;

    border: none;

    padding: 0.8rem 2rem;

    border-radius: 50px;

    font-size: 1rem;

    cursor: pointer;

    margin-top: 1rem;

    font-weight: 600;

    transition: all 0.3s;

}



.play-big:hover {

    transform: scale(1.02);

    box-shadow: 0 6px 14px rgba(30,60,114,0.3);

}



.detalle-info {

    background: white;

    border-radius: 24px;

    padding: 2rem;

    box-shadow: 0 8px 24px rgba(0,0,0,0.1);

}



.info-grid {

    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));

    gap: 1rem;

    margin: 1rem 0;

}



.info-item {

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 8px;

    background: #f8f9fa;

    border-radius: 12px;

}



/* ========== LIKE BUTTON ========== */

.like-container {

    margin-top: 20px;

}



.like-btn {

    background: #ff4757;

    color: white;

    border: none;

    padding: 10px 24px;

    border-radius: 50px;

    cursor: pointer;

    font-size: 16px;

    transition: all 0.3s;

}



.like-btn:hover {

    background: #ff6b81;

    transform: scale(1.05);

}



.like-btn i {

    margin-right: 8px;

}



.like-btn.liked {

    background: #ff6b81;

    animation: pulse 0.5s;

}



@keyframes pulse {

    0% { transform: scale(1); }

    50% { transform: scale(1.1); }

    100% { transform: scale(1); }

}



/* ========== REDES SOCIALES ========== */

.redes-sociales {

    margin-top: 20px;

    padding-top: 15px;

    border-top: 1px solid #eee;

}



.social-links {

    display: flex;

    gap: 12px;

    flex-wrap: wrap;

    margin-top: 12px;

}



.social-link {

    display: inline-flex;

    align-items: center;

    gap: 8px;

    padding: 8px 20px;

    border-radius: 50px;

    text-decoration: none;

    color: white;

    font-size: 14px;

    font-weight: 500;

    transition: all 0.3s;

}



.social-link.website {

    background: #1e3c72;

}



.social-link.facebook {

    background: #1877f2;

}



.social-link.instagram {

    background: #e4405f;

}



.social-link:hover {

    opacity: 0.9;

    transform: translateY(-2px);

}



/* ========== WIDGET EMBED ========== */

.codigo-embed-container {

    background: white;

    border-radius: 24px;

    padding: 20px;

    margin: 20px auto;

    max-width: 1100px;

    box-shadow: 0 8px 24px rgba(0,0,0,0.08);

    margin-bottom: 100px;

}



.embed-wrapper {

    overflow-x: auto;

}



.embed-wrapper iframe {

    max-width: 100%;

    border: none;

}



/* ========== REPRODUCTOR FIJO ========== */

.fixed-player {

    position: fixed;

    bottom: 0;

    left: 0;

    right: 0;

    background: #1a1a2e;

    color: white;

    padding: 0.75rem 1rem;

    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);

    z-index: 1000;

}



.player-content {

    max-width: 1200px;

    margin: 0 auto;

    display: flex;

    align-items: center;

    gap: 1rem;

    flex-wrap: wrap;

}



.player-info {

    display: flex;

    align-items: center;

    gap: 0.75rem;

    flex: 1;

    min-width: 180px;

}



.player-logo-mini {

    width: 40px;

    height: 40px;

    object-fit: contain;

    background: white;

    border-radius: 8px;

    padding: 4px;

}



.player-controls {

    display: flex;

    gap: 0.5rem;

}



.player-btn {

    background: #2a5298;

    border: none;

    color: white;

    width: 36px;

    height: 36px;

    border-radius: 50%;

    cursor: pointer;

    transition: all 0.2s;

}



.player-btn:hover {

    background: #1e3c72;

    transform: scale(1.05);

}



.player-volume {

    display: flex;

    align-items: center;

    gap: 0.5rem;

}



#volumeSlider {

    width: 80px;

}



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

@media (max-width: 768px) {

    .stations-grid {

        grid-template-columns: 1fr;

        gap: 1rem;

        padding: 0 1rem;

    }

    

    .category-buttons {

        gap: 0.5rem;

    }

    

    .category-btn {

        padding: 0.4rem 1rem;

        font-size: 0.75rem;

    }

    

    .detalle-container {

        grid-template-columns: 1fr;

        gap: 1rem;

    }

    

    .player-content {

        flex-direction: column;

        text-align: center;

    }

    

    .cities-list {

        gap: 0.3rem;

    }

    

    .city-item {

        font-size: 0.7rem;

        padding: 0.3rem 0.8rem;

    }

}



/* ========== BUSCADOR EN VIVO ========== */

.live-search-container input:focus {

    border-color: #1e3c72;

    box-shadow: 0 0 0 3px rgba(30,60,114,0.2);

}



#noResultsMessage {

    animation: fadeIn 0.3s ease;

}



@keyframes fadeIn {

    from { opacity: 0; transform: translateY(-10px); }

    to { opacity: 1; transform: translateY(0); }

}



/* Reproductor persistente fijo */

.fixed-player {

    position: fixed;

    bottom: 0;

    left: 0;

    right: 0;

    background: linear-gradient(135deg, #1a1a2e, #16213e);

    color: white;

    padding: 12px 20px;

    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);

    z-index: 1000;

    backdrop-filter: blur(10px);

    border-top: 1px solid rgba(255,255,255,0.1);

}



.player-content {

    max-width: 1200px;

    margin: 0 auto;

    display: flex;

    align-items: center;

    gap: 20px;

    flex-wrap: wrap;

}



.player-info {

    display: flex;

    align-items: center;

    gap: 12px;

    flex: 2;

    min-width: 200px;

}



.player-logo-mini {

    width: 45px;

    height: 45px;

    object-fit: contain;

    background: white;

    border-radius: 10px;

    padding: 5px;

}



.player-controls {

    display: flex;

    gap: 10px;

}



.player-btn {

    background: #2a5298;

    border: none;

    color: white;

    width: 40px;

    height: 40px;

    border-radius: 50%;

    cursor: pointer;

    transition: all 0.2s;

    font-size: 16px;

}



.player-btn:hover {

    background: #1e3c72;

    transform: scale(1.05);

}



.player-volume {

    display: flex;

    align-items: center;

    gap: 10px;

    flex: 1;

    min-width: 120px;

}



#volumeSlider {

    width: 100px;

    cursor: pointer;

}



.player-close {

    background: transparent;

    border: none;

    color: #ff4757;

    font-size: 20px;

    cursor: pointer;

    width: 35px;

    height: 35px;

    border-radius: 50%;

    transition: all 0.2s;

}



.player-close:hover {

    background: rgba(255,71,87,0.2);

    transform: scale(1.1);

}



@media (max-width: 768px) {

    .player-content {

        flex-direction: column;

        text-align: center;

        gap: 10px;

    }

    .player-info {

        justify-content: center;

    }

    .player-volume {

        justify-content: center;

    }

}



/* Insignia de emisora destacada */

.destacada-badge {

    display: inline-block;

    background: linear-gradient(135deg, #f1c40f, #e67e22);

    color: #fff;

    font-size: 0.65rem;

    font-weight: bold;

    padding: 3px 10px;

    border-radius: 20px;

    margin-left: 8px;

    vertical-align: middle;

    text-shadow: 0 1px 1px rgba(0,0,0,0.1);

    animation: fadeIn 0.3s ease;

}



@keyframes fadeIn {

    from {

        opacity: 0;

        transform: scale(0.8);

    }

    to {

        opacity: 1;

        transform: scale(1);

    }

}

/* ========== MODO OSCURO ========== */

body.dark-mode {

    background: #121212;

    color: #e0e0e0;

}



body.dark-mode .main-header {

    background: linear-gradient(135deg, #0a0a0a, #1a1a2e);

}



body.dark-mode .category-btn {

    background: #2a2a2a;

    color: #e0e0e0;

}



body.dark-mode .category-btn.active {

    background: linear-gradient(135deg, #1e3c72, #2a5298);

}



body.dark-mode .cities-filter {

    background: #1e1e1e;

    border-bottom-color: #333;

}



body.dark-mode .city-item {

    background: #2a2a2a;

    color: #e0e0e0;

}



body.dark-mode .city-item.active {

    background: linear-gradient(135deg, #1e3c72, #2a5298);

}



body.dark-mode .station-card {

    background: #1e1e1e;

    border-color: #333;

}



body.dark-mode .card-logo {

    background: #2a2a2a;

}



body.dark-mode .card-info h3 {

    color: #e0e0e0;

}



body.dark-mode .city-freq {

    color: #aaa;

}



body.dark-mode .ver-mas {

    background: #2a2a2a;

    color: #e0e0e0;

}



body.dark-mode .detalle-reproductor,

body.dark-mode .detalle-info,

body.dark-mode .codigo-embed-container {

    background: #1e1e1e;

}



body.dark-mode .info-item {

    background: #2a2a2a;

}



body.dark-mode .redes-sociales {

    border-top-color: #333;

}



/* Bot��n modo oscuro */

.theme-toggle {

    position: fixed;

    bottom: 20px;

    right: 20px;

    background: #1e3c72;

    color: white;

    border: none;

    width: 50px;

    height: 50px;

    border-radius: 50%;

    cursor: pointer;

    font-size: 24px;

    z-index: 999;

    box-shadow: 0 4px 12px rgba(0,0,0,0.2);

    transition: all 0.3s;

}



.theme-toggle:hover {

    transform: scale(1.1);

}



body.dark-mode .theme-toggle {

    background: #f1c40f;

    color: #1a1a2e;

}



/* Ajuste para que el bot��n modo oscuro no quede debajo del reproductor */

.fixed-player {

    z-index: 1001;

}

/* ========== MEJORAS DE DISEÑO ========== */

/* Cabecera más moderna */
.main-header {
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.header-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.logo-area {
    margin-bottom: 0.5rem;
}

.logo-area i {
    font-size: 3rem;
    background: rgba(255,255,255,0.2);
    padding: 15px;
    border-radius: 50%;
    margin-bottom: 15px;
}

.logo-area h1 {
    font-size: 2.5rem;
    letter-spacing: 2px;
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

/* Botón de escuchar */
.btn-header {
    display: inline-block;
    background: #f1c40f;
    color: #1a1a2e;
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-header:hover {
    background: #e67e22;
    transform: scale(1.05);
    color: white;
}

/* Tarjetas de emisoras - mejorar espaciado */
.station-card {
    transition: transform 0.3s, box-shadow 0.3s;
}

.station-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 30px rgba(0,0,0,0.15);
}

/* Botones de categorías más elegantes */
.category-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 0.6rem 1.8rem;
    border-radius: 40px;
    font-weight: 500;
    transition: all 0.3s;
}

.category-btn.active {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    border-color: transparent;
    color: white;
}

.category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Filtro de ciudades más bonito */
.city-item {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    transition: all 0.2s;
}

.city-item.active {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    border-color: transparent;
    color: white;
}

.city-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Responsive para cabecera */
@media (max-width: 768px) {
    .main-header {
        min-height: 280px;
    }
    
    .logo-area h1 {
        font-size: 1.8rem;
    }
    
    .tagline {
        font-size: 0.9rem;
    }
    
    .btn-header {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
    
    .logo-area i {
        font-size: 2rem;
        padding: 10px;
    }
}

/* Desplazamiento suave para el botón Escuchar ahora */
html {
    scroll-behavior: smooth;
}

/* Mejora para el botón Escuchar ahora */
.btn-header {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

/* Widgets */
.widget-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.widget-card:hover {
    transform: translateY(-3px);
}

.widget-card h3 {
    font-size: 1.2rem;
    border-bottom: 2px solid #f1c40f;
    display: inline-block;
    padding-bottom: 5px;
    margin-bottom: 15px;
    color: #1e3c72;
}

/* Pie de página */
.custom-footer a {
    color: #f1c40f;
    text-decoration: none;
}

.custom-footer a:hover {
    text-decoration: underline;
}

/* Modo oscuro para widgets */
body.dark-mode .widget-card {
    background: #1e1e1e;
}

body.dark-mode .widget-card h3 {
    color: #e0e0e0;
}

/* Responsive */
@media (max-width: 768px) {
    main {
        flex-direction: column;
    }
    .custom-footer > div {
        grid-template-columns: 1fr;
        text-align: center;
    }
}
/* ========== BARRA LATERAL MEJORADA ========== */
.widget-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.widget-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}

.widget-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    display: inline-block;
    padding: 8px 18px;
    border-radius: 30px;
    margin-bottom: 20px;
    color: white;
    letter-spacing: 0.5px;
    border-bottom: none;
}

.widget-card a {
    display: inline-block;
    margin: 5px 8px;
    padding: 8px 15px;
    background: #f0f2f5;
    border-radius: 25px;
    text-decoration: none;
    color: #1e3c72;
    transition: all 0.3s;
    font-size: 14px;
}

.widget-card a:hover {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    transform: scale(1.05);
}

/* Modo oscuro barra lateral mejorada */
body.dark-mode .widget-card {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-color: #333;
}

body.dark-mode .widget-card a {
    background: #2a2a2a;
    color: #e0e0e0;
}

body.dark-mode .widget-card a:hover {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
}

/* ========== PIE DE PÁGINA MEJORADO ========== */
.custom-footer {
    background: linear-gradient(135deg, #0f0f1a, #1a1a2e);
    color: #e0e0e0;
    padding: 50px 20px 30px;
    margin-top: 60px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.custom-footer > div {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
}

.custom-footer h3 {
    color: #f1c40f;
    font-size: 1.2rem;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

.custom-footer h3:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: #f1c40f;
    border-radius: 3px;
}

.custom-footer a {
    color: #e0e0e0;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-block;
    margin: 5px 0;
}

.custom-footer a:hover {
    color: #f1c40f;
    transform: translateX(5px);
}

/* Responsive pie de página */
@media (max-width: 768px) {
    .custom-footer > div {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 25px;
    }
    
    .custom-footer h3:after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .custom-footer a:hover {
        transform: translateX(0) scale(1.05);
    }
}

/* Botón volver arriba */
.btn-arriba {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 99;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.btn-arriba:hover {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    transform: scale(1.1);
    color: #1a1a2e;
}

body.dark-mode .btn-arriba {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    color: #1a1a2e;
}

body.dark-mode .btn-arriba:hover {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
}

@media (max-width: 768px) {
    .btn-arriba {
        bottom: 70px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}
// Playlist semanal
function getSemanaActual() {
    return date('W');
}

function limpiarPlaylistSemanal() {
    global $pdo;
    $semana_actual = date('W');
    $stmt = $pdo->prepare("DELETE FROM playlist WHERE semana != ? OR semana IS NULL");
    $stmt->execute([$semana_actual]);
}

function agregarCancionPlaylist($emisora_id, $cancion, $artista = '') {
    global $pdo;
    $semana = date('W');
    $stmt = $pdo->prepare("INSERT INTO playlist (emisora_id, cancion, artista, semana) VALUES (?, ?, ?, ?)");
    return $stmt->execute([$emisora_id, $cancion, $artista, $semana]);
}

function obtenerPlaylist($emisora_id, $limite = 10) {
    global $pdo;
    $semana = date('W');
    $stmt = $pdo->prepare("SELECT * FROM playlist WHERE emisora_id = ? AND semana = ? ORDER BY fecha_reproduccion DESC LIMIT ?");
    $stmt->execute([$emisora_id, $semana, $limite]);
    return $stmt->fetchAll();
}

function eliminarCancionPlaylist($id) {
    global $pdo;
    $stmt = $pdo->prepare("DELETE FROM playlist WHERE id = ?");
    return $stmt->execute([$id]);
}

