/* Tasteybox TV Admin Modern UI Theme */
:root {
  --bg-main: #0B0E14;
  --bg-surface: #121824;
  --bg-card: #182030;
  --bg-card-hover: #1F2A3F;
  --bg-glass: rgba(24, 32, 48, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.18);
  
  --text-primary: #F3F4F6;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;

  --accent-primary: #6366F1;
  --accent-primary-hover: #4F46E5;
  --accent-primary-glow: rgba(99, 102, 241, 0.25);
  
  --accent-success: #10B981;
  --accent-warning: #F59E0B;
  --accent-danger: #EF4444;
  --accent-info: #06B6D4;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
  
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* TOP NAVIGATION */
.top-nav {
  height: 72px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-primary), #8B5CF6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #FFF;
  box-shadow: 0 4px 16px var(--accent-primary-glow);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-text h1 span {
  color: var(--accent-primary);
  background: linear-gradient(90deg, #818CF8, #C084FC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text .tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-search {
  position: relative;
  width: 420px;
}

.nav-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}

.nav-search input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

.nav-search input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--accent-success);
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* LAYOUT */
.layout-container {
  display: flex;
  flex: 1;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.menu-item i {
  font-size: 20px;
}

.menu-item .count-pill {
  margin-left: auto;
  font-size: 0.72rem;
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

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

.menu-item.active {
  background-color: var(--accent-primary);
  color: #FFF;
  box-shadow: 0 4px 16px var(--accent-primary-glow);
}

.menu-item.active .count-pill {
  background: rgba(255, 255, 255, 0.2);
  color: #FFF;
}

.tv-guide-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
}

.tv-guide-icon {
  font-size: 24px;
  color: var(--accent-primary);
}

.tv-guide-info strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.tv-guide-info span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  padding: 28px 36px;
  overflow-y: auto;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-color-hover);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.purple { background: rgba(99, 102, 241, 0.15); color: #818CF8; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.stat-icon.orange { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.stat-icon.blue { background: rgba(6, 182, 212, 0.15); color: #38BDF8; }

.stat-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* TOOLBAR */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  gap: 16px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-toggle {
  display: flex;
  background-color: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}

.toggle-btn.active {
  background-color: var(--accent-primary);
  color: #FFF;
}

/* CHANNELS GRID */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.channel-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.channel-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.channel-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.channel-logo-wrap {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.channel-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.channel-logo-wrap i {
  font-size: 26px;
  color: var(--text-muted);
}

.channel-details {
  flex: 1;
  min-width: 0;
}

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

.channel-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.cat-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #A5B4FC;
}

.type-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.type-badge.proxied { background: rgba(16, 185, 129, 0.15); color: #6EE7B7; }
.type-badge.direct { background: rgba(245, 158, 11, 0.15); color: #FCD34D; }
.type-badge.api { background: rgba(6, 182, 212, 0.15); color: #67E8F9; }

.channel-stream-url {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: monospace;
}

.channel-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  gap: 8px;
}

.action-btn-group {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-icon.danger:hover {
  background-color: rgba(239, 68, 68, 0.2);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* LIST VIEW */
.channels-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.channels-list .channel-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
}

.channels-list .channel-card-top {
  flex: 1;
}

.channels-list .channel-stream-url {
  max-width: 300px;
}

.channels-list .channel-card-actions {
  border-top: none;
  padding-top: 0;
}

/* BUTTONS & FORMS */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #FFF;
  box-shadow: 0 4px 14px var(--accent-primary-glow);
}

.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  transform: translateY(-1px);
}

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

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

.btn-info {
  background-color: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.3);
  color: #38BDF8;
}

.btn-info:hover {
  background-color: rgba(6, 182, 212, 0.25);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label.required::after {
  content: " *";
  color: var(--accent-danger);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.form-help {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 580px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.modal-backdrop.show .modal-card {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.15);
}

.input-with-preview {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo-preview-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* STREAM TESTER */
.tester-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 900px;
}

.input-with-button {
  display: flex;
  gap: 12px;
}

.player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.player-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  color: var(--text-secondary);
  gap: 12px;
  font-size: 0.95rem;
}

.player-overlay i {
  font-size: 48px;
  color: var(--text-muted);
}

.stream-diagnostics {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 18px 24px;
  border-radius: var(--radius-md);
}

.stream-diagnostics h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.diag-item {
  font-size: 0.85rem;
}

.diag-key {
  color: var(--text-muted);
}

.diag-val {
  font-weight: 700;
  color: var(--text-primary);
  margin-left: 6px;
}

/* CATEGORIES TAB */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.category-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.category-card:hover {
  border-color: var(--accent-primary);
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-surface);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  margin-top: 20px;
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  font-size: 54px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease-out;
}

.toast.success { border-color: rgba(16, 185, 129, 0.5); }
.toast.success i { color: var(--accent-success); }
.toast.error { border-color: rgba(239, 68, 68, 0.5); }
.toast.error i { color: var(--accent-danger); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
