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

:root {
    --bg-body: #0D3A6E;
    --bg-surface: #1A4F8C;
    --bg-surface-alt: #164373;
    --border-color: #2B5A92;
    --text-main: #EBF4FC;
    --text-muted: #A3C5E6;
    --primary: #74ACDF;
    --primary-hover: #5A94C7;
    --primary-soft: #0D3A6E;
    --primary-darker: #4A8FD6;
    --shadow-soft: 0 6px 20px rgba(0, 0, 0, 0.5);
    --live-red: #E74C3C;
    --success: #2ECC71;
    --error: #E74C3C;
}

/* ================= TEMA CLARO ================= */

[data-theme="light"] {
    --bg-body: #f0f5fa;
    --bg-surface: #ffffff;
    --bg-surface-alt: #e8edf5;
    --border-color: #c8d8e8;
    --text-main: #0D3A6E;
    --text-muted: #4A6F94;
    --primary: #74ACDF;
    --primary-hover: #5A94C7;
    --primary-soft: #d8e8f5;
    --shadow-soft: 0 6px 20px rgba(13, 58, 110, 0.1);
}

/* ================= 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);
    min-height: 100vh;
}

/* ================= 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;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

#main-header h1 i {
    color: var(--primary);
}

.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);
    font-size: 14px;
    transition: border-color 0.3s;
}

#search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(116, 172, 223, 0.25);
}

#search-bar input::placeholder {
    color: var(--text-muted);
}

.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: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.header-right a.active {
    background: var(--primary);
    color: #fff !important;
    border-color: var(--primary);
}

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

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

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

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

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

.channel-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 15px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.25s ease, border-color 0.25s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-main);
}

.channel-item:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
}

/* ================= IMAGEN ================= */

.channel-logo {
    width: 100% !important;
    height: 120px !important;
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
    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: rgba(0, 0, 0, 0.4);
    padding: 6px;
    border-radius: 50%;
    transition: all 0.25s;
    z-index: 2;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

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

.favorite-icon.is-favorite {
    color: #E74C3C;
    background: rgba(231, 76, 60, 0.2);
}

.favorite-icon.is-favorite:hover {
    color: #c0392b;
}

/* ================= MENSAJE SIN CANALES ================= */

.no-channels {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    font-size: 16px;
    background: var(--bg-surface);
    border-radius: 16px;
    border: 1px dashed var(--border-color);
}

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

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

#player-modal-content {
    background: var(--bg-surface);
    width: 95%;
    max-width: 950px;
    border-radius: 18px;
    padding: 25px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
}

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

#close-player-modal:hover {
    color: var(--text-main);
}

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

/* ================= 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 0.3s ease;
    z-index: 9999;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

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

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

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

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

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

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

@media (max-width: 1024px) {
    #channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 18px;
    }
}

@media (max-width: 768px) {
    #app-container {
        padding: 20px 15px;
    }

    #main-header {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 15px;
    }

    #main-header h1 {
        font-size: 18px;
        justify-content: center;
    }

    .header-center {
        min-width: unset;
    }

    .header-right {
        justify-content: center;
        flex-wrap: wrap;
    }

    #jw-player {
        height: 230px;
    }

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

    .channel-logo {
        height: 100px !important;
        max-height: 100px;
    }

    #player-modal-content {
        padding: 15px;
    }

    .toast {
        bottom: 15px;
        right: 15px;
        left: 15px;
        font-size: 13px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    #channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .channel-logo {
        height: 80px !important;
        max-height: 80px;
        padding: 6px;
    }

    .channel-name {
        font-size: 12px;
        margin-top: 8px;
    }

    #main-header h1 {
        font-size: 16px;
    }

    .header-right a,
    #theme-toggle {
        font-size: 12px;
        padding: 7px 10px;
    }
}
