@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: #0a0a0a;
    background-image: url('../branding/dream-tv/bg-image.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    overflow: hidden; /* Prevent default scroll */
    user-select: none;
    touch-action: none; /* Prevent touch gestures like pinch-zoom */
    width: 100vw;
    height: 100vh;
}

#app {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
    top: 0;
    left: 0;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    width: 100px; /* Increased from 80px */
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    display: flex;
    flex-direction: column;
    align-items: center; /* Centered icons horizontally */
    padding-top: 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    /* transition: width 0.3s ease-out; */
    /* will-change: width; */
    z-index: 100;
}

/* Sidebar Expansion on Hover */
#sidebar:hover {
    width: 300px;
    align-items: flex-start;
}

#sidebar:hover .menu-item {
    flex-direction: row;
    align-items: center;
    padding-left: 20px;
    justify-content: flex-start;
}

#sidebar:hover .menu-item i, 
#sidebar:hover .menu-item img {
    margin-bottom: 0;
    margin-right: 15px;
    width: 40px;
    height: 40px;
}

#sidebar:hover .menu-item span {
    display: block;
}

#sidebar.expanded {
    width: 300px; /* Keep for manual toggle if needed */
    align-items: flex-start; 
}

.logo-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.logo-container img {
    width: 60px; /* Increased logo size */
    height: 60px;
    object-fit: contain;
}

.menu {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center items in collapsed mode */
}

.menu-item {
    width: 100%;
    padding: 20px 0; /* Increased vertical padding */
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content */
    justify-content: center;
    color: #888;
    cursor: pointer;
    /* transition: color 0.2s, background-color 0.2s, border-left-color 0.2s; */
    border-left: 4px solid transparent; /* Increased border width */
}

#sidebar.expanded .menu-item {
    flex-direction: row;
    align-items: center;
    padding-left: 20px;
    justify-content: flex-start;
}

.menu-item:hover, .menu-item.active, .menu-item:focus, .menu-item.focused {
    color: #00d2ff;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #00d2ff;
    outline: none;
}

.menu-item i, .menu-item img {
    font-size: 50px; 
    width: 60px; /* Increased icon size */
    height: 60px;
    margin-bottom: 5px;
    object-fit: contain;
}

#sidebar.expanded .menu-item i, #sidebar.expanded .menu-item img {
    margin-bottom: 0;
    margin-right: 15px;
    width: 40px; /* Smaller when expanded to fit text */
    height: 40px;
}

.menu-item span {
    font-size: 12px;
    display: none; /* Hide text initially */
}

#sidebar.expanded .menu-item span {
    display: block;
}

.search-container {
    padding: 10px 15px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    font-size: 18px;
    /* transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s; */
}

.search-input:focus {
    border-color: #00d2ff;
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.search-results-info {
    padding: 0 15px 10px 15px;
    color: #888;
    font-size: 14px;
}

/* Main Content */
#main-content {
    flex: 1;
    overflow-y: hidden; /* Hide scrollbar globally, specific screens can override */
    position: relative;
    /* Removed padding: 40px to handle layout per screen */
}

