/* iptv-downloader/assets/style.css */
:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --radius: 12px;
    --transition: 0.2s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
}

/* Utils */
.hidden { display: none !important; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.w-full { width: 100%; }
.text-sm { font-size: 0.875rem; }
.text-gray { color: var(--text-muted); }

/* Header */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    font-size: 1.25rem;
    color: var(--primary);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 5%;
}

.view {
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Cards & Glassmorphism */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Forms */
.login-card {
    max-width: 400px;
    margin: 4rem auto;
}
.login-card h2 { margin-bottom: 0.25rem; }
.subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

.input-group { margin-bottom: 1rem; }
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
input[type="text"], input[type="password"], input[type="url"], select.glass-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: white;
    font-size: 1rem;
    transition: var(--transition);
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius);
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; }
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.15); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-small { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Grid Series */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}
@media (min-width: 640px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.5rem; }
}

.series-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.series-card:hover { transform: translateY(-4px); border-color: var(--primary); }
.series-img-container {
    width: 100%;
    aspect-ratio: 2/3;
    background: rgba(0,0,0,0.3);
    position: relative;
}
.series-img { width: 100%; height: 100%; object-fit: cover; }
.series-info { padding: 0.75rem; }
.series-title { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Búsqueda */
.search-bar { margin-bottom: 2rem; }
.search-bar input { padding: 1rem 1.5rem; border-radius: 50px; }

/* Listado Episodios */
.series-info-header { display: flex; gap: 1.5rem; align-items: flex-start; }
.series-info-header img { width: 100px; border-radius: 8px; }
.list { display: flex; flex-direction: column; gap: 0.75rem; }
.episode-item {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    gap: 1rem;
}
@media (max-width: 600px) {
    .series-info-header { flex-direction: column; }
    .episode-item { flex-wrap: wrap; }
    .episode-actions { width: 100%; display: flex; justify-content: flex-end; }
}
.episode-img { width: 80px; height: 50px; object-fit: cover; border-radius: 4px; background:#000; }
.episode-details { flex-grow: 1; }
.episode-title { font-weight: 500; font-size: 0.95rem; }

/* Checkbox Custom */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
}
.checkbox-container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark { position: absolute; top: 50%; left: 0; transform: translateY(-50%); height: 20px; width: 20px; background-color: rgba(255,255,255,0.1); border: 1px solid var(--border-color); border-radius: 4px; transition: 0.2s; }
.checkbox-container:hover input ~ .checkmark { background-color: rgba(255,255,255,0.2); }
.checkbox-container input:checked ~ .checkmark { background-color: var(--primary); border-color: var(--primary); }
.checkmark:after { content: ""; position: absolute; display: none; }
.checkbox-container input:checked ~ .checkmark:after { display: block; }
.checkbox-container .checkmark:after { left: 7px; top: 3px; width: 5px; height: 10px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }

.actions-bar { display: flex; justify-content: space-between; align-items: center; padding: 1rem; }

/* Modal y Progreso */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-content { width: 90%; max-width: 400px; text-align: center; }
.progress-container { width: 100%; height: 10px; background: rgba(255,255,255,0.1); border-radius: 5px; overflow: hidden; margin: 1rem 0; }
.progress-bar { height: 100%; background: var(--primary); width: 0%; transition: width 0.3s linear; }
.progress-stats { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-muted); }

/* Loader CSS */
.loader { border: 2px solid rgba(255,255,255,0.3); border-top: 2px solid white; border-radius: 50%; width: 16px; height: 16px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Toasts */
#toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 9999; }
.toast { background: var(--card-bg); border-left: 4px solid var(--primary); padding: 1rem; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); backdrop-filter: blur(10px); animation: slideIn 0.3s ease; color: white;}
.toast.error { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0;} to { transform: translateX(0); opacity: 1;} }