/* ================= VARIABLES ================= */

:root {
--bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-alt: #0f172a;
    --border-color: #334155;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-soft: #1e3a8a;
    --shadow-soft: 0 6px 20px rgba(0,0,0,0.5);
    
}

[data-theme="dark"] {
--bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f1f5f9;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #1e40af;
    --primary-hover: #1e3a8a;
    --primary-soft: #dbeafe;
    --shadow-soft: 0 6px 20px rgba(15, 23, 42, 0.06);
    
}

/* ================= ADS================= */
.ad-container {
    min-width: 300px;
    min-height: 250px;
}


/* ================= RESET ================= */

*{box-sizing:border-box;margin:0;padding:0}

body{
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
}

/* ================= CONTAINER ================= */

#app-container{
    max-width: 1200px;
    margin: auto;
    padding: 30px 20px;
}

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

#main-header{
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    border-radius: 16px;
    padding: 18px 22px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    margin-bottom:35px;
    flex-wrap:wrap;
}

#main-header h1{
    font-size:22px;
    font-weight:700;
}

.header-center{
    flex:1;
    min-width:250px;
}

#search-bar{
    position:relative;
}

#search-bar input{
    width:100%;
    padding:12px 15px 12px 42px;
    border-radius:12px;
    border:1px solid var(--border-color);
    background:var(--bg-surface-alt);
    color:var(--text-main);
}

.search-icon{
    position:absolute;
    left:14px;
    top:50%;
    transform:translateY(-50%);
    color:var(--text-muted);
}

.header-right{
    display:flex;
    gap:10px;
    align-items:center;
}

.header-right a,
#theme-toggle{
    text-decoration:none;
    padding:9px 14px;
    border-radius:10px;
    border:1px solid var(--border-color);
    background:var(--bg-surface-alt);
    color:var(--text-muted);
    font-size:14px;
    cursor:pointer;
    transition:.2s;
}

.header-right a.active,
.header-right a:hover,
#theme-toggle:hover{
    background:var(--primary-soft);
    color:var(--primary);
}

.download-btn{
    background:var(--primary);
    color:#fff !important;
    border:none;
}

.download-btn:hover{
    background:var(--primary-hover);
}

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

#channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 22px;
}

/* ================= CARD REAL ================= */

.channel-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 15px;
    box-shadow: var(--shadow-soft);
    transition: transform .25s ease;
    cursor: pointer;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;

    position: relative;
    overflow: hidden; /* 🔥 CLAVE */
    text-decoration:none;
}

/* HOVER */

.channel-item:hover {
    transform: translateY(-6px);
}

/* ================= IMAGEN CONTROL TOTAL ================= */

.channel-logo {
    width: 100% !important;
    height: 120px !important; /* ALTURA FIJA */
    max-width: 100%;
    max-height: 120px;

    object-fit: contain; /* 🔥 NUNCA se deforma */
    display: block;

    background: var(--bg-surface-alt);
    padding: 10px;
    border-radius: 12px;

    overflow: hidden;
}

/* ================= NOMBRE ================= */

.channel-name {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: var(--text-main);
}

/* ================= FAVORITO ================= */

.favorite-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 6px;
    border-radius: 50%;
    transition: .2s;
}

.favorite-icon:hover {
    color: var(--primary);
}

.favorite-icon.is-favorite {
    color: #e11d48;
}



/* ================= MODAL ================= */

#player-modal-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.8);
    display:none;
    align-items:center;
    justify-content:center;
    z-index:999;
}

#player-modal-content{
    background:var(--bg-surface);
    width:95%;
    max-width:950px;
    border-radius:18px;
    padding:25px;
    position:relative;
}

#close-player-modal{
    position:absolute;
    right:18px;
    top:15px;
    font-size:24px;
    background:none;
    border:none;
    cursor:pointer;
    color:var(--text-muted);
}

#jw-player{
    width:100%;
    height:480px;
    border-radius:12px;
    overflow:hidden;
}

/* ================= TOAST ================= */

.toast {
    position: fixed;
    bottom: 25px;
    right: 25px;

    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);

    font-size: 14px;
    font-weight: 500;

    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;

    transition: all .3s ease;

    z-index: 9999;
}

/* Visible */

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Variantes */

.toast.success {
    border-left: 4px solid #16a34a;
}

.toast.error {
    border-left: 4px solid #dc2626;
}

.toast.info {
    border-left: 4px solid var(--primary);
}


/* ================= MOBILE ================= */

@media(max-width:768px){
    #jw-player{height:230px}
    #main-header{flex-direction:column;align-items:stretch}
}

