/*
Theme Name: Giao Dien 1
Theme URI: https://example.com/giaodien1
Author: Developer
Author URI: https://example.com
Description: Modern dark theme for video websites. Integrates with Domain Manager plugin for multi-domain support.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: giaodien1
Tags: video, dark, responsive, custom-logo, custom-menu
*/

/* ===== CSS Variables ===== */
:root {
    /* Colors */
    --fv-bg-primary: #0a0a0a;
    --fv-bg-secondary: #141414;
    --fv-bg-tertiary: #1a1a1a;
    --fv-bg-card: #1e1e1e;
    --fv-bg-hover: #252525;

    --fv-text-primary: #ffffff;
    --fv-text-secondary: #a0a0a0;
    --fv-text-muted: #666666;

    --fv-accent: #ff4444;
    --fv-accent-hover: #ff6666;
    --fv-accent-dark: #cc3333;

    --fv-border: #2a2a2a;
    --fv-shadow: rgba(0, 0, 0, 0.5);

    /* Typography */
    --fv-font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --fv-font-size-xs: 0.75rem;
    --fv-font-size-sm: 0.875rem;
    --fv-font-size-base: 1rem;
    --fv-font-size-lg: 1.125rem;
    --fv-font-size-xl: 1.25rem;
    --fv-font-size-2xl: 1.5rem;
    --fv-font-size-3xl: 2rem;

    /* Spacing */
    --fv-spacing-xs: 0.25rem;
    --fv-spacing-sm: 0.5rem;
    --fv-spacing-md: 1rem;
    --fv-spacing-lg: 1.5rem;
    --fv-spacing-xl: 2rem;
    --fv-spacing-2xl: 3rem;

    /* Border Radius */
    --fv-radius-sm: 4px;
    --fv-radius-md: 8px;
    --fv-radius-lg: 12px;
    --fv-radius-full: 9999px;

    /* Layout */
    --fv-container-max: 1400px;
    --fv-header-height: 64px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--fv-font-primary);
    font-size: var(--fv-font-size-base);
    line-height: 1.6;
    color: var(--fv-text-primary);
    background-color: var(--fv-bg-primary);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--fv-accent);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

.fv-container {
    width: 100%;
    max-width: var(--fv-container-max);
    margin: 0 auto;
    padding: 0 var(--fv-spacing-md);
}

/* Visually hidden - for SEO h1 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Header ===== */
.fv-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--fv-bg-secondary);
    border-bottom: 1px solid var(--fv-border);
}

.fv-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--fv-header-height);
    gap: var(--fv-spacing-lg);
}

.fv-logo {
    display: flex;
    align-items: center;
    gap: var(--fv-spacing-sm);
    font-size: var(--fv-font-size-xl);
    font-weight: 700;
    color: var(--fv-text-primary);
    flex-shrink: 0;
}

.fv-logo img {
    height: 40px;
    width: auto;
}

.fv-logo-text {
    background: linear-gradient(135deg, var(--fv-accent), #ff8888);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

/* Search */
.fv-search {
    margin-left: auto !important;
    width: 400px;
    flex: 0 0 400px !important;
}

.fv-search-form {
    display: flex;
    background: var(--fv-bg-tertiary);
    border-radius: var(--fv-radius-full);
    overflow: hidden;
    border: 1px solid var(--fv-border);
    transition: border-color 0.2s ease;
}

.fv-search-form:focus-within {
    border-color: var(--fv-accent);
}

.fv-search-input {
    flex: 1;
    padding: var(--fv-spacing-sm) var(--fv-spacing-md);
    background: transparent;
    border: none;
    color: var(--fv-text-primary);
    outline: none;
}

.fv-search-input::placeholder {
    color: var(--fv-text-muted);
}

.fv-search-btn {
    padding: var(--fv-spacing-sm) var(--fv-spacing-md);
    background: var(--fv-accent);
    border: none;
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

.fv-search-btn:hover {
    background: var(--fv-accent-hover);
}

/* Search Autocomplete */
.fv-search-wrapper {
    position: relative;
}

.fv-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--fv-bg-secondary);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-md);
    margin-top: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.fv-autocomplete.active {
    display: block;
}

.fv-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--fv-text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--fv-border);
}

.fv-autocomplete-item:last-child {
    border-bottom: none;
}

.fv-autocomplete-item:hover,
.fv-autocomplete-item.selected {
    background: var(--fv-bg-hover);
}

.fv-autocomplete-item svg {
    flex-shrink: 0;
    opacity: 0.5;
}

.fv-autocomplete-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Nav */
.fv-nav {
    display: flex;
    align-items: center;
    gap: var(--fv-spacing-md);
}

