/* =============================================================
   GCRAJAN — Live Cinema TV  |  Warm Minimalism Theme
   Matches the global portfolio design system exactly.
   ============================================================= */

/* --- Design Tokens (mirrored from assets/css/style.css) --- */
:root {
    /* Backgrounds */
    --tv-bg:         #FEFAF6;
    --tv-bg-surface: #FFF5EE;
    --tv-bg-panel:   #FFFFFF;
    --tv-bg-card:    #FFFFFF;

    /* Borders */
    --tv-border:     rgba(26, 26, 46, 0.08);
    --tv-border-md:  rgba(26, 26, 46, 0.12);

    /* Accents */
    --coral:         #FF6B6B;
    --coral-hover:   #E85D5D;
    --coral-glow:    rgba(255, 107, 107, 0.25);
    --lavender:      #A78BFA;
    --sage:          #6BCB77;
    --amber:         #FBBF24;
    --sky:           #38BDF8;
    --error:         #ef4444;
    --success:       #10b981;

    /* Text */
    --text-primary:   #1A1A2E;
    --text-secondary: #4A4A68;
    --text-muted:     #9CA3AF;

    /* Shadows */
    --shadow-sm:    0 2px 8px rgba(26, 26, 46, 0.06);
    --shadow-md:    0 4px 20px rgba(26, 26, 46, 0.08);
    --shadow-lg:    0 8px 40px rgba(26, 26, 46, 0.12);
    --shadow-coral: 0 8px 30px rgba(255, 107, 107, 0.25);

    /* Radii */
    --r-xs:   4px;
    --r-sm:   8px;
    --r-md:   12px;
    --r-lg:   16px;
    --r-pill: 100px;

    /* Spacing */
    --sp-xs: 0.25rem;
    --sp-sm: 0.5rem;
    --sp-md: 1rem;
    --sp-lg: 1.5rem;
    --sp-xl: 2rem;

    /* Transitions */
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-fast:    0.2s;
    --dur-normal:  0.35s;

    /* Layout */
    --header-h:  58px;
    --sidebar-w: 340px;
}

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

.tv-body {
    font-family: "DM Sans", system-ui, sans-serif;
    background: var(--tv-bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================================
   TOP HEADER BAR
   ============================================================= */
.tv-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-h);
    background: rgba(254, 250, 246, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--tv-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-lg);
    z-index: 200;
    gap: var(--sp-md);
    box-shadow: var(--shadow-sm);
}

.tv-header-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: color var(--dur-fast);
    white-space: nowrap;
    text-decoration: none;
    color: var(--text-heading);
    font-family: "Outfit", sans-serif;
    font-weight: 700;
    font-size: 1.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    transition: transform var(--duration-fast) var(--ease-bounce);
}

.tv-header-logo:hover {
    transform: scale(1.03);
}
.tv-header-logo img {
    height: 32px;
    transition: transform var(--duration-normal) var(--ease-bounce);
}

.tv-header-logo a:hover img {
    transform: rotate(-12deg) scale(1.1);
}

.tv-header-center {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.tv-live-dot {
    color: var(--coral);
    font-size: 1.1rem;
    animation: pulseLive 1.8s ease-in-out infinite;
}

.tv-header-title {
    font-family: "Outfit", sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.tv-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tv-btn-icon {
    width: 36px;
    height: 36px;
    background: var(--tv-bg-card);
    border: 1px solid var(--tv-border-md);
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--dur-fast);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.tv-btn-icon:hover {
    background: var(--tv-bg-surface);
    color: var(--coral);
    border-color: rgba(255, 107, 107, 0.3);
    box-shadow: var(--shadow-md);
}

.tv-btn-icon.spinning i {
    animation: spinIcon 0.8s linear infinite;
}

.tv-btn-sidebar-toggle {
    display: none;
}

/* =============================================================
   MOBILE OVERLAY
   ============================================================= */
.tv-drawer-overlay {
    display: none;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: rgba(26, 26, 46, 0.25);
    z-index: 98;
    backdrop-filter: blur(2px);
}

.tv-drawer-overlay.active {
    display: block;
}

/* =============================================================
   APP LAYOUT
   ============================================================= */
.tv-app-container {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: calc(100vh - var(--header-h));
    margin-top: var(--header-h);
    overflow: hidden;
}

/* =============================================================
   SIDEBAR
   ============================================================= */
.tv-sidebar {
    background: var(--tv-bg-surface);
    border-right: 1px solid var(--tv-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.tv-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-md) var(--sp-md) var(--sp-sm);
    border-bottom: 1px solid var(--tv-border);
    flex-shrink: 0;
    background: var(--tv-bg-panel);
}

.tv-sidebar-title {
    font-family: "Outfit", sans-serif;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tv-sidebar-title i {
    color: var(--coral);
}

.tv-channel-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--tv-bg-surface);
    padding: 2px 8px;
    border-radius: var(--r-pill);
    border: 1px solid var(--tv-border);
}

.tv-sidebar-controls {
    padding: var(--sp-sm);
    border-bottom: 1px solid var(--tv-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    background: var(--tv-bg-panel);
}

.tv-control-group {
    position: relative;
    display: flex;
    align-items: center;
}

.tv-control-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1;
}

.tv-select,
.tv-search-input {
    width: 100%;
    padding: 0.62rem 0.75rem 0.62rem 2.25rem;
    background: var(--tv-bg);
    border: 1.5px solid var(--tv-border-md);
    color: var(--text-primary);
    font-family: "DM Sans", sans-serif;
    font-size: 0.85rem;
    border-radius: var(--r-sm);
    outline: none;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
    appearance: none;
}

.tv-select { cursor: pointer; }

.tv-select:focus,
.tv-search-input:focus {
    border-color: var(--coral);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.09);
    background: #fff;
}

