/* DuxTV - Professional TV Service UI */

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

:root {
  /* Professional Color Palette - Flat, dark theme */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #1c2128;
  --bg-hover: #30363d;
  --bg-active: #1f6feb;
  
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  
  --accent-primary: #1f6feb;
  --accent-secondary: #388bfd;
  --accent-success: #3fb950;
  --accent-warning: #d29922;
  --accent-danger: #f85149;
  
  --border-color: #30363d;
  --border-light: #21262d;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  
  /* No border radius - flat squared UI */
  --radius: 0;
  
  /* Transitions */
  --transition-fast: 100ms ease;
  --transition-normal: 200ms ease;

  /* Layout sizing: header height + top/bottom paddings around live player */
  --live-player-offset: 180px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  font-size: 14px;
}

/* Screen Management */
.screen {
  display: none;
  height: 100vh;
  overflow: hidden;
}

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

#app-screen {
  height: 100vh;
  overflow: hidden;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast);
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.btn-primary:active {
  background: var(--accent-primary);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==================== LOGIN SCREEN ==================== */
#login-screen {
  justify-content: center;
  align-items: center;
  background: var(--bg-primary);
}

.login-container {
  width: 100%;
  max-width: 360px;
  padding: var(--space-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.logo-icon {
  font-size: 48px;
  color: var(--accent-primary);
  display: block;
  margin-bottom: var(--space-md);
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition-fast);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.error-message {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid var(--accent-danger);
  border-radius: var(--radius);
  color: var(--accent-danger);
  font-size: 13px;
  text-align: center;
}

/* ==================== APP HEADER ==================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  height: 56px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-icon-small {
  font-size: 20px;
  color: var(--accent-primary);
}

.header-brand h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-nav {
  display: flex;
  gap: 2px;
  background: var(--bg-tertiary);
  padding: 2px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-btn i {
  font-size: 12px;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent-primary);
  color: white;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.search-box {
  position: relative;
}

.search-box input {
  width: 220px;
  padding: var(--space-sm) var(--space-md);
  padding-left: 32px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.search-box .search-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-secondary);
  font-size: 13px;
}

.user-menu i {
  font-size: 14px;
}

.user-menu #current-user {
  font-weight: 500;
}

/* Settings button (clickable username) */
.user-settings-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-settings-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.user-settings-btn i {
  font-size: 14px;
}

.user-settings-btn #current-user {
  font-weight: 500;
}

/* Settings form select */
.settings-select {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.settings-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.settings-form {
  padding: var(--space-md) 0;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  display: none;
  flex: 1;
  overflow: hidden;
}

.main-content.active {
  display: flex;
  flex-direction: column;
}

#live-view {
  overflow-y: auto;
}

/* ==================== PLAYER SECTION ==================== */
.player-section {
  background: var(--bg-secondary);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.player-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.player-container .video-js {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  border-radius: var(--radius);
  overflow: hidden;
}

/* Ensure Video.js control bar stays within the player bounds */
.player-container .video-js .vjs-control-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  z-index: 10;
}

.player-overlay.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
}

.overlay-content .overlay-icon {
  font-size: 64px;
  color: var(--text-muted);
  display: block;
  margin-bottom: var(--space-lg);
}

.overlay-content p {
  color: var(--text-secondary);
  font-size: 14px;
}

.now-playing-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: var(--space-md) auto 0;
}

.channel-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.channel-info h2 {
  font-size: 16px;
  font-weight: 600;
}

.category-badge {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--accent-danger);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
}

.live-badge i {
  font-size: 8px;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ==================== CHANNELS SECTION ==================== */
.channels-section {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.categories-sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  flex-shrink: 0;
}

.categories-sidebar h3 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.categories-sidebar h3 i {
  font-size: 12px;
}

.category-list {
  list-style: none;
}

.category-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-left: 2px solid transparent;
}

.category-item:hover {
  background: var(--bg-hover);
}

.category-item.active {
  background: var(--bg-tertiary);
  border-left-color: var(--accent-primary);
}

.category-icon {
  font-size: 14px;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
}

.category-item.active .category-icon {
  color: var(--accent-primary);
}

.category-item span:nth-child(2) {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-count {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-muted);
}

.channels-grid-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  background: var(--bg-primary);
}

.channels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.channels-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.results-count {
  font-size: 12px;
  color: var(--text-muted);
}

.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-md);
}

.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.channel-card:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.channel-card.active {
  border-color: var(--accent-primary);
  background: rgba(31, 111, 235, 0.1);
}

