/* ============================================
   AGM TV - Main Stylesheet
   نظام متجاوب بالكامل مع دعم الوضع المظلم
============================================ */

:root {
    /* الألوان الأساسية */
    --primary: #ff3b30;
    --primary-dark: #d32f2f;
    --primary-light: #ff6b5c;
    --primary-glow: rgba(255,59,48,0.3);
    
    --secondary: #ff9500;
    --secondary-dark: #e67e00;
    --secondary-glow: rgba(255,149,0,0.3);
    
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    
    /* الخلفيات */
    --bg-dark: #0a0a0f;
    --bg-darker: #000000;
    --bg-card: rgba(20, 20, 30, 0.8);
    --bg-glass: rgba(15, 15, 20, 0.7);
    
    /* النصوص */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    /* الحدود */
    --border-glow: rgba(255, 59, 48, 0.2);
    --border-light: rgba(255, 255, 255, 0.1);
    
    /* التحولات */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* الأبعاد */
    --navbar-height: 72px;
    --navbar-height-mobile: 60px;
    --border-radius: 16px;
    --border-radius-sm: 12px;
}

/* ============================================
   RESET & BASE
============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   SCROLLBAR
============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ============================================
   SELECTION
============================================ */
::selection {
    background: var(--primary);
    color: white;
}

/* ============================================
   TYPOGRAPHY
============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================
   NAVBAR - GLASS MORPHISM
============================================ */
.navbar {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    height: var(--navbar-height);
    transition: all var(--transition-normal);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.95);
    height: calc(var(--navbar-height) - 10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.navbar-brand {
    font-size: 1.6rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    transition: var(--transition-normal);
}

.navbar-brand:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.navbar-brand i {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 16px !important;
    border-radius: 30px;
    transition: all var(--transition-normal);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary) !important;
    background: rgba(255, 59, 48, 0.1);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 50%;
    transform: translateX(50%);
    width: 30px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* Search Input */
.search-input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-light);
    border-radius: 40px;
    padding: 8px 20px 8px 45px;
    color: white;
    font-size: 0.9rem;
    width: 220px;
    transition: all var(--transition-normal);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    outline: none;
    width: 260px;
}

.search-btn {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: pointer;
}

/* User Avatar */
.user-avatar-wrapper {
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    transition: var(--transition-normal);
}

.user-avatar.default {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Dropdown Menu */
.dropdown-menu {
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    padding: 8px;
    margin-top: 10px;
}

.dropdown-item {
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 10px 16px;
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--primary);
    color: white;
}

/* ============================================
   BUTTONS
============================================ */
.btn-premium {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: white;
    padding: 10px 24px;
    border-radius: 40px;
    font-weight: 700;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-premium:hover::before {
    left: 100%;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px var(--primary-glow);
}

.btn-outline-premium {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 8px 22px;
    border-radius: 40px;
    font-weight: 700;
    transition: var(--transition-normal);
}

.btn-outline-premium:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ============================================
   CARDS
============================================ */
.card-premium {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glow);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card-premium:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.3);
}

/* ============================================
   SECTIONS
============================================ */
.section {
    padding: 60px 0;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 800;
    position: relative;
    display: inline-block;
    padding-right: 15px;
    margin-bottom: 30px;
}

.section-title::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 4px;
}

/* Scroll Rows */
.row-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 10px 4px 20px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.row-scroll::-webkit-scrollbar {
    display: none;
}

.row-scroll > * {
    scroll-snap-align: start;
    flex: 0 0 auto;
}

/* ============================================
   MOVIE CARD
============================================ */
.movie-card {
    position: relative;
    width: 185px;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-card);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.movie-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.movie-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    transition: transform 0.5s;
}

.movie-card:hover img {
    transform: scale(1.06);
}

.movie-card .badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    z-index: 2;
}

.movie-card .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    padding: 45px 12px 12px;
    transform: translateY(6px);
    opacity: 0;
    transition: var(--transition-normal);
}

.movie-card:hover .overlay {
    transform: translateY(0);
    opacity: 1;
}

.movie-card .rating {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

/* ============================================
   FOOTER
============================================ */
.footer {
    background: linear-gradient(180deg, #0a0a0a 0%, #000000 100%);
    border-top: 1px solid var(--border-glow);
    padding: 60px 0 30px;
    margin-top: 60px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.footer-links a:hover {
    color: var(--primary);
    padding-right: 5px;
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
    color: var(--text-secondary);
}

.social-icon:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

/* ============================================
   LOADING & TOAST
============================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.loader {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 59, 48, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.custom-toast {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-right: 3px solid var(--primary);
    border-radius: var(--border-radius-sm);
    padding: 12px 20px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 992px) {
    .navbar-collapse {
        position: absolute;
        top: var(--navbar-height);
        right: 0;
        left: 0;
        background: rgba(0, 0, 0, 0.98);
        backdrop-filter: blur(20px);
        padding: 20px;
        border-bottom: 1px solid var(--border-light);
    }
    
    .search-input,
    .search-input:focus {
        width: 100%;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 768px) {
    :root {
        --navbar-height: 60px;
    }
    
    .movie-card {
        width: 140px;
    }
    
    .footer {
        text-align: center;
    }
    
    .social-icons {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .movie-card {
        width: 120px;
    }
    
    .section-title {
        font-size: 1.2rem;
    }
}

/* ============================================
   UTILITIES
============================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.cursor-pointer {
    cursor: pointer;
}

.overflow-hidden {
    overflow: hidden;
}

.aspect-2-3 {
    aspect-ratio: 2/3;
}

.aspect-16-9 {
    aspect-ratio: 16/9;
}

/* ============================================
   DARK MODE TOGGLE
============================================ */
.dark-mode-toggle {
    cursor: pointer;
    transition: var(--transition-normal);
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
}