.tv-search-input::placeholder {
    color: var(--text-muted);
}

/* =============================================================
   CHANNEL LIST
   ============================================================= */
.tv-channels-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-xs);
    background: var(--tv-bg-surface);
}

/* Warm scrollbar */
.tv-channels-list::-webkit-scrollbar { width: 5px; }
.tv-channels-list::-webkit-scrollbar-track { background: var(--tv-bg-surface); }
.tv-channels-list::-webkit-scrollbar-thumb {
    background: var(--coral);
    border-radius: 4px;
}
.tv-channels-list::-webkit-scrollbar-thumb:hover {
    background: var(--coral-hover);
}

.tv-channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.75rem;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background var(--dur-fast), transform var(--dur-fast);
    position: relative;
}

.tv-channel-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    transition: border-color var(--dur-fast);
    pointer-events: none;
}

.tv-channel-item:hover {
    background: rgba(255, 107, 107, 0.05);
    transform: translateX(2px);
}

.tv-channel-item:hover::after {
    border-color: rgba(255, 107, 107, 0.12);
}

.tv-channel-item.active {
    background: rgba(255, 107, 107, 0.09);
}

.tv-channel-item.active::after {
    border-color: rgba(255, 107, 107, 0.2);
}

.tv-logo-container {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    background: var(--tv-bg);
    border: 1px solid var(--tv-border-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.tv-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
}

.tv-logo-fallback {
    font-family: "Outfit", sans-serif;
    font-weight: 800;
    color: var(--coral);
    font-size: 0.95rem;
    letter-spacing: -0.03em;
}

.tv-channel-details {
    flex: 1;
    overflow: hidden;
}

.tv-channel-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    transition: color var(--dur-fast);
}

.tv-channel-item.active .tv-channel-name {
    color: var(--coral);
}

.tv-channel-group {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* No results */
.tv-empty-msg {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.tv-empty-msg i {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: var(--tv-border-md);
}

/* =============================================================
   SKELETON LOADERS
   ============================================================= */
.tv-skeleton-wrap { padding: var(--sp-xs); }

.tv-skeleton-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.75rem;
    border-radius: var(--r-md);
}

.tv-skeleton-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    background: var(--tv-border-md);
    flex-shrink: 0;
    animation: shimmer 1.5s linear infinite;
}

.tv-skeleton-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tv-skeleton-line {
    height: 10px;
    border-radius: var(--r-pill);
    background: var(--tv-border-md);
    animation: shimmer 1.5s linear infinite;
}

.tv-skeleton-name  { width: 70%; }
.tv-skeleton-group { width: 45%; animation-delay: 0.15s; }

@keyframes shimmer {
    0%   { opacity: 0.5; }
    50%  { opacity: 1.0; }
    100% { opacity: 0.5; }
}

/* =============================================================
   VIDEO PLAYER
   ============================================================= */
.tv-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #000;
    overflow: hidden;
}

.tv-player-wrap {
    flex: 1;
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
}

.tv-video-element {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
}

/* =============================================================
   PLAYER STATUS OVERLAY  (warm light bg, not full black)
   ============================================================= */
.tv-player-overlay {
    position: absolute;
    inset: 0;
    background: rgba(254, 250, 246, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    text-align: center;
    padding: var(--sp-xl);
    transition: opacity 0.3s;
}

.tv-player-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.tv-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-md);
    max-width: 480px;
}

.tv-overlay-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-sm);
}

.tv-overlay-icon-wrap i {
    font-size: 2rem;
    color: var(--coral);
}

