/* ===== CSS VARIABLES ===== */
:root {
  --bg-base:      #0a0a12;
  --bg-surface:   #10101e;
  --bg-card:      #16162a;
  --bg-hover:     #1e1e36;
  --bg-active:    #252540;
  --accent:       #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow:  rgba(99, 102, 241, 0.25);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:   #475569;
  --border:       #1e2035;
  --border-light: #2a2a45;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --error:        #ef4444;
  --sidebar-w:    300px;
  --header-h:     56px;
  --transition:   0.2s ease;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 4px 24px rgba(0,0,0,0.5);
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --bg-base:        #f0f2f8;
  --bg-surface:     #ffffff;
  --bg-card:        #eaecf4;
  --bg-hover:       #e0e3ef;
  --bg-active:      #d5d9ee;
  --accent:         #6366f1;
  --accent-hover:   #4f46e5;
  --accent-glow:    rgba(99, 102, 241, 0.15);
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --border:         #d4d8ed;
  --border-light:   #c5cae0;
  --shadow:         0 4px 24px rgba(0,0,0,0.10);
}

/* Smooth theme transition */
html { transition: background-color 0.2s ease; }
body, .header, .sidebar, .epg-strip, .schedule-panel,
.modal, .setup-card, .channel-item, .group-btn,
.text-input, .btn-icon, .btn-text, .btn-primary,
.toast, .player-error-msg {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input { font: inherit; color: inherit; }
img { display: block; }

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== SETUP SCREEN ===== */
.setup-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  z-index: 1000;
}

.setup-inner {
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  animation: fadeIn 0.4s ease;
}

.setup-logo {
  text-align: center;
  margin-bottom: 2.5rem;
}
.setup-logo .logo-icon {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 0 20px var(--accent));
}
.setup-logo h1 {
  margin-top: 0.75rem;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.setup-logo p {
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

.setup-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.text-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.text-input::placeholder { color: var(--text-muted); }

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.file-drop {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}
.file-drop:hover, .file-drop.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.file-drop-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.file-drop p   { color: var(--text-secondary); font-size: 0.85rem; }
.file-drop span { color: var(--accent); }

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  margin-top: 1.5rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), transform 0.1s;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== MAIN APP ===== */
.main-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ===== HEADER ===== */
.header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  flex-shrink: 0;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  white-space: nowrap;
  min-width: fit-content;
}
.header-logo .logo-icon { font-size: 1.3rem; }

.header-search {
  flex: 1;
  max-width: 360px;
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
  font-size: 0.875rem;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1rem;
  transition: color var(--transition), background var(--transition);
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-icon.active { color: var(--accent); }

.btn-text {
  padding: 0.4rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: all var(--transition);
}
.btn-text:hover { border-color: var(--accent); color: var(--text-primary); }

/* ===== CONTENT AREA ===== */
.content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition), opacity var(--transition);
  overflow: hidden;
}
.sidebar.collapsed {
  width: 0;
  border-right-width: 0;
}

/* ===== GROUP COMBOBOX ===== */
.group-select-wrap {
  position: relative;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.group-select-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 0.4rem 0 0.75rem;
  cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.group-select-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.group-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 0.55rem 0.25rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  min-width: 0;
}
.group-search-input::placeholder { color: var(--text-muted); }

.group-clear-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 0.15rem 0.3rem;
  line-height: 1;
  border-radius: 50%;
  transition: color var(--transition), background var(--transition);
}
.group-clear-btn.visible { display: flex; align-items: center; justify-content: center; }
.group-clear-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

.group-arrow {
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.25rem;
  pointer-events: none;
  transition: transform var(--transition);
}
.group-select-wrap.open .group-arrow { transform: rotate(180deg); }

.group-dropdown {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  top: calc(100% - 0.15rem);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 300;
  max-height: 280px;
  overflow-y: auto;
}

.group-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.group-option:hover { background: var(--bg-hover); color: var(--text-primary); }
.group-option.selected {
  background: var(--bg-active);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.group-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  flex-shrink: 0;
  font-weight: 400;
}
.group-option.selected .group-count { color: var(--accent); }
.group-option.group-separator {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem 0.2rem;
  cursor: default;
  border-left: none;
  pointer-events: none;
}
.group-option.group-separator:hover { background: none; }
.group-no-match {
  padding: 0.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.channels-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.no-results {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-size: 0.85rem;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}
.channel-item:hover { background: var(--bg-hover); }
.channel-item.active {
  background: var(--bg-active);
  border-left-color: var(--accent);
}

.channel-logo-wrap {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-hover);
}
.channel-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.channel-logo-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-active);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
}

.channel-info {
  flex: 1;
  min-width: 0;
}
.channel-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.channel-epg-preview {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.channel-fav-btn {
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.2rem;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
  flex-shrink: 0;
}
.channel-item:hover .channel-fav-btn { opacity: 1; }
.channel-fav-btn.active { opacity: 1; color: #f59e0b; }
.channel-fav-btn:hover { color: #f59e0b; }

/* ===== PLAYER AREA ===== */
.player-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000;
}

.player-wrapper {
  position: relative;
  flex: 1;
  background: #000;
  overflow: hidden;
  min-height: 0;
}

#video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Player states */
.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  gap: 1rem;
  z-index: 10;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.player-error-msg {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239,68,68,0.9);
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  z-index: 20;
  white-space: nowrap;
}

/* Player overlay (hover info) */
.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.8) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 5;
}
.player-overlay.visible { opacity: 1; }

