/* Reset & Variables */
:root {
    --bg-primary: #0a0a16;
    --bg-secondary: #121226;
    --bg-card: #1b1b3a;
    --text-primary: #ffffff;
    --text-secondary: #8c8da6;
    --accent: #ff3366;
    --accent-rgb: 255, 51, 102;
    --accent-secondary: #7000ff;
    --accent-glow: rgba(255, 51, 102, 0.6);
    --focus-border: #ffffff;
    --sidebar-width: 240px;
    --transition-speed: 0.25s;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Scrollbar styling for horizontal rows */
::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Spatial Navigation Focus State */
.nav-focusable {
    transition: transform var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow var(--transition-speed) ease,
                border-color var(--transition-speed) ease,
                background-color var(--transition-speed) ease;
    outline: none;
    border: 3px solid transparent;
}

.nav-focused {
    transform: scale(1.06);
    border-color: var(--focus-border);
    box-shadow: 0 0 25px var(--accent-glow), 0 0 10px rgba(255, 255, 255, 0.4);
    z-index: 10;
}

/* Profile Selector Screen */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    z-index: 50;
    background: radial-gradient(circle at center, #1b1335 0%, #06050e 100%);
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.screen.active {
    display: flex;
}

.profile-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 3rem;
    letter-spacing: -0.5px;
    text-shadow: 0 5px 15px rgba(0,0,0,0.5);
    background: linear-gradient(135deg, #fff 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-list {
    display: flex;
    gap: 2.5rem;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 900px;
    margin-bottom: 2rem;
}

.profile-card {
    background: transparent;
    cursor: pointer;
    border-radius: 16px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 170px;
}

.profile-avatar {
    width: 130px;
    height: 130px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    margin-bottom: 1.2rem;
    border: 3px solid rgba(255, 255, 255, 0.05);
}

.profile-card.nav-focused .profile-avatar {
    border-color: var(--focus-border);
}

.profile-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.profile-card.nav-focused .profile-name {
    color: var(--text-primary);
}

/* PIN Screen */
.pin-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(18, 18, 38, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 3rem 4rem;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.pin-header {
    margin-bottom: 2rem;
    text-align: center;
}

.pin-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.pin-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.pin-display {
    display: flex;
    gap: 1.2rem;
    margin-bottom: 2.5rem;
}

.pin-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    transition: all 0.15s ease;
}

.pin-dot.filled {
    background-color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.pin-dot.error {
    background-color: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 0 12px #ef4444;
    animation: shake 0.3s;
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    gap: 1rem;
    justify-content: center;
}

.pin-key {
    height: 80px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.pin-key.nav-focused {
    background-color: var(--accent);
    border-color: transparent;
    box-shadow: 0 0 20px var(--accent-glow);
}

.pin-key.action-key {
    font-size: 1.1rem;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.05);
}

.pin-key.action-key.nav-focused {
    background-color: var(--accent-secondary);
    box-shadow: 0 0 20px rgba(112, 0, 255, 0.6);
}

/* TV Main Home Screen Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Left Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.5rem;
    height: 100%;
    z-index: 10;
}

.logo-container {
    margin-bottom: 3.5rem;
    padding-left: 0.5rem;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(90deg, var(--accent) 0%, #ff6b6b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    background-color: transparent;
    text-decoration: none;
}

.nav-item.nav-focused {
    color: var(--text-primary);
    background-color: var(--bg-card);
}

.nav-item svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.active-profile-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.active-profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    font-size: 1rem;
}

.active-profile-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content Area */
.main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
    scroll-behavior: smooth;
}

/* Header Section */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 2.2rem;
    font-weight: 800;
}

/* Content Shelf (Horizontal Scroll Rows) */
.shelf {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    position: relative;
}

.shelf-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    padding-left: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.shelf-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 22px;
    background: var(--accent);
    border-radius: 3px;
}

.shelf-row {
    display: flex;
    gap: 1.8rem;
    overflow-x: auto;
    padding: 10px 5px 20px 5px;
    scroll-behavior: smooth;
    width: 100%;
}

/* Hide scrollbar default behaviour */
.shelf-row {
    scrollbar-width: none; /* Firefox */
}
.shelf-row::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
}

/* Video Card Item */
.video-card {
    flex: 0 0 280px;
    width: 280px;
    cursor: pointer;
    background-color: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.card-thumbnail-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #0d0d1e;
    overflow: hidden;
}

.card-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 3px 8px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-info {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6rem;
    line-height: 1.3rem;
}

/* Empty Shelf State */
.shelf-empty {
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px dashed rgba(255,255,255,0.08);
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Keyframe animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}