.channel-card-icon {
  font-size: 24px;
  color: var(--accent-primary);
  margin-bottom: var(--space-sm);
  display: block;
}

.channel-card-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-card-category {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.channel-card-id {
  display: inline-block;
  margin-top: var(--space-sm);
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  text-align: center;
  min-height: 200px;
}

.empty-icon {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
  opacity: 0.5;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ==================== GUIDE VIEW ==================== */
.guide-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--space-lg);
}

.guide-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.guide-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.guide-nav-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.guide-header h3 {
  font-size: 16px;
  font-weight: 600;
  min-width: 180px;
  text-align: center;
}

.guide-container {
  flex: 1;
  display: grid;
  grid-template-columns: 180px 1fr;
  grid-template-rows: auto 1fr;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.guide-timeline {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.guide-time-slot {
  min-width: 100px;
  padding: var(--space-sm) var(--space-md);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  border-right: 1px solid var(--border-color);
  text-transform: uppercase;
}

.guide-time-slot.current {
  background: var(--accent-primary);
  color: white;
}

.guide-channels {
  grid-column: 1;
  grid-row: 2;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
}

.guide-channel-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  height: 48px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.guide-channel-item:hover {
  background: var(--bg-hover);
}

.guide-channel-icon {
  font-size: 14px;
  color: var(--text-muted);
}

.guide-channel-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guide-programs {
  grid-column: 2;
  grid-row: 2;
  overflow: auto;
}

.guide-program-row {
  position: relative;
  height: 48px;
  width: 2400px; /* 24 hours * 100px per hour */
  border-bottom: 1px solid var(--border-color);
}

.guide-program-item {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition-fast);
  overflow: hidden;
  box-sizing: border-box;
}

.guide-program-item:hover {
  background: var(--bg-hover);
}

.guide-program-item.current {
  background: rgba(31, 111, 235, 0.15);
  border-left: 2px solid var(--accent-primary);
}

.guide-program-title {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guide-program-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==================== ADMIN PANEL ==================== */
.admin-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--space-lg);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.admin-header h2 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 18px;
  font-weight: 600;
}

.admin-header h2 i {
  color: var(--accent-primary);
}

.admin-content {
  flex: 1;
  overflow-y: auto;
}