.screen {
    display: none;
    /* animation: fadeIn 0.4s ease-out; */
    height: 100%;
    padding: 40px; /* Default padding for screens like Home, Settings */
    box-sizing: border-box; /* Include padding in height/width */
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* VOD Layout (2 Columns) */
.screen.active.vod-layout {
    flex-direction: row;
    padding: 0;
    overflow: hidden;
}

/* Live TV Layout (3 Columns) */
.screen.active.live-layout {
    flex-direction: row;
    gap: 0; /* Remove gap to have tight columns, utilize borders */
    padding: 0; /* Full screen layout */
    overflow: hidden;
}

.live-layout {
    /* Fallback/Base */
    flex-direction: row;
}

.column {
    background: #0b0b0b; /* Opaque background to hide potential overlaps */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    height: 100vh;
    overflow-y: hidden; /* Hide scrollbar but allow JS scroll */
    display: flex;
    flex-direction: column;
    position: relative; /* Ensure stacking context */
    z-index: 1; /* Ensure above potential background artifacts */
}

.categories-list {
    width: 250px;
    flex-shrink: 0;
    background: #0b0b0b; /* Reinforce opacity */
}

.channels-list {
    width: 300px;
    flex-shrink: 0;
    background: #0b0b0b; /* Reinforce opacity */
}

.player-area {
    flex: 1;
    background: black;
    position: relative;
    overflow: hidden; /* Prevent poster bleed */
    z-index: 0; /* Behind lists if overlap occurs */
}

.column h3 {
    padding: 20px;
    margin: 0;
    background: rgba(0,0,0,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 20px;
    color: #00d2ff;
}

.list-container {
    list-style: none;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

/* Video Player GPU Acceleration */
#video-player, #main-video-player, .video-container video {
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
}

/* Custom Scrollbar */
.list-container::-webkit-scrollbar {
    width: 5px;
}
.list-container::-webkit-scrollbar-thumb {
    background: #00d2ff;
    border-radius: 5px;
}

.list-item {
    padding: 15px;
    margin-bottom: 5px;
    border-radius: 5px;
    cursor: pointer;
    /* transition: transform 0.2s, background-color 0.2s, color 0.2s; */
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* will-change: transform, background-color; */
}

.list-item:focus, .list-item.focused {
    background: #00d2ff;
    color: black;
    font-weight: bold;
    transform: scale(1.02);
    outline: none;
}

.list-item.active {
    background: rgba(0, 210, 255, 0.2);
    color: #00d2ff;
    border: 1px solid #00d2ff;
}

/* Video Player */
.video-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: black;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Fullscreen Live Player */
.video-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    background: black;
}

.video-container.fullscreen video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Or cover if preferred */
}

/* Video Player (Shared) */
.video-player-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.video-player-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    outline: none !important;
    border: none !important;
}

.video-player-container video:focus,
.video-player-container:focus,
.video-player-container:focus-within {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Hide sidebar and other columns when in fullscreen */
body.live-fullscreen #sidebar,
body.live-fullscreen #live-categories,
body.live-fullscreen #live-channels {
    display: none !important;
}

.player-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%; /* Full width */
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    padding: 30px 50px;
    pointer-events: none;
    opacity: 0;
    /* transition: opacity 0.5s; */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.player-overlay.visible {
    opacity: 1;
}

/*
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
*/

h1, h2 {
    font-size: 36px;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    border-bottom: 2px solid #00d2ff;
    display: inline-block;
    padding-bottom: 10px;
}

/* Grids */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
    padding-bottom: 50px;
}

.card {
    background: rgba(20, 20, 20, 0.8);
    border-radius: 12px;
    display: flex;
    flex-direction: column; /* Allow vertical stacking for title */
    align-items: center;
    justify-content: center;
    border: 3px solid transparent;
    /* transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; */
    aspect-ratio: 2/3; /* Poster format */
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    position: relative; /* For absolute positioning of title overlay if needed */
    overflow: hidden; /* Ensure title stays inside or clips */
}

.card:focus, .card.focused {
    transform: scale(1.1);
    border-color: #00d2ff;
    background: rgba(40, 40, 40, 0.9);
    z-index: 10;
    outline: none;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.6);
}

/* Shimmer Animation for Loading Placeholders */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.card.loading {
    background-color: #2a2a2a;
    background-image: linear-gradient(90deg, #2a2a2a 0%, #3a3a3a 50%, #2a2a2a 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    transition: opacity 0.3s ease-in;
    border-radius: inherit; /* Match card border radius if any */
}

.card .title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    font-size: 14px;
    text-align: center;
    transform: translateY(100%);
    /* transition: transform 0.2s ease-in-out; */
    z-index: 2; /* Ensure overlay is above image */
}

.card:focus .title-overlay, .card.focused .title-overlay, .card:hover .title-overlay {
    transform: translateY(0);
}

/* Global Video Player Override to remove yellow border */
#video-player-overlay,
.screen.player-layout {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    background: #000;
    z-index: 99999;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

#main-video-player,
.video-container video,
video {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

#main-video-player:focus,
.video-container video:focus,
video:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}


/* Settings */
.settings-form {
    background: rgba(0,0,0,0.7);
    padding: 40px;
    border-radius: 15px;
    max-width: 600px;
    border: 1px solid rgba(255,255,255,0.1);
}

.form-group label {
    font-size: 18px;
    margin-bottom: 15px;
    display: block;
    color: #00d2ff;
}

.form-group input {
    width: 100%;
    padding: 15px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.1);
    color: white;
    border-radius: 8px;
    font-size: 18px;
    /* transition: border-color 0.2s; */
}

