/* ============================================
   ANIME STREAM - MODERN DARK THEME
   ============================================ */

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

:root {
    /* Primary Colors */
    --primary: #ff6b6b;
    --primary-light: #ff8e8e;
    --primary-dark: #ff5252;
    --primary-gradient: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    
    /* Background Colors */
    --bg-dark: #0a0a12;
    --bg-card: #14141f;
    --bg-card-hover: #1a1a2a;
    --bg-elevated: #1e1e2f;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6a6a7a;
    
    /* Accent Colors */
    --accent-green: #4ade80;
    --accent-blue: #60a5fa;
    --accent-purple: #a78bfa;
    --accent-orange: #fb923c;
    
    /* Rating Colors */
    --rating-high: #4ade80;
    --rating-medium: #fbbf24;
    --rating-low: #f87171;
    
    /* UI Elements */
    --border-color: #2a2a3a;
    --border-light: #3a3a4a;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 107, 107, 0.3);
    
    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* ============================================
   BASE STYLES
   ============================================ */

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

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

header {
    background: rgba(20, 20, 31, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 24px;
    flex-wrap: wrap;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

/* Search Form */
.search-form {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 14px 20px 14px 45px;
    background: var(--bg-elevated);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

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

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.15);
}

.search-form::before {
    content: '🔍';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.5;
}

.search-btn {
    display: none;
}

/* Navigation */
nav {
    display: flex;
    gap: 8px;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

nav a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--radius-md);
}

nav a:hover::before,
nav a.active::before {
    opacity: 0.1;
}

nav a:hover,
nav a.active {
    color: var(--text-primary);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    padding: 80px 24px;
    text-align: center;
    border-radius: var(--radius-xl);
    margin: 30px 0;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,107,107,0.08) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.5; }
    50% { transform: scale(1.1) rotate(180deg); opacity: 0.8; }
}

.hero h1 {
    font-size: 56px;
    font-weight: 900;
    margin-bottom: 16px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
    letter-spacing: -1px;
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 30px;
    position: relative;
    z-index: 1;
}

.random-btn {
    padding: 16px 40px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-xl);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
    position: relative;
    z-index: 1;
}

.random-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.5);
}

/* ============================================
   FILTERS
   ============================================ */

.filters {
    background: var(--bg-card);
    padding: 24px;
    margin: 30px 0;
    border-radius: var(--radius-lg);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}

.filter-group label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.filter-select {
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.filter-select:hover {
    border-color: var(--border-light);
}

.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}

/* ============================================
   SECTION TITLE
   ============================================ */

.section-title {
    font-size: 32px;
    font-weight: 800;
    margin: 50px 0 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 28px;
    padding: 20px 0;
}

.anime-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.anime-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--primary);
}

.anime-poster {
    position: relative;
    width: 100%;
    height: 330px;
    overflow: hidden;
    background: var(--bg-elevated);
}

.anime-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.anime-card:hover .anime-poster img {
    transform: scale(1.1);
}

.anime-rating {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary-gradient);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.age-rating {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.age-rating.rating-g {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: white;
}

.age-rating.rating-pg13 {
    background: linear-gradient(135deg, #fb923c, #f97316);
    color: white;
}

.age-rating.rating-r17,
.age-rating.rating-r {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: white;
}

.anime-info {
    padding: 18px;
}

.anime-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    min-height: 44px;
}

.anime-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 400;
}

.anime-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   ANIME DETAIL PAGE
   ============================================ */

.anime-detail {
    padding: 40px 0;
}

.anime-header {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 45px;
    margin-bottom: 45px;
    background: var(--bg-card);
    padding: 35px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.anime-poster-large {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.anime-poster-large img {
    width: 100%;
    height: auto;
    display: block;
}

.anime-info-large h1 {
    font-size: 40px;
    font-weight: 900;
    margin-bottom: 12px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.anime-info-large h2 {
    font-size: 22px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 20px;
}

.anime-description {
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 25px 0;
    font-size: 15px;
}

.anime-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 30px 0;
}

.stat-item {
    background: var(--bg-elevated);
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-item:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-value {
    font-size: 17px;
    font-weight: 700;
    margin-top: 6px;
    color: var(--primary);
}

/* ============================================
   VIDEO PLAYER
   ============================================ */

.player-section {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 30px;
    margin-top: 35px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.player-section h2 {
    margin-bottom: 25px;
    font-size: 28px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.player-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: #000;
    box-shadow: var(--shadow-lg);
}

.player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   LOADING & ERROR
   ============================================ */

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-elevated);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background: rgba(248, 113, 113, 0.1);
    border: 2px solid var(--rating-low);
    color: var(--rating-low);
    padding: 25px;
    border-radius: var(--radius-md);
    text-align: center;
    margin: 40px 0;
    font-weight: 500;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 50px 0;
    flex-wrap: wrap;
}

.page-btn {
    padding: 12px 20px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.page-btn.active {
    background: var(--primary-gradient);
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background: var(--bg-card);
    padding: 35px 0;
    margin-top: 80px;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* ============================================
   CATALOG PAGE
   ============================================ */

.catalog-page {
    padding: 40px 0;
}

.catalog-page h1 {
    margin-bottom: 35px;
    font-size: 40px;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

@media (max-width: 1024px) {
    .anime-header {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .anime-poster-large {
        max-width: 300px;
        margin: 0 auto;
    }
    
    .anime-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
    }
    
    .search-form {
        margin: 0;
        max-width: 100%;
        width: 100%;
    }
    
    .hero h1 {
        font-size: 36px;
    }
    
    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .anime-poster {
        height: 240px;
    }
    
    nav {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.anime-card:nth-child(1) { animation-delay: 0.05s; }
.anime-card:nth-child(2) { animation-delay: 0.1s; }
.anime-card:nth-child(3) { animation-delay: 0.15s; }
.anime-card:nth-child(4) { animation-delay: 0.2s; }
.anime-card:nth-child(5) { animation-delay: 0.25s; }
.anime-card:nth-child(6) { animation-delay: 0.3s; }
