/* style.css - VERSIONE "MIDNIGHT COMPLETE" (Sito + Auth + Admin Isolato) */

/* =========================================
   PARTE 1: SITO PUBBLICO (Home, Watch, Profile)
   ========================================= */
:root {
    --bg-deep: #0f172a;
    --bg-card: #1e293b;
    --primary: #06b6d4;
    --primary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-hover: #22d3ee;
    --radius-std: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    margin: 0; padding: 0; padding-bottom: 60px;
    background-image: radial-gradient(circle at top right, #1e1b4b 0%, transparent 40%),
                      radial-gradient(circle at bottom left, #0f172a 0%, transparent 40%);
    background-attachment: fixed;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
* { box-sizing: border-box; }

/* HEADER PUBBLICO */
/* --- INIZIO MODIFICA HEADER UNIFICATO --- */

/* Stile unico per tutte le intestazioni (Index, User, Profile, Watch) */
header, .profile-nav, .cinema-header {
    background: rgba(15, 23, 42, 0.8) !important; /* Sfondo traslucido scuro */
    backdrop-filter: blur(10px) !important;       /* Effetto sfocatura */
    border-bottom: 1px solid rgba(255,255,255,0.1);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
    box-sizing: border-box;
}

/* Logo sempre a sinistra */
.logo, .nav-brand {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto; /* Forza il logo a sinistra spingendo il resto a destra */
}
.logo span, .nav-brand span {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo img, .nav-brand img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Reset per i contenitori interni per garantire l'allineamento */
.left-group, .nav-side {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Pulsanti Header Uniformati */
.btn-header-primary {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    color: #fff;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: 0.3s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-header-primary:hover {
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

.btn-header-secondary {
    background: transparent;
    color: #cbd5e1;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: 0.3s;
}
.btn-header-secondary:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

/* Nascondi elementi vecchi che potrebbero confliggere */
.btn-home-circle { display: none !important; }

/* --- FINE MODIFICA HEADER UNIFICATO --- */
.left-group { display: flex; align-items: center; gap: 20px; }
.logo { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; color: #fff; }
.logo span { background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* SEARCH */
.search-wrap { position: relative; }
.search-input {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50px; padding: 8px 15px 8px 35px; color: #fff; outline: none;
    width: 200px; transition: 0.3s; font-size: 0.9rem;
}
.search-input:focus { width: 260px; border-color: var(--primary); background: rgba(0,0,0,0.3); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 14px; fill: var(--text-muted); }

.right-menu { display: flex; align-items: center; gap: 20px; }
.btn-upload-visibile {
    background: var(--primary-gradient); color: white; padding: 8px 20px; border-radius: 50px;
    font-weight: bold; font-size: 0.9rem; display: flex; align-items: center; gap: 5px;
}
.profile-link { display: flex; align-items: center; gap: 10px; opacity: 0.9; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #333; border: 2px solid rgba(255,255,255,0.1); }
.btn-logout {
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main); padding: 8px 16px; border-radius: 50px; font-weight: 600; font-size: 0.85rem;
}

/* AUTHENTICATION PAGES (Login & Register) */
.auth-container {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; padding: 20px; padding-top: 80px; /* Spazio per header */
}
.auth-card {
    background: rgba(30, 41, 59, 0.7); backdrop-filter: blur(20px);
    width: 100%; max-width: 420px; padding: 40px;
    border-radius: 24px; border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}
.auth-title { font-size: 2rem; font-weight: 800; margin-bottom: 10px; color: #fff; letter-spacing: -0.5px; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 30px; font-size: 0.95rem; }

.auth-input {
    width: 100%; padding: 14px 20px; margin-bottom: 15px;
    background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px; color: #fff; outline: none; transition: 0.3s; font-size: 1rem;
}
.auth-input:focus { border-color: var(--primary); background: rgba(15, 23, 42, 0.8); box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15); }

.auth-btn {
    width: 100%; padding: 14px; border-radius: 50px;
    background: var(--primary-gradient); color: #fff;
    border: none; font-weight: 700; font-size: 1rem; cursor: pointer;
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.25); transition: 0.3s;
    margin-top: 10px;
}
.auth-btn:hover { transform: translateY(-2px); box-shadow: 0 15px 35px rgba(6, 182, 212, 0.35); }

.auth-footer { margin-top: 25px; font-size: 0.9rem; color: var(--text-muted); }
.auth-link { color: var(--accent-hover); font-weight: 600; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

.alert-error {
    background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5; padding: 12px; border-radius: 10px; margin-bottom: 20px; font-size: 0.9rem; text-align: center;
}
.alert-success {
    background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7; padding: 12px; border-radius: 10px; margin-bottom: 20px; font-size: 0.9rem; text-align: center;
}

/* HERO SECTION */
.hero-section { position: relative; width: 100vw; height: 100vh; overflow: hidden; background: #000; margin-top: 0; }
.hero-video-bg { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; object-fit: cover; z-index: 1; transition: opacity 0.8s; pointer-events: none; }
.hero-video-bg.fade-out { opacity: 0; }
.hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to top, var(--bg-deep) 5%, transparent 60%), linear-gradient(to right, rgba(0,0,0,0.8) 0%, transparent 60%); z-index: 2; pointer-events: none; }
.hero-content { position: absolute; bottom: 120px; left: 60px; z-index: 10; max-width: 650px; transition: opacity 0.5s; }
.hero-content.fade-out { opacity: 0; }
.hero-tag { color: var(--accent-hover); font-weight: 800; font-size: 0.9rem; letter-spacing: 2px; margin-bottom: 15px; }
.hero-title { font-size: 3.8rem; font-weight: 800; margin-bottom: 20px; line-height: 1.1; text-shadow: 0 4px 10px rgba(0,0,0,0.8); }
.hero-desc { font-size: 1.15rem; color: #e2e8f0; margin-bottom: 35px; max-width: 600px; text-shadow: 0 2px 4px rgba(0,0,0,0.9); }
.btn-row { display: flex; gap: 15px; align-items: center; }
.btn { padding: 14px 35px; font-size: 1.1rem; border-radius: 50px; font-weight: 700; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.btn-play { background: var(--primary-gradient); color: #fff; }
.btn-info { background: rgba(255,255,255,0.2); color: #fff; backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.2); }
.btn-mute { width: 50px; height: 50px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); background: rgba(0,0,0,0.4); color: white; cursor: pointer; display: flex; justify-content: center; align-items: center; }
.dots { display: flex; gap: 12px; position: absolute; right: 60px; bottom: 50%; flex-direction: column; z-index: 20; }
.dot { width: 12px; height: 12px; background: rgba(255,255,255,0.2); border-radius: 50%; cursor: pointer; }
.dot.active { background: #fff; transform: scale(1.4); }

/* LISTE VIDEO */
.main-content { padding: 40px 0 80px 0; position: relative; z-index: 20; margin-top: -80px; background: linear-gradient(to bottom, transparent, var(--bg-deep) 20%); }
.cat-title { font-size: 1.4rem; font-weight: 700; margin: 40px 0 20px 40px; color: var(--text-main); padding-left: 15px; border-left: 4px solid var(--primary); }
.slider { display: flex; overflow-x: auto; padding: 10px 40px 40px 40px; gap: 20px; scrollbar-width: none; }
.slider::-webkit-scrollbar { display: none; }
.card { flex: 0 0 260px; position: relative; cursor: pointer; transition: box-shadow 0.3s, border-color 0.3s; border-radius: 12px; background: var(--bg-card); border: 1px solid rgba(255,255,255,0.05); overflow: hidden; }
.card:hover { border-color: var(--primary); box-shadow: 0 15px 30px rgba(0,0,0,0.5), 0 0 10px rgba(6, 182, 212, 0.2); z-index: 10; }
.thumb-wrapper { position: relative; width: 100%; height: 150px; }
.thumb { width: 100%; height: 100%; object-fit: cover; }
.card-title { font-size: 0.95rem; margin: 12px 15px; color: #e2e8f0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-container { position: absolute; bottom: 0; left: 0; width: 100%; height: 4px; background: rgba(255,255,255,0.2); }
.progress-fill { height: 100%; background: var(--primary-gradient); }
.badge-watched { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.8); border: 1px solid #4ade80; color: #4ade80; font-size: 0.7rem; padding: 3px 8px; border-radius: 4px; font-weight: bold; }

/* RANKING */
.rank-number { position: absolute; top: 0; left: 0; width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 900; color: #fff; background: rgba(15,23,42,0.9); border-bottom-right-radius: 15px; border-top-left-radius: 12px; z-index: 20; border-right: 1px solid rgba(255,255,255,0.1); border-bottom: 1px solid rgba(255,255,255,0.1); }
.rank-1 { background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%); color: #000; font-size: 1.5rem; }
.rank-2 { background: linear-gradient(135deg, #E0E0E0 0%, #BDBDBD 100%); color: #333; font-size: 1.3rem; }
.rank-3 { background: linear-gradient(135deg, #CD7F32 0%, #A0522D 100%); color: #fff; font-size: 1.3rem; }

/* MODAL & COMMENTS */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,23,42,0.9); z-index: 3000; display: none; justify-content: center; align-items: center; backdrop-filter: blur(8px); }
.modal-box { background: #1e293b; width: 90%; max-width: 650px; padding: 40px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1); }
.modal-h2 { font-size: 2.2rem; margin-bottom: 15px; color: #fff; }
.modal-meta { color: var(--primary); font-weight: 700; margin-bottom: 25px; display: flex; gap: 20px; }
.modal-p { color: #cbd5e1; margin-bottom: 35px; line-height: 1.6; }
.modal-btn { display: block; width: 100%; padding: 15px; background: #fff; color: #000; text-align: center; border-radius: 50px; font-weight: 800; }
.modal-close { position: absolute; top: 20px; right: 20px; background: rgba(255,255,255,0.1); border: none; color: #fff; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }
.interaction-bar { display: flex; align-items: center; gap: 15px; margin-top: 20px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,0.1); }
.vote-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.1); color: #fff; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-weight: 600; }
.vote-btn.active-like { background: rgba(34,197,94,0.2); color: #4ade80; border-color: #22c55e; }
.vote-btn.active-dislike { background: rgba(239,68,68,0.2); color: #f87171; border-color: #ef4444; }
.comments-section { margin-top: 40px; background: rgba(30,41,59,0.4); padding: 30px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); }
.comments-header { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }
.comment-form { display: flex; gap: 15px; margin-bottom: 30px; }
.comment-input { flex: 1; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); padding: 12px; border-radius: 8px; color: #fff; outline: none; }
.btn-send { background: var(--primary-gradient); color: #fff; border: none; padding: 0 25px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.comments-list { display: flex; flex-direction: column; gap: 20px; }
.comment-item { display: flex; gap: 15px; }
.comment-avatar { width: 40px; height: 40px; border-radius: 50%; background: #333; display: flex; align-items: center; justify-content: center; font-weight: bold; border: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.comment-user { font-weight: 700; margin-bottom: 4px; font-size: 0.9rem; }
.comment-date { color: #94a3b8; font-weight: 400; margin-left: 10px; font-size: 0.75rem; }
.comment-text { color: #cbd5e1; font-size: 0.95rem; line-height: 1.5; }
.btn-load-more { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff; padding: 10px; width: 100%; border-radius: 8px; cursor: pointer; margin-top: 15px; font-weight: bold; }


/* =========================================
   PARTE 2: ADMIN PANEL (ISOLATO)
   ========================================= */
/* Usa l'ID #admin-app per isolare completamente lo stile */
#admin-app {
    display: grid;
    grid-template-columns: 280px 1fr; /* Sidebar | Content */
    height: 100vh; width: 100vw;
    background-color: #0f172a;
    background-image: none; /* RIMUOVE SFONDO SITO */
    color: #f1f5f9;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    position: fixed; top:0; left:0; /* Blocca viewport */
    z-index: 9999;
}

/* Sidebar Admin */
.ad-sidebar {
    background: #1e293b;
    border-right: 1px solid rgba(255,255,255,0.05);
    padding: 25px;
    display: flex; flex-direction: column;
    z-index: 10;
}
.ad-logo { font-size: 1.5rem; font-weight: 800; color: #fff; margin-bottom: 40px; letter-spacing: -0.5px; }
.ad-logo span { color: #06b6d4; }
.ad-nav-btn {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; margin-bottom: 8px; color: #94a3b8;
    cursor: pointer; border-radius: 10px; transition: 0.2s;
    font-weight: 500; font-size: 0.95rem; text-decoration: none;
}
.ad-nav-btn:hover { background: rgba(255,255,255,0.05); color: #fff; }
.ad-nav-btn.active { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.ad-badge { background: #ef4444; color: white; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: bold; display: none; }
.ad-badge.show { display: inline-block; animation: adPulse 2s infinite; }
@keyframes adPulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* Main Content Admin */
.ad-main {
    display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
    background: #0f172a;
}
.ad-header {
    height: 70px; border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 40px; background: #1e293b;
}
.ad-content {
    flex: 1; overflow-y: auto; padding: 40px;
    scrollbar-width: thin; scrollbar-color: #334155 transparent;
}

/* Stats Cards */
.ad-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.ad-card { background: #1e293b; padding: 25px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.ad-num { font-size: 2rem; font-weight: 800; color: #fff; margin-top: 5px; }
.ad-label { color: #94a3b8; font-size: 0.85rem; text-transform: uppercase; font-weight: 700; letter-spacing: 1px; }

/* Tables */
.ad-table-wrap { background: #1e293b; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); overflow: hidden; }
.ad-table { width: 100%; border-collapse: collapse; }
.ad-table th { text-align: left; padding: 15px 25px; background: rgba(0,0,0,0.2); color: #94a3b8; font-size: 0.8rem; text-transform: uppercase; font-weight: 700; }
.ad-table td { padding: 15px 25px; border-bottom: 1px solid rgba(255,255,255,0.03); color: #e2e8f0; vertical-align: middle; font-size: 0.95rem; }
.ad-table tr:hover td { background: rgba(255,255,255,0.02); }
.ad-thumb { width: 80px; height: 45px; object-fit: cover; border-radius: 6px; background: #000; cursor: pointer; }

/* Buttons */
.ad-btn { padding: 6px 12px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: 0.2s; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; margin-right: 5px; }
.ad-btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn-green { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.btn-blue { background: rgba(6, 182, 212, 0.2); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }
.btn-red { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-ghost { background: transparent; color: #94a3b8; border: 1px solid rgba(255,255,255,0.2); }

/* Switch Moderno (Bello e Grande) */
.ad-switch-card {
    display: flex; align-items: center; justify-content: space-between;
    background: #1e293b; padding: 25px; border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05); max-width: 600px;
}
.ad-switch { position: relative; display: inline-block; width: 64px; height: 36px; }
.ad-switch input { opacity: 0; width: 0; height: 0; }
.ad-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155; transition: .4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 36px; border: 2px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}
.ad-slider:before {
    position: absolute; content: ""; height: 26px; width: 26px; left: 3px; bottom: 3px;
    background-color: #94a3b8; transition: .4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.ad-switch input:checked + .ad-slider { background-color: rgba(6, 182, 212, 0.2); border-color: #06b6d4; }
.ad-switch input:checked + .ad-slider:before { transform: translateX(28px); background-color: #06b6d4; box-shadow: 0 0 15px #06b6d4; }

/* Inputs */
.ad-search { background: #1e293b; border: 1px solid rgba(255,255,255,0.1); padding: 10px 20px; border-radius: 50px; color: #fff; width: 300px; outline: none; }
.ad-search:focus { border-color: #06b6d4; }
.ad-inp { width: 100%; padding: 12px; margin-bottom: 15px; background: #0f172a; border: 1px solid rgba(255,255,255,0.1); color: #fff; border-radius: 8px; outline: none; }

/* Modal & Toast */
.ad-modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(5px); z-index: 5000; display: none; align-items: center; justify-content: center; }
.ad-modal-panel { background: #1e293b; width: 500px; padding: 30px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 25px 60px rgba(0,0,0,0.7); }
.ad-toast {
    position: fixed; bottom: 30px; right: 30px; background: #1e293b; color: #fff; border-left: 4px solid #06b6d4;
    padding: 15px 25px; border-radius: 8px; font-weight: 600; box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    transform: translateY(100px); opacity: 0; transition: all 0.4s; z-index: 9999;
}
.ad-toast.show { transform: translateY(0); opacity: 1; }