.overlay-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.overlay-logo {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(255,255,255,0.1);
}
.overlay-channel-name {
  font-size: 1.1rem;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.overlay-bottom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: all;
}
.player-control-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  transition: background var(--transition);
  font-size: 1rem;
}
.player-control-btn:hover { background: rgba(255,255,255,0.3); }
.player-control-btn.active { color: #f59e0b; }

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.25rem;
}
.volume-slider {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.3);
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.player-controls-spacer { flex: 1; }

.player-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-muted);
}
.player-placeholder .ph-icon { font-size: 4rem; opacity: 0.3; }
.player-placeholder p { font-size: 1rem; }

/* ===== EPG STRIP ===== */
.epg-strip {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: stretch;
  gap: 1.5rem;
  flex-shrink: 0;
  min-height: 68px;
}

.epg-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.epg-block.epg-now { flex: 2; }
.epg-block.epg-next { flex: 1; }

.epg-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.epg-block.epg-now .epg-label { color: var(--accent); }

.epg-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.epg-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.epg-progress-track {
  height: 3px;
  background: var(--border-light);
  border-radius: 2px;
  margin-top: 0.35rem;
  overflow: hidden;
}
.epg-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
}

.epg-divider {
  width: 1px;
  background: var(--border);
  align-self: stretch;
  margin: 0.25rem 0;
}

.epg-strip-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.btn-schedule {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-schedule:hover { border-color: var(--accent); color: var(--accent); }

/* ===== SCHEDULE PANEL ===== */
.schedule-panel {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  flex-shrink: 0;
}
.schedule-panel.open { max-height: 200px; overflow-y: auto; }

.schedule-list { padding: 0.5rem 1rem; }

.schedule-item {
  display: flex;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.schedule-item:last-child { border-bottom: none; }
.schedule-item.current .schedule-title { color: var(--accent); font-weight: 600; }
.schedule-item.past { opacity: 0.4; }
.schedule-time {
  font-size: 0.78rem;
  color: var(--text-secondary);
  min-width: 40px;
  font-variant-numeric: tabular-nums;
}
.schedule-title {
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* ===== SETTINGS MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.25s ease;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.btn-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: background var(--transition);
}
.btn-modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-section h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.epg-status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.epg-status-badge.ok   { background: rgba(34,197,94,0.15); color: var(--success); }
.epg-status-badge.warn { background: rgba(245,158,11,0.15); color: var(--warning); }

.epg-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.epg-suggestion-btn {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.epg-suggestion-btn:hover { border-color: var(--accent); color: var(--accent); }

.settings-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.btn-secondary {
  padding: 0.6rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--border-light); color: var(--text-primary); }

.btn-danger {
  padding: 0.6rem 1.25rem;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Data actions list in settings */
.data-actions { display: flex; flex-direction: column; gap: 0; }
.data-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.data-action-row:last-child { border-bottom: none; }
.data-action-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.btn-save {
  padding: 0.6rem 1.5rem;
  background: var(--accent);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background var(--transition);
}
.btn-save:hover { background: var(--accent-hover); }

.kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--text-secondary);
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 0.25rem 0;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background: var(--bg-base);
  z-index: 2000;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== PLAYLIST CURRENT INFO ===== */
.playlist-current-info {
  padding: 0.6rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  word-break: break-all;
}
.playlist-current-info.has-playlist {
  border-color: rgba(99,102,241,0.4);
  color: var(--text-primary);
}
.playlist-current-info .pci-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

/* ===== INPUT ROW ===== */
.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.input-row .text-input {
  flex: 1;
  min-width: 0;
}

/* ===== PASSWORD WRAP ===== */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrap .text-input {
  flex: 1;
  padding-right: 2.75rem;
}
.btn-eye {
  position: absolute;
  right: 0.65rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.05rem;
  padding: 0.25rem;
  line-height: 1;
  transition: color var(--transition);
  user-select: none;
}
.btn-eye:hover { color: var(--text-primary); }

/* ===== LOGIN ERROR ===== */
.login-error {
  margin-top: 0.6rem;
  padding: 0.55rem 0.85rem;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 0.83rem;
  font-weight: 500;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 300px;
}
.toast.show { transform: translateX(0); }
.toast-info    { background: var(--bg-card); border: 1px solid var(--border-light); }
.toast-success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.4); color: var(--success); }
.toast-warning { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.4); color: var(--warning); }
.toast-error   { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.4); color: var(--error); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE — TABLET ===== */
@media (max-width: 900px) {
  :root { --sidebar-w: 240px; }
}

/* ===== RESPONSIVE — MOBILE ===== */
@media (max-width: 640px) {
  .main-app { flex-direction: column; }
  .content  { flex-direction: column; }

  .sidebar {
    width: 100% !important;
    height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
    order: 2;
  }
  .sidebar.collapsed {
    height: 0;
    border-bottom-width: 0;
  }

  .player-area { order: 1; flex: none; height: 55vh; }

  .epg-strip  { flex-wrap: wrap; min-height: auto; }
  .epg-divider{ display: none; }
  .epg-block.epg-next { flex: 1 0 100%; }

  .volume-slider { width: 60px; }
  .header-logo span { display: none; }

  .setup-inner { padding: 1.25rem; }
  .setup-card  { padding: 1.25rem; }

  .modal { max-width: 100%; margin: 0 0.5rem; }
  .shortcuts-grid { grid-template-columns: 1fr; }
}

/* ===== FULLSCREEN ===== */
.player-wrapper:fullscreen { background: #000; }
.player-wrapper:fullscreen #video-player { object-fit: contain; }
.player-wrapper:-webkit-full-screen #video-player { object-fit: contain; }