.form-group input:focus, .form-group input.focused {
    border-color: #00d2ff;
    outline: none;
    background: rgba(255,255,255,0.15);
}

button {
    margin-top: 20px;
    padding: 15px 40px;
    background: linear-gradient(45deg, #00d2ff, #007aff);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    /* transition: transform 0.2s; */
}

button:focus, button.focused {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.5);
    outline: none;
    border: 2px solid white;
}

/* Settings UI Improvements */
.settings-form {
    padding: 30px;
    margin-bottom: 50px; /* Ensure space for scrolling */
}

.settings-form h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 10px;
}

.settings-form label {
    font-size: 20px;
    color: #00d2ff;
    margin-bottom: 10px;
    display: block;
}

.settings-form input[type="password"], 
.settings-form input[type="text"] {
    height: 50px;
    font-size: 20px;
    padding: 10px 15px;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box; /* Fix width calculation */
}

.settings-form input:focus {
    border-color: #00d2ff;
    outline: none;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

.settings-form button {
    font-size: 18px;
    padding: 12px 25px;
    margin-top: 10px;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.toggle-container span {
    font-size: 20px;
    color: white;
}

.switch {
  position: relative;
  display: inline-block;
  width: 80px;
  height: 44px;
}

/* Hide default HTML checkbox but keep it accessible */
.switch input {
  opacity: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
  z-index: 1;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  /* -webkit-transition: .4s; */
  /* transition: .4s; */
}

.slider:before {
  position: absolute;
  content: "";
  height: 36px;
  width: 36px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  /* -webkit-transition: .4s; */
  /* transition: .4s; */
}

input:checked + .slider {
  background-color: #00d2ff;
}

input:focus + .slider {
  box-shadow: 0 0 1px #00d2ff;
}

input:checked + .slider:before {
  -webkit-transform: translateX(36px);
  -ms-transform: translateX(36px);
  transform: translateX(36px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Focus state for toggle switch (keyboard nav) */
.switch input:focus + .slider {
    box-shadow: 0 0 15px #00d2ff;
    border: 2px solid white;
}

/* Dashboard Styles */
#home {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #2a2a2a 0%, #000000 100%);
    width: 100%;
    height: 100%;
}

/* Dashboard Grid */
.dashboard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    background: radial-gradient(circle at center, rgba(20,20,30,0.8) 0%, rgba(0,0,0,0.95) 100%);
}

.dashboard-logo {
    margin-bottom: 50px;
    text-align: center;
    /* animation: fadeInDown 0.8s ease-out; */
}

.dashboard-logo img {
    width: 120px;
    height: 120px;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.5));
}

.dashboard-logo h1 {
    font-size: 48px;
    margin: 0;
    background: linear-gradient(45deg, #fff, #00d2ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    width: 80%;
    max-width: 1200px;
}

.dashboard-card {
    background: linear-gradient(145deg, rgba(30,30,30,0.6), rgba(10,10,10,0.8));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); */
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.05), transparent);
    transform: translateX(-100%);
    /* transition: transform 0.6s; */
}

.dashboard-card:hover::before, .dashboard-card:focus::before {
    transform: translateX(100%);
}

.dashboard-card:hover, .dashboard-card:focus {
    transform: translateY(-10px) scale(1.05);
    border-color: #00d2ff;
    box-shadow: 0 20px 40px rgba(0, 210, 255, 0.2);
    background: linear-gradient(145deg, rgba(40,40,50,0.8), rgba(20,20,30,0.9));
    outline: none;
}

.card-icon {
    margin-bottom: 20px;
    /* transition: transform 0.3s; */
}

.dashboard-card:hover .card-icon, .dashboard-card:focus .card-icon {
    transform: scale(1.1);
}

.dashboard-card h2 {
    font-size: 24px;
    margin: 0;
    color: #ccc;
    /* transition: color 0.3s; */
    border: none;
    padding: 0;
    text-shadow: none;
}

.dashboard-card:hover h2, .dashboard-card:focus h2 {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.8);
}

.dashboard-footer {
    margin-top: 50px;
    color: #666;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/*
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}
*/