/* Users Table */
.users-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.users-table th,
.users-table td {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.users-table th {
  background: var(--bg-tertiary);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.users-table td {
  font-size: 14px;
}

.users-table tbody tr:hover {
  background: var(--bg-hover);
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.active {
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent-success);
}

.status-badge.inactive {
  background: rgba(248, 81, 73, 0.15);
  color: var(--accent-danger);
}

.status-badge.expired {
  background: rgba(210, 153, 34, 0.15);
  color: var(--accent-warning);
}

.action-buttons {
  display: flex;
  gap: var(--space-sm);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.action-btn.edit:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.action-btn.delete:hover {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: var(--space-xl);
  margin: var(--space-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

.form-hint {
  display: block;
  margin-top: var(--space-xs);
  font-size: 11px;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
  flex: 1;
}

/* ==================== VIDEO.JS CUSTOMIZATION ==================== */
.video-js {
  font-family: inherit;
}

.video-js .vjs-big-play-button {
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius);
  width: 64px;
  height: 48px;
  line-height: 48px;
  font-size: 24px;
  margin-left: -32px;
  margin-top: -24px;
}

.video-js .vjs-big-play-button:hover {
  background: var(--accent-secondary);
}

.video-js .vjs-control-bar {
  background: rgba(0, 0, 0, 0.8);
  height: 36px;
}

.video-js .vjs-progress-control .vjs-play-progress {
  background: var(--accent-primary);
}

.video-js .vjs-volume-panel .vjs-volume-level {
  background: var(--accent-primary);
}

/* Video.js City theme customizations for live TV */
.player-container .video-js.vjs-theme-city {
  font-family: inherit;
}

/* Hide the big play button when playing live */
.player-container .video-js.vjs-theme-city.vjs-has-started .vjs-big-play-button {
  display: none;
}

/* Style the live indicator */
.player-container .video-js .vjs-live-control {
  display: flex;
  align-items: center;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .categories-sidebar {
    width: 200px;
  }
  
  .channels-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  
  .search-box input {
    width: 160px;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-wrap: wrap;
    gap: var(--space-md);
    padding: var(--space-md);
    height: auto;
  }
  
  .header-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  
  .header-right {
    flex: 1;
    justify-content: flex-end;
  }
  
  .search-box {
    display: none;
  }
  
  .channels-section {
    flex-direction: column;
  }
  
  .categories-sidebar {
    width: 100%;
    max-height: 120px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .categories-sidebar h3 {
    display: none;
  }
  
  .category-list {
    display: flex;
    overflow-x: auto;
    padding: var(--space-sm);
  }
  
  .category-item {
    flex-shrink: 0;
    padding: var(--space-sm) var(--space-md);
    border-left: none;
    border-bottom: 2px solid transparent;
  }
  
  .category-item.active {
    border-left: none;
    border-bottom-color: var(--accent-primary);
  }
  
  .channels-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  
  .guide-container {
    grid-template-columns: 100px 1fr;
  }
}

@media (max-width: 480px) {
  .login-container {
    margin: var(--space-md);
    padding: var(--space-lg);
  }
  
  .logo-icon {
    font-size: 36px;
  }
  
  .login-logo h1 {
    font-size: 20px;
  }
  
  .channel-card {
    padding: var(--space-md);
  }
  
  .channel-card-icon {
    font-size: 20px;
  }
  
  .channel-card-name {
    font-size: 13px;
  }
}

/* ==================== MOBILE-SPECIFIC STYLES ==================== */
/* Applied when body has .is-mobile class */

/* Mobile: Larger touch targets and better spacing */
body.is-mobile .category-item {
  padding: var(--space-lg) var(--space-xl);
  min-height: 48px; /* Touch-friendly minimum height */
}

body.is-mobile .channel-card {
  padding: var(--space-lg);
  min-height: 100px;
}

/* Mobile: Prevent text from being squished - allow wrapping */
body.is-mobile .channel-card-name {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
}

body.is-mobile .channel-card-category {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
}

body.is-mobile .category-item span:nth-child(2) {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Mobile: Better grid for channel cards - fewer columns on narrow screens */
body.is-mobile .channels-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-lg);
}

/* Mobile: Larger buttons for touch */
body.is-mobile .btn-primary {
  padding: var(--space-lg) var(--space-xl);
  font-size: 16px;
  min-height: 48px;
}

body.is-mobile .btn-secondary {
  padding: var(--space-md) var(--space-lg);
  font-size: 14px;
  min-height: 44px;
}

body.is-mobile .nav-btn {
  padding: var(--space-md) var(--space-lg);
  min-height: 44px;
}

/* Mobile: Better player controls */
body.is-mobile .player-container {
  max-height: none; /* Allow taller player on mobile */
}

/* Mobile: Larger form inputs */
body.is-mobile .form-group input {
  padding: var(--space-lg);
  font-size: 16px; /* Prevents iOS zoom on focus */
  min-height: 48px;
}

/* Mobile: Better guide navigation */
body.is-mobile .guide-nav-btn {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

body.is-mobile .guide-channel-item {
  height: 56px;
  padding: var(--space-lg);
}

body.is-mobile .guide-program-row {
  height: 56px;
}

/* Mobile: Better search input */
body.is-mobile .search-box input {
  padding: var(--space-md) var(--space-lg);
  padding-left: 40px;
  font-size: 16px;
  min-height: 44px;
}

/* Mobile: User menu adjustments */
body.is-mobile .user-menu {
  font-size: 14px;
}

/* Mobile: Header adjustments for very small screens */
@media (max-width: 480px) {
  body.is-mobile .header-brand h1 {
    display: none; /* Hide brand text on very small screens */
  }
  
  body.is-mobile .channels-grid {
    grid-template-columns: 1fr; /* Single column on very small screens */
  }
  
  body.is-mobile .channel-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
  }
  
  body.is-mobile .channel-card-icon {
    margin-bottom: 0;
    flex-shrink: 0;
  }
  
  body.is-mobile .channel-card > div {
    flex: 1;
    min-width: 0; /* Allow text to shrink */
  }
  
  body.is-mobile .channel-card-id {
    margin-top: 0;
    margin-left: auto;
    flex-shrink: 0;
  }
}

/* ==================== VOD VIEW ==================== */
.vod-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vod-section.hidden {
  display: none;
}

.vod-categories-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
}

/* VOD Category Row */
.vod-category-row {
  margin-bottom: var(--space-xl);
}

.vod-category-row.hidden {
  display: none;
}

.vod-category-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  padding-left: var(--space-sm);
}

.vod-category-title i {
  color: var(--accent-primary);
  font-size: 14px;
}

/* VOD Horizontal Scroll */
.vod-items-scroll {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}

.vod-items-scroll::-webkit-scrollbar {
  height: 6px;
}

.vod-items-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.vod-items-scroll::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

/* VOD Poster Card */
.vod-poster-card {
  flex-shrink: 0;
  width: 140px;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast);
}

.vod-poster-card:hover {
  transform: scale(1.05);
}

.vod-poster-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.vod-poster-card .vod-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--bg-tertiary);
}