.fv-nav-link {
    padding: var(--fv-spacing-sm) var(--fv-spacing-md);
    color: var(--fv-text-secondary);
    font-weight: 500;
    transition: color 0.2s ease;
}

.fv-nav-link:hover,
.fv-nav-link.active {
    color: var(--fv-accent);
}

/* Nav Icon (from themecate) */
.fv-nav-icon {
    margin-right: 4px;
    font-size: 1.1em;
}

/* Mobile Menu Toggle */
.fv-menu-toggle {
    display: none;
    padding: var(--fv-spacing-sm);
    background: none;
    border: none;
    color: var(--fv-text-primary);
    cursor: pointer;
}

/* ===== Main Content ===== */
.fv-main {
    min-height: calc(100vh - var(--fv-header-height) - 200px);
    padding: var(--fv-spacing-xl) 0;
}

/* Section */
.fv-section {
    margin-bottom: var(--fv-spacing-2xl);
}

.fv-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--fv-spacing-lg);
}

.fv-section-title {
    font-size: var(--fv-font-size-xl);
    font-weight: 600;
    color: var(--fv-text-primary);
}

.fv-section-link {
    color: var(--fv-accent);
    font-size: var(--fv-font-size-sm);
}

/* ===== Video Grid ===== */
.fv-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--fv-spacing-lg);
}

/* Video Card */
.fv-video-card {
    background: var(--fv-bg-card);
    border-radius: var(--fv-radius-md);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fv-video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px var(--fv-shadow);
}

.fv-video-thumb {
    position: relative;
    aspect-ratio: var(--fv-thumb-aspect-ratio, 16/9);
    overflow: hidden;
}

.fv-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.fv-video-card:hover .fv-video-thumb img {
    transform: scale(1.05);
}

.fv-video-duration {
    position: absolute;
    bottom: var(--fv-spacing-sm);
    right: var(--fv-spacing-sm);
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: var(--fv-radius-sm);
    font-size: var(--fv-font-size-xs);
    font-weight: 500;
}

.fv-video-quality {
    position: absolute;
    top: var(--fv-spacing-sm);
    left: var(--fv-spacing-sm);
    padding: 2px 8px;
    background: #c92a2a;
    /* Darker red for better contrast (WCAG AA compliant) */
    border-radius: var(--fv-radius-sm);
    font-size: var(--fv-font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: #ffffff;
    letter-spacing: 0.5px;
}

/* Giữ ribbon màu trắng khi hover vào video card */
.fv-video-card:hover .fv-video-quality {
    color: #ffffff;
}

.fv-video-info {
    padding: var(--fv-spacing-md);
}

.fv-video-title {
    font-size: var(--fv-font-size-sm);
    font-weight: 500;
    line-height: 1.4;
    color: var(--fv-text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--fv-spacing-sm);
}

.fv-video-meta {
    display: none;
    /* Hidden - remove views/likes from video cards */
    align-items: center;
    gap: var(--fv-spacing-md);
    font-size: var(--fv-font-size-xs);
    color: var(--fv-text-muted);
}

.fv-video-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== Category Tags ===== */
.fv-categories {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fv-spacing-sm);
    margin-bottom: var(--fv-spacing-xl);
}

.fv-category-tag {
    padding: var(--fv-spacing-sm) var(--fv-spacing-md);
    background: var(--fv-bg-tertiary);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-full);
    font-size: var(--fv-font-size-sm);
    color: var(--fv-text-secondary);
    transition: all 0.2s ease;
}

.fv-category-tag:hover,
.fv-category-tag.active {
    background: #d93636;
    /* Darker red for better contrast with white text (WCAG AA) */
    border-color: #d93636;
    color: #ffffff;
    font-weight: 500;
}

/* ===== Pagination ===== */
.fv-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--fv-spacing-sm);
    margin-top: var(--fv-spacing-2xl);
}

.fv-page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 var(--fv-spacing-md);
    background: var(--fv-bg-tertiary);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-md);
    color: var(--fv-text-secondary);
    transition: all 0.2s ease;
}

.fv-page-link:hover,
.fv-page-link.active {
    background: var(--fv-accent);
    border-color: var(--fv-accent);
    color: white;
}

/* ===== Single Video ===== */
.fv-single-video {
    display: block;
    max-width: 100%;
}

.fv-player-wrapper {
    background: var(--fv-bg-secondary);
    border-radius: var(--fv-radius-lg);
    overflow: hidden;
}

/* Server Selector */
.fv-server-selector {
    display: flex;
    align-items: center;
    gap: var(--fv-spacing-sm);
    padding: var(--fv-spacing-md);
    background: var(--fv-bg-tertiary);
    border-bottom: 1px solid var(--fv-border);
}

.fv-server-selector span {
    color: var(--fv-text-secondary);
    font-size: var(--fv-font-size-sm);
    margin-right: var(--fv-spacing-sm);
}

