/* ============================================
   FilmDizi - Dark Theme Responsive UI
   ============================================ */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --bg-overlay: rgba(0, 0, 0, 0.85);
    --bg-input: #1e1e30;

    --text-primary: #f0f0f5;
    --text-secondary: #9898b0;
    --text-muted: #5a5a7a;

    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-glow: rgba(124, 58, 237, 0.3);
    --accent-light: #a78bfa;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);

    --nav-height: 64px;
    --container-width: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

input {
    font-family: inherit;
    border: none;
    outline: none;
}

/* ============================================
   Container
   ============================================ */

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   Navbar
   ============================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: background 0.3s;
}

.navbar.scrolled {
    background: rgba(10, 10, 15, 0.95);
}

.nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.logo-text {
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent-light);
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.15);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #9333ea);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 60px var(--accent-glow);
}

.btn-ghost {
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ============================================
   Search Overlay
   ============================================ */

.search-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay-content {
    width: 100%;
    max-width: 680px;
    padding: 0 20px;
}

.search-box-large {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    transition: border-color 0.2s;
}

.search-box-large:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.search-box-large svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box-large input {
    flex: 1;
    background: none;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.search-box-large input::placeholder {
    color: var(--text-muted);
}

.search-close {
    color: var(--text-muted);
    transition: color 0.2s;
    flex-shrink: 0;
}

.search-close:hover {
    color: var(--text-primary);
}

.search-filters {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding: 0 4px;
}

.filter-btn {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.filter-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
}

.filter-btn.active {
    color: white;
    background: var(--accent);
    border-color: var(--accent);
}

.search-results {
    margin-top: 24px;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.search-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.search-placeholder p {
    margin-top: 16px;
    font-size: 0.95rem;
}

/* Search Result Card */
.result-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.result-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateX(4px);
}

.result-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.result-icon.video {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(168, 85, 247, 0.2));
    color: var(--accent-light);
}

.result-icon.audio {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(52, 211, 153, 0.2));
    color: var(--success);
}

.result-icon.document {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.2));
    color: var(--warning);
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.result-meta .size {
    color: var(--accent-light);
    font-weight: 500;
}

.result-meta .source {
    color: var(--success);
}

.result-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #9333ea);
    color: white;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.result-card:hover .result-action {
    transform: scale(1.1);
}

/* Search Results Info */
.results-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.results-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    padding-top: var(--nav-height);
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.15), transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.08), transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(99, 102, 241, 0.06), transparent 40%);
}

.hero-content {
    position: relative;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 60px 20px;
}

.hero-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(124, 58, 237, 0.15);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 24px;
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 520px;
    margin-bottom: 36px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================
   Sections
   ============================================ */

.section {
    padding: 60px 0;
}

.section-dark {
    background: var(--bg-secondary);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.section-subtitle {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 1rem;
}

.text-center {
    text-align: center;
}

/* Recent Tags */
.recent-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.recent-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.recent-tag:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.recent-tag svg {
    width: 14px;
    height: 14px;
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 40px;
}

.step-card {
    text-align: center;
    padding: 40px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    position: relative;
    transition: all 0.3s;
}

.step-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.step-number {
    position: absolute;
    top: 16px;
    left: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-light);
    background: rgba(124, 58, 237, 0.15);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.step-icon {
    color: var(--accent-light);
    margin-bottom: 20px;
}

.step-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.step-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   Loading Modal
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    text-align: center;
    padding: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-top: 24px;
    font-size: 1.2rem;
}

.modal-content p {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Loader */
.loader {
    display: flex;
    justify-content: center;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 420px;
    animation: toastIn 0.3s ease-out;
    font-size: 0.9rem;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-info { border-left: 3px solid var(--accent); }

.toast.removing {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ============================================
   Player Page
   ============================================ */

.player-page {
    background: #000;
}

.navbar-player {
    background: rgba(0, 0, 0, 0.9);
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

.player-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-wrapper {
    padding-top: var(--nav-height);
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.player-container {
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 16 / 9;
    background: #0a0a0a;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.player-loading, .player-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-secondary);
}

.player-error svg {
    color: var(--danger);
}

#videoPlayer {
    width: 100%;
    height: 100%;
    background: #000;
}

/* Progress Bar */
.progress-bar-container {
    width: 250px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a855f7);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--accent-light);
}

/* Player Info */
.player-info {
    padding: 32px 0;
    background: var(--bg-primary);
}

.info-grid {
    display: flex;
    gap: 24px;
}

.info-main h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.info-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meta-badge {
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================
   Footer
   ============================================ */

.footer {
    padding: 40px 0;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    :root {
        --nav-height: 56px;
    }

    .nav-links {
        display: none;
    }

    .hero {
        min-height: 75vh;
    }

    .hero-content {
        padding: 40px 20px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-desc {
        font-size: 0.95rem;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .btn {
        justify-content: center;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .step-card {
        padding: 28px 20px;
    }

    .search-overlay {
        padding-top: 20px;
    }

    .search-box-large {
        padding: 12px 16px;
    }

    .search-box-large input {
        font-size: 1rem;
    }

    .result-card {
        padding: 12px;
        gap: 12px;
    }

    .result-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .result-name {
        font-size: 0.85rem;
    }

    .result-action {
        width: 36px;
        height: 36px;
    }

    .section {
        padding: 40px 0;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .player-container {
        border-radius: 0;
    }

    .player-title {
        max-width: 150px;
        font-size: 0.85rem;
    }

    .toast {
        min-width: auto;
        max-width: calc(100vw - 40px);
    }

    .toast-container {
        right: 10px;
        left: 10px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .btn-lg {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .search-filters {
        gap: 6px;
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    .results-info {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

/* ============================================
   Scrollbar (Global)
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   Skeleton Loading
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.skeleton-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
}

.skeleton-lines {
    flex: 1;
}

.skeleton-line {
    height: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.skeleton-line:last-child {
    width: 60%;
    margin-bottom: 0;
}