.vod-poster-card .vod-progress-fill {
  height: 100%;
  background: var(--accent-primary);
}

/* Episode label for continue watching TV shows */
.vod-poster-card .vod-episode-label {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.8);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
}

/* VOD Poster Tooltip */
.vod-poster-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: var(--space-md);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  pointer-events: none;
}

.vod-poster-card:hover .vod-poster-tooltip {
  opacity: 1;
  visibility: visible;
}

.vod-poster-tooltip h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vod-poster-tooltip .tooltip-meta {
  display: flex;
  gap: var(--space-sm);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.vod-poster-tooltip .tooltip-rating {
  color: var(--accent-warning);
}

.vod-poster-tooltip p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* VOD Search */
.vod-search-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.vod-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.vod-back-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.vod-search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-md);
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

/* VOD Detail Page */
.vod-detail-container {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.vod-detail-container .vod-back-btn {
  position: absolute;
  top: var(--space-lg);
  left: var(--space-lg);
  z-index: 10;
}

.vod-detail-content {
  display: flex;
  flex-direction: column;
}

.vod-detail-backdrop {
  width: 100%;
  height: 300px;
  background-size: cover;
  background-position: center top;
  position: relative;
}

.vod-detail-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, var(--bg-primary) 100%);
}

.vod-detail-info {
  display: flex;
  gap: var(--space-xl);
  padding: 0 var(--space-xl);
  margin-top: -100px;
  position: relative;
  z-index: 1;
}

.vod-detail-poster {
  flex-shrink: 0;
  width: 200px;
}

.vod-detail-poster img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.vod-detail-meta {
  flex: 1;
  padding-top: 60px;
}

.vod-detail-meta h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.vod-detail-badges {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.vod-rating {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--accent-warning);
  color: #000;
  font-size: 12px;
  font-weight: 600;
}

.vod-rating::before {
  content: '★';
}

.vod-year,
.vod-runtime,
.vod-seasons {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-secondary);
}

.vod-overview {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  max-width: 600px;
}

.vod-detail-actions {
  display: flex;
  gap: var(--space-md);
}

.vod-play-btn {
  width: auto;
  padding: var(--space-md) var(--space-xl);
}

.vod-favorite-btn {
  width: 48px;
  height: 48px;
  font-size: 20px;
}

.vod-favorite-btn.active i {
  font-weight: 900;
  color: var(--accent-warning);
}

/* TV Show Episodes */
.vod-tv-episodes {
  padding: var(--space-xl);
}

.vod-season-selector {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.vod-season-selector label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.vod-season-selector select {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.vod-episodes-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.vod-episode-card {
  display: flex;
  gap: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.vod-episode-card:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.vod-episode-thumb {
  flex-shrink: 0;
  width: 180px;
  height: 100px;
  background: var(--bg-tertiary);
  position: relative;
}

.vod-episode-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vod-episode-thumb .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.vod-episode-card:hover .play-overlay {
  opacity: 1;
}

.vod-episode-thumb .play-overlay i {
  font-size: 32px;
  color: white;
}

.vod-episode-info {
  flex: 1;
  min-width: 0;
}

.vod-episode-number {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.vod-episode-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.vod-episode-synopsis {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vod-episode-synopsis-tooltip {
  display: none;
}

.vod-episode-card:hover .vod-episode-synopsis-tooltip {
  display: block;
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: var(--space-md);
  max-width: 400px;
  z-index: 100;
}

/* VOD Player */
.vod-player-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  position: relative;
}

.vod-player-container .vod-back-btn {
  position: absolute;
  top: var(--space-lg);
  left: var(--space-lg);
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
}

.vod-player-wrapper {
  flex: 1;
  display: flex;
}

.vod-player-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* VOD Responsive */
@media (max-width: 768px) {
  .vod-detail-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .vod-detail-poster {
    width: 150px;
  }

  .vod-detail-meta {
    padding-top: var(--space-lg);
  }

  .vod-detail-meta h1 {
    font-size: 22px;
  }

  .vod-detail-badges {
    justify-content: center;
  }

  .vod-detail-actions {
    justify-content: center;
  }

  .vod-episode-card {
    flex-direction: column;
  }

  .vod-episode-thumb {
    width: 100%;
    height: 150px;
  }
}