.fv-server-btn {
    padding: 6px 16px;
    background: var(--fv-bg-card);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-md);
    color: var(--fv-text-secondary);
    font-size: var(--fv-font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fv-server-btn:hover {
    background: var(--fv-bg-hover);
    color: var(--fv-text-primary);
}

.fv-server-btn.active {
    background: var(--fv-accent-dark);
    border-color: var(--fv-accent-dark);
    color: white;
}

.fv-player {
    position: relative;
    aspect-ratio: var(--fv-thumb-aspect-ratio, 16/9);
    background: #000;
}

.fv-player iframe,
.fv-player video {
    width: 100%;
    height: 100%;
}

.fv-player .player-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.fv-video-details {
    padding: var(--fv-spacing-lg);
}

.fv-video-details h1 {
    font-size: var(--fv-font-size-xl);
    font-weight: 600;
    margin-bottom: var(--fv-spacing-md);
}

.fv-video-stats {
    display: flex;
    align-items: center;
    gap: var(--fv-spacing-lg);
    padding: var(--fv-spacing-md) 0;
    border-bottom: 1px solid var(--fv-border);
    color: var(--fv-text-secondary);
    font-size: var(--fv-font-size-sm);
}

.fv-video-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fv-video-description {
    padding: var(--fv-spacing-lg) 0;
    color: var(--fv-text-secondary);
    line-height: 1.8;
}

.fv-video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fv-spacing-sm);
}

.fv-tag {
    padding: 4px 12px;
    background: var(--fv-bg-tertiary);
    border-radius: var(--fv-radius-full);
    font-size: var(--fv-font-size-xs);
    color: var(--fv-text-secondary);
}

/* Sidebar */
.fv-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--fv-spacing-md);
}

.fv-sidebar-title {
    font-size: var(--fv-font-size-lg);
    font-weight: 600;
    margin-bottom: var(--fv-spacing-md);
}

.fv-related-video {
    display: flex;
    gap: var(--fv-spacing-md);
    padding: var(--fv-spacing-sm);
    background: var(--fv-bg-card);
    border-radius: var(--fv-radius-md);
    transition: background 0.2s ease;
}

.fv-related-video:hover {
    background: var(--fv-bg-hover);
}

.fv-related-thumb {
    width: 140px;
    flex-shrink: 0;
    aspect-ratio: var(--fv-thumb-aspect-ratio, 16/9);
    border-radius: var(--fv-radius-sm);
    overflow: hidden;
}

.fv-related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fv-related-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.fv-related-title {
    font-size: var(--fv-font-size-sm);
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fv-related-meta {
    font-size: var(--fv-font-size-xs);
    color: var(--fv-text-muted);
    margin-top: var(--fv-spacing-xs);
}

/* ===== Footer ===== */
.fv-footer {
    background: var(--fv-bg-secondary);
    border-top: 1px solid var(--fv-border);
    padding: var(--fv-spacing-2xl) 0;
    margin-top: var(--fv-spacing-2xl);
    color: var(--fv-text-secondary);
}

.fv-footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--fv-spacing-xl);
}

.fv-footer-section h4 {
    font-size: var(--fv-font-size-base);
    font-weight: 600;
    margin-bottom: var(--fv-spacing-md);
    color: var(--fv-text-primary);
}

.fv-footer-links {
    list-style: none;
}

.fv-footer-links li {
    margin-bottom: var(--fv-spacing-sm);
}

.fv-footer-links a {
    color: var(--fv-text-secondary);
    font-size: var(--fv-font-size-sm);
}

.fv-footer-bottom {
    text-align: center;
    padding-top: var(--fv-spacing-xl);
    margin-top: var(--fv-spacing-xl);
    border-top: 1px solid var(--fv-border);
    color: var(--fv-text-secondary);
    font-size: var(--fv-font-size-sm);
}

/* ===== 404 Page ===== */
.fv-404 {
    text-align: center;
    padding: var(--fv-spacing-2xl) 0;
}

.fv-404 h1 {
    font-size: 6rem;
    font-weight: 700;
    color: var(--fv-accent);
}

.fv-404 p {
    font-size: var(--fv-font-size-lg);
    color: var(--fv-text-secondary);
    margin: var(--fv-spacing-lg) 0;
}

.fv-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--fv-spacing-sm);
    padding: var(--fv-spacing-md) var(--fv-spacing-xl);
    background: var(--fv-accent);
    color: white;
    border-radius: var(--fv-radius-md);
    font-weight: 500;
    transition: background 0.2s ease;
}

.fv-btn:hover {
    background: var(--fv-accent-hover);
    color: white;
}

