/* Common CSS - Minimal shared utilities only */
/* Main styles are in index.css, live.css, and watch.css */

/* ========================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ======================================== */
:root {
    /* Colors */
    --color-primary: #ef4444;
    --color-primary-dark: #dc2626;
    --color-bg: #0f0f0f;
    --color-bg-light: #1a1a1a;
    --color-text: #ffffff;
    --color-text-muted: rgba(255, 255, 255, 0.6);
    --color-border: rgba(255, 255, 255, 0.1);
    --color-border-hover: rgba(255, 255, 255, 0.3);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-Index Scale */
    --z-header: 100;
    --z-modal: 1000;
    --z-overlay: 200;
    --z-player-controls: 10;
    --z-sidebar: 200;

    /* Breakpoints */
    --breakpoint-sm: 480px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1366px;
    --breakpoint-2xl: 1600px;
    --breakpoint-3xl: 1920px;

    /* Layout */
    --header-height: 5rem;
    --header-height-mobile: 4rem;
    --container-max-width: 1920px;
    --scroll-load-threshold: 1500px;
    --card-aspect-ratio: 2/3;
}

/* Shared reset - minimal */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Accessibility: respect user preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Hide focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ========================================
   SHARED HEADER STYLES
   ======================================== */
.tv-header {
    padding: var(--spacing-xl) var(--spacing-2xl);
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0) 100%
    );
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    backdrop-filter: blur(10px);
    height: auto;
    min-height: var(--header-height);
}

@media (max-width: 768px) {
    .tv-header {
        padding: var(--spacing-md);
        min-height: auto;
    }
}

.tv-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 768px) {
    .tv-header-content {
        gap: 0.75rem;
    }
}

.tv-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .tv-logo {
        width: 100%;
        justify-content: center;
    }
}

.tv-logo img {
    width: 48px;
    height: 48px;
}

.tv-logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 768px) {
    .tv-logo h1 {
        font-size: 1.5rem;
    }

    .tv-logo img {
        width: 36px;
        height: 36px;
    }
}

.tv-header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .tv-header-controls {
        gap: 0.5rem;
        width: 100%;
        justify-content: center;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tv-header-controls::-webkit-scrollbar {
        display: none;
    }
}

/* ========================================
   SHARED SEARCH STYLES
   ======================================== */
.tv-search {
    position: relative;
}

.tv-search input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0.75rem 3rem 0.75rem 1.25rem;
    color: white;
    font-size: 1rem;
    width: 300px;
    transition: all var(--transition-normal);
}

.tv-search-desktop {
    position: relative;
}

.tv-btn-mobile-search {
    display: none;
}

@media (max-width: 768px) {
    .tv-search-desktop {
        display: none;
    }

    .tv-btn-mobile-search {
        display: flex;
    }
}

.tv-search input:focus {
    outline: none;
    border-color: #ef4444;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

.tv-search input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.tv-search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0.5;
}

/* ========================================
   SHARED BUTTON STYLES
   ======================================== */
.tv-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .tv-btn {
        padding: 0.6rem;
        min-width: 40px;
        justify-content: center;
    }

    .tv-btn span {
        display: none;
    }

    .tv-btn svg {
        margin: 0;
    }

    .tv-btn-mobile-search {
        order: -1;
    }
}

.tv-btn:hover,
.tv-btn:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

@media (hover: none) {
    .tv-btn:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.15);
    }

    .tv-btn.active:hover {
        background: rgba(239, 68, 68, 0.2);
        border-color: #ef4444;
    }

    .tv-btn:active {
        transform: scale(0.98);
    }
}

.tv-btn.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.tv-badge {
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    position: absolute;
    top: -5px;
    right: -5px;
}

@media (max-width: 768px) {
    .tv-btn {
        position: relative;
    }
}

/* ========================================
   SHARED LAYOUT STYLES
   ======================================== */
main {
    padding: 0 3rem 3rem;
    max-width: 1920px;
    margin: 0 auto;
}

@media (min-width: 1024px) and (max-width: 1600px) {
    main {
        padding: 0 2.5rem 3rem;
    }
}

@media (max-width: 1024px) {
    main {
        padding: 0 2rem 2rem;
    }
}

@media (max-width: 768px) {
    main {
        padding: 0 1.5rem 2rem;
    }
}

