/**
 * Premium AV Widget — Netflix-Style CSS
 * File: assets/style.css
 */

/* ═══════════════════════════════════════════════════════════
   WIDGET WRAPPER
═══════════════════════════════════════════════════════════ */
.premium-av-widget {
    font-family: inherit;
    position: relative;
    box-sizing: border-box;
    /* background set via Elementor control */
}

.premium-av-widget *,
.premium-av-widget *::before,
.premium-av-widget *::after {
    box-sizing: border-box;
}


/* ═══════════════════════════════════════════════════════════
   TOOLBAR
═══════════════════════════════════════════════════════════ */
.nav-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.nav-toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-toolbar-top {
    justify-content: space-between;
}

/* Count */
.nav-count {
    color: #999999;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-count span {
    color: #e50914;
    font-weight: 700;
}

/* Search */
.nav-search-wrap {
    position: relative;
    flex: 1;
    max-width: 320px;
    min-width: 160px;
}

.nav-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #888888;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
}

.nav-search-input {
    width: 100%;
    height: 40px;
    padding: 0 14px 0 38px;
    background-color: #2a2a2a;
    color: #ffffff;
    border: 1px solid #444444;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.nav-search-input::placeholder { color: #666666; }

.nav-search-input:focus {
    border-color: #e50914;
    background-color: #333333;
}

/* Category Dropdown (แทน pills) */
.nav-cat-wrap {
    flex-shrink: 0;
    min-width: 140px;
}

.nav-cat-select {
    width: 100%;
    height: 40px;
    padding: 0 32px 0 12px;
    background-color: #2a2a2a;
    color: #ffffff;
    border: 1px solid #444444;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.nav-cat-select:hover {
    border-color: #555555;
}

.nav-cat-select:focus {
    border-color: #e50914;
}

/* Category Filter Pills (保留备用) */
.nav-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.nav-filter-btn {
    padding: 5px 14px;
    background-color: #2a2a2a;
    color: #cccccc;
    border: 1px solid #3a3a3a;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
    line-height: 1;
}

.nav-filter-btn:hover {
    background-color: #3a3a3a;
    color: #ffffff;
}

.nav-filter-btn.active {
    background-color: #e50914;
    color: #ffffff;
    border-color: #e50914;
}

.nav-filter-btn:disabled {
    cursor: default;
    opacity: 0.7;
}


/* ═══════════════════════════════════════════════════════════
   GRID
═══════════════════════════════════════════════════════════ */
.nav-grid {
    display: grid;
    gap: 8px;
}

/* Responsive grid using CSS variables */
@media (max-width: 1024px) {
    .nav-grid {
        grid-template-columns: repeat(var(--cols-tablet, 3), 1fr) !important;
    }
}

@media (max-width: 768px) {
    .nav-grid {
        grid-template-columns: repeat(var(--cols-mobile, 2), 1fr) !important;
    }
}


/* ═══════════════════════════════════════════════════════════
   CARD BASE
═══════════════════════════════════════════════════════════ */
.nav-card {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
    background-color: #1f1f1f;
    border-radius: 4px;
    overflow: hidden;
    transition: transform 250ms ease, box-shadow 250ms ease, border-color 250ms ease;
    outline: none;
    cursor: pointer;
    transform-origin: center center;
    will-change: transform;
}

/* ── Hover Effects ── */
.nav-card.hover-scale:hover {
    transform: scale(1.08);
    z-index: 10;
    box-shadow: 0 16px 40px rgba(0,0,0,0.7);
}

.nav-card.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}

/* hover-slide: info panel slides up from bottom */
.nav-card.hover-slide .nav-card-slide-info {
    transform: translateY(100%);
    transition: transform 280ms ease;
}
.nav-card.hover-slide:hover .nav-card-slide-info {
    transform: translateY(0);
}


/* ═══════════════════════════════════════════════════════════
   THUMBNAIL
═══════════════════════════════════════════════════════════ */
.nav-card-thumb {
    position: relative;
    width: 100%;
    padding-top: 150%;
    overflow: hidden;
    background-color: #0a0a0a;
}

.nav-card-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform 400ms ease;
    display: block;
}

/* Bottom gradient */
.nav-card-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(20,20,20,0.9) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}