.fv-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: var(--fv-spacing-sm);
    padding: var(--fv-spacing-md) var(--fv-spacing-xl);
    background: transparent;
    color: var(--fv-text-primary);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fv-btn-outline:hover {
    background: var(--fv-bg-hover);
    border-color: var(--fv-accent);
    color: var(--fv-text-primary);
}

/* ===== Loading ===== */
.fv-loading {
    display: flex;
    justify-content: center;
    padding: var(--fv-spacing-2xl);
}

.fv-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--fv-border);
    border-top-color: var(--fv-accent);
    border-radius: 50%;
    animation: fv-spin 0.8s linear infinite;
}

@keyframes fv-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .fv-single-video {
        grid-template-columns: 1fr;
    }

    .fv-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .fv-related-video {
        flex: 1;
        min-width: 280px;
    }
}

/* ===== Categories Header ===== */
.fv-categories-header {
    background: var(--fv-bg-primary);
    border-bottom: 1px solid var(--fv-border);
    padding: var(--fv-spacing-sm) 0;
}

.fv-categories-header .fv-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.fv-categories-header .fv-container::-webkit-scrollbar {
    display: none;
}

.fv-categories-header .fv-categories {
    display: flex;
    gap: var(--fv-spacing-sm);
    flex-wrap: nowrap;
    justify-content: flex-start;
    white-space: nowrap;
    padding-bottom: 4px;
}

/* ===== Desktop Search (visible by default) ===== */
.fv-search-desktop {
    display: flex;
    margin-left: auto !important;
    width: 400px;
    flex: 0 0 400px !important;
}

/* ===== Mobile Search Toggle (hidden by default on desktop) ===== */
.fv-search-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: var(--fv-spacing-sm);
    color: var(--fv-text-primary);
    cursor: pointer;
    border-radius: var(--fv-radius-sm);
    transition: background 0.2s;
    align-items: center;
    justify-content: center;
}

.fv-search-toggle:hover {
    background: var(--fv-bg-hover);
}

/* ===== Mobile Search Form (hidden on desktop, toggle on mobile) ===== */
.fv-search-mobile {
    display: none !important;
    padding: var(--fv-spacing-sm) var(--fv-spacing-md);
    background: var(--fv-bg-secondary);
    border-bottom: 1px solid var(--fv-border);
}

/* Only show on mobile when active */
@media (max-width: 768px) {
    .fv-search-mobile.active {
        display: block !important;
    }
}

.fv-search-mobile .fv-search-form {
    display: flex;
    width: 100%;
    max-width: 100%;
}

.fv-search-mobile .fv-search-input {
    flex: 1;
    padding: var(--fv-spacing-sm) var(--fv-spacing-md);
    background: var(--fv-bg-tertiary);
    border: 1px solid var(--fv-border);
    border-radius: var(--fv-radius-full) 0 0 var(--fv-radius-full);
    color: var(--fv-text-primary);
    font-size: 16px;
}

.fv-search-mobile .fv-search-btn {
    padding: var(--fv-spacing-sm) var(--fv-spacing-md);
    background: var(--fv-accent);
    border: none;
    border-radius: 0 var(--fv-radius-full) var(--fv-radius-full) 0;
    color: white;
    cursor: pointer;
}

/* ===== Responsive - Tablet and Mobile ===== */
@media (max-width: 768px) {
    .fv-header {
        height: auto;
    }

    .fv-header-inner {
        height: var(--fv-header-height);
        padding: 0;
    }

    /* Hide desktop search on mobile */
    .fv-search-desktop {
        display: none !important;
    }

    /* Show mobile search toggle on mobile */
    .fv-search-toggle {
        display: flex !important;
    }

    /* Video grid: Always 2 columns on mobile */
    .fv-video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--fv-spacing-sm);
    }

    .fv-video-title {
        font-size: var(--fv-font-size-xs);
    }

    .fv-video-info {
        padding: var(--fv-spacing-sm);
    }

    .fv-video-meta {
        font-size: 10px;
    }
}

@media (max-width: 480px) {

    /* Keep 2 columns on smallest screens */
    .fv-video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--fv-spacing-xs);
    }

    .fv-video-title {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }

    .fv-video-info {
        padding: 6px;
    }

    .fv-duration {
        font-size: 10px;
        padding: 2px 4px;
    }
}

/* ===== Related Videos Section (below player) ===== */
.fv-related-section {
    margin-top: var(--fv-spacing-xl);
    padding: 0 var(--fv-spacing-md);
}

.fv-related-section .fv-section-title {
    font-size: var(--fv-font-size-lg);
    font-weight: 600;
    margin-bottom: var(--fv-spacing-lg);
    color: var(--fv-text-primary);
}

/* Single video layout: Full width (no sidebar) */
.fv-single-video {
    display: block;
}

.fv-video-main {
    max-width: 100%;
}