/* ============================================
   UTTARAKHAND TV - Live TV Platform Styles
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #e63946;
  --primary-dark: #c1121f;
  --accent: #f4a261;
  --bg-dark: #0a0a0f;
  --bg-card: #14141f;
  --bg-overlay: rgba(10, 10, 15, 0.85);
  --text: #f1faee;
  --text-muted: #8d99ae;
  --border: #2a2a3a;
  --success: #2ec4b6;
  --gradient-brand: linear-gradient(135deg, #e63946 0%, #f4a261 100%);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Header / Top Bar ---- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(10,10,15,0.95) 0%, rgba(10,10,15,0.7) 100%);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-brand);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text span {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ---- LIVE Badge ---- */
.live-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  animation: pulse-glow 2s ease-in-out infinite;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: blink 1.5s ease-in-out infinite;
}

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

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(230, 57, 70, 0.4); }
  50% { box-shadow: 0 0 20px rgba(230, 57, 70, 0.7); }
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.viewer-count {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.viewer-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}

/* ---- Main Player Area ---- */
.player-container {
  margin-top: 64px;
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 16px;
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.video-wrapper iframe,
.video-wrapper #player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  padding: 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-radius: 12px 12px 0 0;
}

.channel-watermark {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  letter-spacing: 1px;
}

/* ---- Now Playing Bar ---- */
.now-playing {
  max-width: 1200px;
  margin: 16px auto;
  padding: 16px 24px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.now-playing-label {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.now-playing-title {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-category {
  background: rgba(244, 162, 97, 0.15);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.now-playing-time {
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Program Guide / Up Next ---- */
.section-title {
  max-width: 1200px;
  margin: 32px auto 16px;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.program-guide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: all 0.2s ease;
  cursor: default;
}

.guide-card:hover {
  border-color: var(--primary);
  background: rgba(230, 57, 70, 0.05);
}

.guide-card.active {
  border-color: var(--primary);
  background: rgba(230, 57, 70, 0.1);
}

.guide-thumb {
  width: 80px;
  height: 45px;
  border-radius: 6px;
  background: #1a1a2e;
  overflow: hidden;
  flex-shrink: 0;
}

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

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

.guide-time {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 2px;
}

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

.guide-category {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Footer ---- */
.footer {
  max-width: 1200px;
  margin: 48px auto 24px;
  padding: 24px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ---- Loading State ---- */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  width: 80px;
  height: 80px;
  background: var(--gradient-brand);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: white;
  margin-bottom: 24px;
  animation: float 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.loading-text {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.loading-bar {
  width: 200px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden;
}

.loading-bar-fill {
  width: 40%;
  height: 100%;
  background: var(--gradient-brand);
  border-radius: 2px;
  animation: loading-slide 1.2s ease-in-out infinite;
}

@keyframes loading-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ---- Error State ---- */
.error-state {
  display: none;
  position: absolute;
  inset: 0;
  background: var(--bg-dark);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  border-radius: 12px;
  z-index: 5;
}

.error-state.visible {
  display: flex;
}

.error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.error-message {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.btn {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--gradient-brand);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

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

.btn-secondary:hover {
  border-color: var(--text-muted);
}

/* ============================================
   ADMIN PAGE STYLES
   ============================================ */

.admin-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

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

.admin-header h1 {
  font-size: 24px;
  font-weight: 700;
}

.admin-header a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

/* Add Video Form */
.add-video-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.add-video-form h2 {
  font-size: 16px;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row input,
.form-row select {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-row input:focus,
.form-row select:focus {
  border-color: var(--primary);
}

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

.form-row select option {
  background: var(--bg-dark);
}

/* Video List */
.video-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.video-list-header h2 {
  font-size: 16px;
}

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

.video-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s;
}

.video-item:hover {
  border-color: var(--text-muted);
}

.video-item-thumb {
  width: 96px;
  height: 54px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: #1a1a2e;
}

.video-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-item-info {
  flex: 1;
  min-width: 0;
}

.video-item-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.video-item-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-icon.danger:hover {
  border-color: #e63946;
  color: #e63946;
  background: rgba(230, 57, 70, 0.1);
}

/* Import/Export */
.admin-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.admin-actions .btn {
  font-size: 13px;
  padding: 8px 16px;
}

/* Instructions Box */
.instructions {
  background: rgba(46, 196, 178, 0.08);
  border: 1px solid rgba(46, 196, 178, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.instructions h3 {
  color: var(--success);
  font-size: 14px;
  margin-bottom: 8px;
}

.instructions ol {
  padding-left: 20px;
}

.instructions code {
  background: var(--bg-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .top-bar {
    padding: 10px 16px;
  }

  .logo-text {
    font-size: 16px;
  }

  .logo-subtitle {
    display: none;
  }

  .viewer-count {
    display: none;
  }

  .player-container {
    padding: 0;
    margin-top: 56px;
  }

  .video-wrapper {
    border-radius: 0;
  }

  .now-playing {
    margin: 8px 16px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .now-playing-category {
    order: 3;
  }

  .program-guide {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }

  .section-title {
    margin-top: 20px;
  }

  .form-row {
    flex-direction: column;
  }

  .admin-actions {
    flex-direction: column;
  }

  .video-item {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .live-badge {
    padding: 4px 10px;
    font-size: 11px;
  }

  .now-playing-time {
    display: none;
  }

  .guide-thumb {
    width: 60px;
    height: 34px;
  }
}