/* ========================================
   SHARED LOADING & MESSAGE STYLES
   ======================================== */
.tv-loading,
.tv-error,
.tv-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.tv-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

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

.tv-message-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tv-message-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
}

.tv-empty-icon {
    width: 80px;
    height: 80px;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 1.5rem;
}

/* ========================================
   SHARED MODAL STYLES
   ======================================== */
.tv-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.tv-modal-content {
    background: rgba(15, 15, 15, 0.98);
    border-radius: 20px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.tv-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.tv-modal-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.tv-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all var(--transition-normal);
}

.tv-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ========================================
   SHARED ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-up {
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   SHARED SCROLLBAR STYLES
   ======================================== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #ef4444;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #dc2626;
}

/* ========================================
   SHARED RESPONSIVE UTILITIES
   ======================================== */
@media (max-width: 1024px) {
    .tv-search input {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .tv-search input {
        width: 100%;
        max-width: 100%;
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .tv-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* ========================================
   SKELETON LOADING STATES (Shimmer Effect)
   ======================================== */

/* Base skeleton styles */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

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

/* Skeleton card - for content grid */
.skeleton-card {
    aspect-ratio: var(--card-aspect-ratio);
    display: flex;
    flex-direction: column;
}

.skeleton-card-poster {
    flex: 1;
    width: 100%;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.skeleton-card-info {
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.skeleton-card-title {
    height: 16px;
    width: 90%;
    margin-bottom: var(--spacing-sm);
    border-radius: var(--radius-sm);
}

.skeleton-card-meta {
    display: flex;
    gap: var(--spacing-sm);
}

.skeleton-card-rating,
.skeleton-card-year {
    height: 12px;
    border-radius: var(--radius-sm);
}

.skeleton-card-rating {
    width: 50px;
}

.skeleton-card-year {
    width: 40px;
}

/* Skeleton channel card - for live TV */
.skeleton-channel-card {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
}

.skeleton-channel-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
}

.skeleton-channel-name {
    height: 16px;
    width: 80px;
    border-radius: var(--radius-sm);
}

/* Skeleton text lines */
.skeleton-text {
    height: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
}

.skeleton-text.sm {
    height: 12px;
    width: 60%;
}

.skeleton-text.lg {
    height: 20px;
    width: 100%;
}

/* Skeleton avatar/circle */
.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Skeleton thumbnail */
.skeleton-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
}

/* Reduced motion - disable shimmer animation */
@media (prefers-reduced-motion: reduce) {
    .skeleton,
    .skeleton-card,
    .skeleton-channel-card {
        animation: none;
        background: rgba(255, 255, 255, 0.05);
    }
}

/* ========================================
   MOBILE SEARCH MODAL (Shared)
   ======================================== */
.tv-mobile-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f0f0f;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease;
    overflow: hidden;
}

/* Hidden on tablets and above */
@media (min-width: 768px) {
    .tv-mobile-search-modal {
        display: none !important;
    }
}

.tv-mobile-search-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.tv-mobile-search-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 0.75rem;
    flex-shrink: 0;
}

.tv-mobile-search-back {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tv-mobile-search-back:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tv-mobile-search-back:active {
    transform: scale(0.95);
}

.tv-mobile-search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.tv-mobile-search-input-wrapper input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0.75rem 3rem 0.75rem 1rem;
    color: white;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    -webkit-appearance: none;
}

.tv-mobile-search-input-wrapper input:focus {
    outline: none;
    border-color: #ef4444;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

.tv-mobile-search-input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.tv-mobile-search-clear {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tv-mobile-search-clear:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.tv-mobile-search-clear:active {
    transform: scale(0.9);
}

.tv-mobile-search-results {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
}

/* Grid for movies/shows search results */
.tv-mobile-search-results .tv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 0;
}

.tv-mobile-search-results .tv-card {
    width: 100%;
}

/* Grid for live TV search results */
.tv-mobile-search-results .tv-channels-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 0;
}

@media (min-width: 480px) {
    .tv-mobile-search-results .tv-channels-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .tv-mobile-search-results .tv-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .tv-mobile-search-results .tv-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

.tv-mobile-search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    min-height: 50vh;
}

.tv-mobile-search-empty-icon {
    width: 64px;
    height: 64px;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 1.5rem;
}

.tv-mobile-search-empty h3 {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.tv-mobile-search-empty p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}