/* State: loading — spin icon */
.tv-player-overlay.state-loading .tv-overlay-icon-wrap i {
    animation: spinIcon 1s linear infinite;
}

/* State: error */
.tv-player-overlay.state-error .tv-overlay-icon-wrap {
    background: rgba(239, 68, 68, 0.07);
    border-color: rgba(239, 68, 68, 0.18);
}

.tv-player-overlay.state-error .tv-overlay-icon-wrap i {
    color: var(--error);
}

.tv-overlay-msg {
    font-family: "Outfit", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.tv-overlay-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* =============================================================
   NOW PLAYING INFO BAR
   ============================================================= */
.tv-info-bar {
    background: var(--tv-bg-panel);
    border-top: 1px solid var(--tv-border);
    padding: 0.9rem var(--sp-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-md);
    flex-shrink: 0;
    box-shadow: 0 -2px 12px rgba(26, 26, 46, 0.05);
}

.tv-now-playing {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    overflow: hidden;
}

.tv-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    background: rgba(255, 107, 107, 0.10);
    border: 1px solid rgba(255, 107, 107, 0.22);
    border-radius: var(--r-pill);
    font-family: "Outfit", sans-serif;
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--coral);
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

.tv-live-pulse {
    width: 6px;
    height: 6px;
    background: var(--coral);
    border-radius: 50%;
    animation: pulseLive 1.4s ease-in-out infinite;
}

.tv-now-playing-details { overflow: hidden; }

.tv-current-title {
    font-family: "Outfit", sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-current-category {
    font-size: 0.75rem;
    color: var(--coral);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1px;
}

.tv-info-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.tv-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 0.9rem;
    background: var(--tv-bg-surface);
    border: 1.5px solid var(--tv-border-md);
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    font-family: "DM Sans", sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.tv-action-btn:hover {
    background: var(--coral);
    color: #fff;
    border-color: var(--coral);
    box-shadow: var(--shadow-coral);
    transform: translateY(-1px);
}

.tv-action-btn.btn-error {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.tv-action-btn.btn-error:hover {
    background: var(--error);
    border-color: var(--error);
    color: #fff;
}

/* =============================================================
   TOAST NOTIFICATIONS
   ============================================================= */
.tv-toast-container {
    position: fixed;
    bottom: var(--sp-lg);
    right: var(--sp-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.tv-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1rem;
    background: var(--tv-bg-panel);
    border: 1px solid var(--tv-border-md);
    border-left: 3px solid var(--coral);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    min-width: 260px;
    max-width: 340px;
    pointer-events: auto;
    font-size: 0.85rem;
    color: var(--text-primary);
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.3s var(--ease-out);
}

.tv-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.tv-toast.tv-toast-success { border-left-color: var(--success); }
.tv-toast.tv-toast-error   { border-left-color: var(--error); }
.tv-toast.tv-toast-info    { border-left-color: var(--sky); }

.tv-toast i { font-size: 1rem; flex-shrink: 0; }
.tv-toast.tv-toast-success i { color: var(--success); }
.tv-toast.tv-toast-error   i { color: var(--error); }
.tv-toast.tv-toast-info    i { color: var(--sky); }
.tv-toast:not([class*="tv-toast-"]) i { color: var(--coral); }

/* =============================================================
   ANIMATIONS
   ============================================================= */
@keyframes pulseLive {
    0%, 100% { opacity: 0.65; transform: scale(1); }
    50%       { opacity: 1;    transform: scale(1.18); }
}

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

/* =============================================================
   RESPONSIVE — MOBILE
   ============================================================= */
@media (max-width: 820px) {
    :root { --sidebar-w: 300px; }

    .tv-btn-sidebar-toggle { display: inline-flex; }

    .tv-app-container { grid-template-columns: 1fr; }

    .tv-sidebar {
        position: fixed;
        top: var(--header-h);
        left: -100%;
        bottom: 0;
        width: var(--sidebar-w);
        z-index: 99;
        box-shadow: 10px 0 40px rgba(26, 26, 46, 0.14);
        transition: left var(--dur-normal) var(--ease-out);
    }

    .tv-sidebar.active { left: 0; }

    .tv-header-logo span { display: none; }

    .tv-info-bar { padding: 0.75rem var(--sp-md); }

    .tv-action-btn span   { display: none; }
    .tv-action-btn        { padding: 0.45rem 0.6rem; }
}

@media (max-width: 480px) {
    .tv-header { padding: 0 var(--sp-md); }

    .tv-toast-container {
        bottom: var(--sp-md);
        right: var(--sp-md);
        left: var(--sp-md);
    }

    .tv-toast { max-width: 100%; }
}