/* AlloAnime CSS - Premium Dark Theme & Glassmorphism Design */

:root {
    --bg-main: #0a090f;
    --bg-surface: #12101a;
    --bg-elevated: #1b1828;
    --bg-glass: rgba(18, 16, 26, 0.75);
    
    --accent-purple: #8b3cff;
    --accent-purple-glow: rgba(139, 60, 255, 0.4);
    --accent-purple-hover: #a566ff;
    
    --text-primary: #ffffff;
    --text-secondary: #9c99ab;
    --text-muted: #646175;
    
    --color-download: #00e676;
    --color-upload: #ff1744;
    
    --border-color: rgba(255, 255, 255, 0.05);
    --border-glow: rgba(139, 60, 255, 0.15);
    
    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

/* Custom Header with Glassmorphism */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4%;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.logo {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    cursor: pointer;
}

.logo-accent {
    color: var(--accent-purple);
    text-shadow: 0 0 15px var(--accent-purple-glow);
}

.badge-p2p {
    font-size: 10px;
    background: var(--accent-purple);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    padding: 6px 12px;
    border-radius: 8px;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-links a.active {
    border-bottom: 2px solid var(--accent-purple);
    border-radius: 8px 8px 0 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 8px 16px;
    gap: 10px;
    width: 250px;
    transition: var(--transition-smooth);
}

.search-box:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple-glow);
    width: 300px;
}

.search-box i {
    color: var(--text-secondary);
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    outline: none;
    width: 100%;
    font-size: 14px;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.btn-primary:hover {
    background: var(--accent-purple-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 60, 255, 0.6);
}

/* Hero Section (Netflix style) */
.hero-section {
    position: relative;
    height: 70vh;
    min-height: 500px;
    width: 100%;
    margin-top: 80px;
    display: flex;
    align-items: center;
    padding: 0 6%;
    background-size: cover;
    background-position: center 20%;
    background-image: linear-gradient(to right, rgba(10, 9, 15, 0.95) 30%, rgba(10, 9, 15, 0.3) 100%), url('https://webtorrent.io/torrents/sintel.jpg');
    transition: var(--transition-smooth);
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    background: linear-gradient(to top, var(--bg-main), transparent);
    z-index: 1;
}

.hero-content {
    max-width: 600px;
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(139, 60, 255, 0.2);
    border: 1px solid var(--accent-purple);
    color: #c9a4ff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 64px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 15px;
    letter-spacing: -1.5px;
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 25px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    align-items: center;
}

.hero-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Catalogue & Filters */
.catalog-section {
    padding: 40px 6%;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.category-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.filter-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 4px 12px var(--accent-purple-glow);
}

/* Anime Grid & Card System */
.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    min-height: 250px;
}

.grid-loader {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 16px;
}

.grid-loader i {
    font-size: 30px;
    color: var(--accent-purple);
}

.anime-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.anime-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-purple);
    box-shadow: 0 12px 30px rgba(139, 60, 255, 0.25);
}

.card-poster-wrapper {
    position: relative;
    width: 100%;
    padding-top: 140%; /* 2:3 ratio */
    overflow: hidden;
    background-color: var(--bg-elevated);
}

.card-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

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

.card-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 9, 15, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: var(--transition-smooth);
}

.anime-card:hover .card-play-overlay {
    opacity: 1;
}

.card-play-btn {
    width: 55px;
    height: 55px;
    background: var(--accent-purple);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 0 20px var(--accent-purple-glow);
    transform: scale(0.8);
    transition: var(--transition-smooth);
}

.anime-card:hover .card-play-btn {
    transform: scale(1);
}

.card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-category {
    font-size: 11px;
    color: var(--accent-purple);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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



/* Player Modal Overlay (Full Window) */
.player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 4, 8, 0.95);
    z-index: 1000;
    display: none; /* Controlled by JS */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-overlay.active {
    display: flex;
    opacity: 1;
}

.player-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.close-player-btn {
    position: absolute;
    top: 15px;
    right: 25px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    z-index: 1010;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.close-player-btn:hover {
    background: var(--color-upload);
    border-color: var(--color-upload);
}

.player-main-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: calc(100% - 20px);
    margin-top: 30px;
}

/* Video Player Container */
.video-container {
    position: relative;
    background: #000;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
    width: 100%;
    height: 100%;
}

.video-container video {
    width: 100%;
    height: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.video-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 9, 15, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    gap: 15px;
    padding: 20px;
    text-align: center;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(139, 60, 255, 0.1);
    border-top: 4px solid var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px var(--accent-purple-glow);
}

.video-loader p {
    font-size: 18px;
    font-weight: 600;
}

.loader-substatus {
    color: var(--text-secondary);
    font-size: 14px !important;
    font-weight: 400 !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer Section */
footer {
    padding: 30px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-surface);
}

/* Responsiveness / Mobile Adaptations */
@media (max-width: 992px) {
    .player-main-layout {
        height: auto;
    }
    
    .video-container video {
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 0 15px;
    }
    .nav-links {
        display: none; /* Can implement mobile burger menu later */
    }
    .search-box {
        width: 150px;
    }
    .search-box:focus-within {
        width: 180px;
    }
    .hero-title {
        font-size: 40px;
    }
    .hero-section {
        height: 60vh;
    }

}

/* Pagination Styling */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
    user-select: none;
}

.page-btn:hover:not(.disabled):not(.active) {
    border-color: var(--accent-purple);
    color: var(--text-primary);
    background: rgba(139, 60, 255, 0.05);
}

.page-btn.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.01);
}

.page-btn.ellipsis {
    cursor: default;
    border-color: transparent;
    background: transparent;
}

/* View Containers Routing */
.view-container {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.view-container.hidden {
    display: none;
    opacity: 0;
}

/* Horizontal Carousels & Sections */
.scroll-section {
    padding: 30px 6%;
}

.scroll-section:last-of-type {
    padding-bottom: 60px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}

.scroll-arrows {
    display: flex;
    gap: 8px;
}

.scroll-arrow {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
    font-size: 14px;
}

.scroll-arrow:hover {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.horizontal-scroll-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 5px 20px 5px;
    margin: 0 -5px;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.horizontal-scroll-container::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.horizontal-scroll-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Row card styling (adapted to carousel context) */
.horizontal-scroll-container .anime-card {
    flex: 0 0 200px; /* Do not shrink, enforce width */
}

@media (max-width: 768px) {
    .horizontal-scroll-container .anime-card {
        flex: 0 0 160px; /* Narrower cards on mobile */
    }
    .scroll-arrows {
        display: none; /* Swipe on mobile instead */
    }
    .scroll-section {
        padding: 20px 4%;
    }
}
