/* ============================================
   XVIDAPI — Shared Design System
   ============================================ */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: #000;
    color: #d4d4d4;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: #90caf9; text-decoration: none; transition: color 0.15s; }
a:hover { color: #fff; }

/* Container */
.container { max-width: 1400px; margin: 0 auto; padding: 0 16px; }

/* ---- Page Header & Breadcrumb ---- */
.page-header {
    background: linear-gradient(180deg, #0d0d0d 0%, #050505 100%);
    border-bottom: 1px solid #1a1a1a;
    padding: 20px 0;
}
.breadcrumb {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}
.breadcrumb a { color: #888; }
.breadcrumb a:hover { color: #90caf9; }
.breadcrumb span { margin: 0 6px; }
.breadcrumb .sep { margin: 0 6px; color: #444; }

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}
.page-subtitle {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

/* ---- Section Title ---- */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 24px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #90caf9;
    display: inline-block;
}

/* ---- Search Form ---- */
.search-bar {
    background: #0a0a0a;
    padding: 16px 0;
    border-bottom: 1px solid #1a1a1a;
}
.search-form {
    display: flex;
    justify-content: center;
    gap: 8px;
    max-width: 500px;
    margin: 0 auto;
}
.search-input {
    flex: 1;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
    border-color: #90caf9;
    box-shadow: 0 0 0 3px rgba(144, 202, 249, 0.1);
}
.search-btn {
    background: #90caf9;
    color: #000;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}
.search-btn:hover { background: #64b5f6; }
.search-btn:active { transform: scale(0.97); }

/* ---- Hero Section ---- */
.hero {
    background: linear-gradient(180deg, #111 0%, #000 100%);
    padding: 40px 0 30px;
    text-align: center;
    border-bottom: 1px solid #1a1a1a;
}
.hero h1 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px;
}
.hero p {
    color: #888;
    font-size: 14px;
    margin: 0 0 24px;
}

/* ---- Stats Bar ---- */
.stats-bar {
    background: #0a0a0a;
    border-bottom: 1px solid #1a1a1a;
    padding: 12px 0;
}

/* ---- Video Grid ---- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ---- Video Card ---- */
.video-card {
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid transparent;
}
.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(144, 202, 249, 0.08);
}

.video-card > a {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
}

.video-thumb {
    position: relative;
    padding-top: 56.25%;
    background: #1a1a1a;
    overflow: hidden;
    flex-shrink: 0;
}
.video-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.video-card:hover .video-thumb img {
    transform: scale(1.04);
}
.video-thumb img[src*="logo.png"] {
    object-fit: contain;
    background: #1a1a1a;
    padding: 20%;
}

/* Duration Badge */
.video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

/* Quality Badge */
.video-quality {
    position: absolute;
    bottom: 6px;
    left: 6px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.video-quality.q-1080p { background: linear-gradient(135deg, #f5a623, #f7c948); color: #1a1a2e; }
.video-quality.q-720p  { background: linear-gradient(135deg, #00b4d8, #48cae4); color: #1a1a2e; }
.video-quality.q-480p  { background: rgba(255,255,255,0.2); color: #ccc; }
.video-quality.q-other { background: rgba(255,255,255,0.15); color: #999; }

/* Video Info */
.video-info {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.video-title {
    font-size: 13px;
    font-weight: 500;
    color: #e0e0e0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 6px;
    min-height: 36px;
}
.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #666;
    margin-top: auto;
}
.video-category {
    background: #1a1a1a;
    padding: 2px 8px;
    border-radius: 4px;
    color: #888;
    transition: background 0.15s;
}
.video-card:hover .video-category {
    background: #222;
}
.video-views { color: #888; }

/* ---- API Button ---- */
.api-btn {
    display: block;
    background: #1a1a1a;
    color: #90caf9;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 8px;
    border: 1px solid #333;
    transition: all 0.2s;
    text-align: center;
}
.api-btn:hover {
    background: #90caf9;
    color: #000;
    border-color: #90caf9;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 32px 0;
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    padding: 8px 14px;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    font-size: 13px;
    transition: all 0.2s;
}
.pagination a:hover {
    background: #1a1a1a;
    color: #fff;
    border-color: #444;
    transform: translateY(-1px);
}
.pagination .current {
    background: #90caf9;
    color: #000;
    border-color: #90caf9;
}

/* ---- No Results ---- */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}
.no-results h2 {
    font-size: 20px;
    color: #888;
    margin-bottom: 12px;
}
.no-results p {
    font-size: 14px;
    margin-bottom: 20px;
}
.no-results a {
    display: inline-block;
    background: #90caf9;
    color: #000;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
}

/* ---- Toast ---- */
.toast {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #333;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Scroll-to-Top Button ---- */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(144, 202, 249, 0.15);
    color: #90caf9;
    border: 1px solid rgba(144, 202, 249, 0.3);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}
.scroll-top-btn:hover {
    background: #90caf9;
    color: #000;
    transform: translateY(-2px);
}
.scroll-top-btn.visible {
    display: flex;
}

/* ---- Fade-in Animation ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.video-card {
    animation: fadeInUp 0.4s ease both;
}
.video-grid .video-card:nth-child(2) { animation-delay: 0.03s; }
.video-grid .video-card:nth-child(3) { animation-delay: 0.06s; }
.video-grid .video-card:nth-child(4) { animation-delay: 0.09s; }
.video-grid .video-card:nth-child(5) { animation-delay: 0.12s; }
.video-grid .video-card:nth-child(6) { animation-delay: 0.15s; }
.video-grid .video-card:nth-child(7) { animation-delay: 0.18s; }
.video-grid .video-card:nth-child(8) { animation-delay: 0.21s; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hero { padding: 24px 0 20px; }
    .hero h1 { font-size: 22px; }
    .search-form {
        flex-direction: column;
        padding: 0 16px;
    }
    .search-input, .search-btn { width: 100%; }
    .page-title { font-size: 20px; }
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .video-info { padding: 8px 10px; }
    .video-title { font-size: 12px; min-height: 30px; }
    .video-quality { font-size: 9px; padding: 1px 4px; }
    .video-duration { font-size: 10px; }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}