/* ═══════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════ */
.nav-card-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    z-index: 3;
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    border-radius: 3px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.nav-badge-quality  { background-color: #e50914; color: #ffffff; }
.nav-badge-duration { background-color: rgba(0,0,0,0.75); color: #ffffff; backdrop-filter: blur(4px); }
.nav-badge-rating   { background-color: rgba(0,0,0,0.75); color: #ffffff; backdrop-filter: blur(4px); }
.nav-star           { color: #f5c518; font-size: 10px; }


/* ═══════════════════════════════════════════════════════════
   PLAY OVERLAY
═══════════════════════════════════════════════════════════ */
.nav-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    z-index: 2;
    transition: opacity 250ms ease;
}

.nav-card-overlay.overlay-hover { opacity: 0; }
.nav-card:hover .nav-card-overlay.overlay-hover { opacity: 1; }
.nav-card-overlay.overlay-always { opacity: 1; }
.nav-card-overlay.overlay-none { display: none; }

/* Play button */
.nav-play-btn {
    width: 44px;
    height: 44px;
    background-color: #e50914;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 200ms ease, transform 200ms ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-play-btn::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 16px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 3px;
}

.nav-card:hover .nav-play-btn {
    transform: scale(1.12);
    background-color: #f40612;
}

/* Overlay title */
.nav-card-overlay-title {
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    padding: 8px 10px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    max-width: 100%;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}


/* ═══════════════════════════════════════════════════════════
   TITLE (below thumbnail)
═══════════════════════════════════════════════════════════ */
.nav-card-title-wrap {
    background-color: #1f1f1f;
}

.nav-card-title {
    padding: 8px;
    color: #e5e5e5;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    transition: color 200ms ease;
}

.nav-card:hover .nav-card-title { color: #ffffff; }


/* ═══════════════════════════════════════════════════════════
   META INFO
═══════════════════════════════════════════════════════════ */
.nav-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 12px;
    font-size: 11px;
    line-height: 1.4;
    color: #999999;
    background-color: #1f1f1f;
}

.nav-meta-category {
    background-color: #ff3b5c;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.nav-meta-date,
.nav-meta-views {
    opacity: 0.85;
    font-size: 10px;
}

.nav-meta-views::before {
    content: '👁 ';
    font-size: 10px;
}


/* ═══════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════ */
.nav-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 32px;
}

.nav-pagination button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #2a2a2a;
    color: #aaaaaa;
    border: 1px solid #444444;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
    padding: 0;
    line-height: 1;
}

.nav-pagination button:not(.active):hover {
    background-color: #444444;
    color: #ffffff;
    border-color: #555555;
}

.nav-pagination button.active {
    background-color: #e50914;
    color: #ffffff;
    border-color: #e50914;
    font-weight: 700;
    cursor: default;
}

.nav-pagination button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.nav-page-ellipsis {
    color: #666666;
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 4px;
    font-size: 14px;
}


/* ═══════════════════════════════════════════════════════════
   LOADING STATE
═══════════════════════════════════════════════════════════ */
.nav-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666666;
    font-size: 13px;
    gap: 16px;
}

.nav-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #333333;
    border-top-color: #e50914;
    border-radius: 50%;
    animation: nav-spin 0.75s linear infinite;
    flex-shrink: 0;
}

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

/* Empty state */
.nav-empty {
    text-align: center;
    padding: 60px 20px;
    color: #555555;
    font-size: 14px;
}

.nav-empty-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}


/* ═══════════════════════════════════════════════════════════
   SKELETON LOADING
═══════════════════════════════════════════════════════════ */
.nav-skeleton-card {
    background-color: #1f1f1f;
    border-radius: 4px;
    overflow: hidden;
}

.nav-skeleton-thumb {
    width: 100%;
    padding-top: 150%;
    position: relative;
}

.nav-skeleton-thumb::after,
.nav-skeleton-title,
.nav-skeleton-title-short {
    background: linear-gradient(90deg, #1f1f1f 25%, #2a2a2a 50%, #1f1f1f 75%);
    background-size: 200% 100%;
    animation: nav-shimmer 1.4s infinite;
}

.nav-skeleton-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
}

.nav-skeleton-title {
    height: 12px;
    margin: 10px 8px 4px;
    border-radius: 3px;
}

.nav-skeleton-title-short {
    width: 60%;
    height: 12px;
    margin: 0 8px 10px;
    border-radius: 3px;
}

@keyframes nav-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ═══════════════════════════════════════════════════════════
   EDITOR BADGE
═══════════════════════════════════════════════════════════ */
.nav-editor-badge {
    margin-top: 12px;
    padding: 6px 12px;
    background: rgba(229,9,20,0.08);
    border-left: 3px solid #e50914;
    border-radius: 4px;
    font-size: 11px;
    color: #e50914;
    line-height: 1.5;
    pointer-events: none;
}


/* ═══════════════════════════════════════════════════════════
   PLAYER
═══════════════════════════════════════════════════════════ */
#premium-av-player { 
    width: 100%; 
}

.nav-player-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.nav-player-wrap {
    width: 100%;
    position: relative;
    padding-top: 56.25%;
    border-radius: inherit;
    overflow: hidden;
}

.nav-player-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.nav-player-error {
    padding: 40px;
    text-align: center;
    color: #e50914;
}


/* ═══════════════════════════════════════════════════════════
   SECURITY
═══════════════════════════════════════════════════════════ */
#premium-av-player,
.premium-av-widget {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

#premium-av-player::before { display: none; }


/* ═══════════════════════════════════════════════════════════
   ANIMATIONS & UTILITIES
═══════════════════════════════════════════════════════════ */
.nav-card.loading {
    cursor: wait;
    opacity: 0.7;
    pointer-events: none;
}

.nav-card.loading .nav-play-btn {
    animation: nav-pulse 1s infinite;
}



@keyframes nav-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .nav-toolbar-top {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .nav-search-wrap {
        max-width: 100%;
        flex: 1 1 100%;
        order: 2;
    }
    
    .nav-cat-wrap {
        flex: 1;
        min-width: auto;
        order: 1;
    }
    
    .nav-count { 
        order: 0;
        width: 100%;
        text-align: center;
    }
    
    .nav-pagination { gap: 4px; }
    .nav-pagination button { width: 32px; height: 32px; font-size: 12px; }
    
    .nav-card-title { font-size: 10px; }
    .nav-card-meta { gap: 4px; padding: 4px 8px 10px; }
    .nav-meta-category { font-size: 9px; padding: 1px 5px; }
}

@media (max-width: 480px) {
    .nav-filter-btn { font-size: 11px; padding: 4px 10px; }
    .nav-card-title { font-size: 9px; padding: 6px; }
    .nav-badge { font-size: 8px; padding: 1px 4px; }
    .nav-play-btn { width: 36px; height: 36px; }
    .nav-play-btn::after { border-width: 6px 0 6px 12px; margin-left: 2px; }
    .nav-pagination button { width: 28px; height: 28px; font-size: 11px; }
}

/* Landscape orientation optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .nav-card-title { font-size: 9px; }
    .nav-card-meta { font-size: 9px; }
    .nav-card-thumb { padding-top: 120%; }
}