/* Reset-ish */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  /* no overflow here */
}


body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #151b3b 0, #050712 45%, #02030a 100%);
  color: #f5f5f5;
}

/* App Shell */

.app-shell {
  min-height: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;       
}



.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(5, 7, 18, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 18px;
  margin: 0;
}

.brand-text p {
  margin: 0;
  font-size: 12px;
  color: #9ba4d7;
}

/* Layout: only guide scrolls */

.app-main {
  flex: 1;
  padding: 12px 16px 8px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;   /* 👈 prevent main from scrolling; guide will scroll inside */
}

.player-section {
  flex: 0 0 auto;     /* fixed height block */
}

.guide-section {
  flex: 1 1 auto;     /* takes remaining space */
  min-height: 0;      /* 👈 important for flex scroll containers */
  display: flex;
  flex-direction: column;
}


.app-footer {
  padding: 8px 16px 16px;
  text-align: center;
}

/* Player Section */

.player-section {
  background: rgba(8, 12, 30, 0.95);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.player-wrapper {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

#tvPlayer {
  width: 100%;
  max-height: 60vh;
  display: block;
  background: #000;
}

/* Overlay controls inside the video */

.player-overlay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.1));
  color: #f5a623;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.player-overlay-btn:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9);
}

.player-overlay-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.player-overlay-fullscreen {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
}

/* Now playing bar */

.now-playing-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.now-playing-bar h2 {
  margin: 0 0 2px;
  font-size: 16px;
}

.now-playing-bar p {
  margin: 0;
}

.tiny-text {
  font-size: 10px;
}

.viewer-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #cfd3ff;
}

.viewer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.9);
}

/* Buttons & Chips */

.btn {
  border-radius: 999px;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, #2a7cf7, #4bc3ff);
  color: #fff;
  box-shadow: 0 8px 20px rgba(42, 124, 247, 0.45);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: #c5cae9;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Program Guide */

.guide-section {
  background: rgba(8, 12, 30, 0.9);
  border-radius: 18px;
  padding: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.guide-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.guide-header h3 {
  margin: 0;
  font-size: 16px;
}

.guide-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  overflow-x: auto;
}

.chip {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px 12px;
  font-size: 12px;
  background: transparent;
  color: #e0e3ff;
  cursor: pointer;
  white-space: nowrap;
}

.chip-active {
  background: rgba(60, 90, 240, 0.7);
  border-color: rgba(99, 133, 255, 0.9);
}

/* Scrollable guide list only */

.guide-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
}

.guide-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: radial-gradient(circle at left, rgba(42, 124, 247, 0.15), transparent 55%),
              rgba(9, 13, 33, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.guide-time {
  font-size: 12px;
  color: #b0b7ff;
  min-width: 80px;
}

.guide-title {
  font-size: 14px;
  margin-bottom: 2px;
}

.guide-meta {
  font-size: 11px;
  color: #9ea6dd;
}

/* Utilities */

.muted {
  color: #9ba4d7;
}

.small-text {
  font-size: 11px;
}

/* Responsive tweaks */

@media (max-width: 600px) {
  .app-main {
    padding: 10px;
  }

  .player-section,
  .guide-section {
    border-radius: 16px;
  }

  #tvPlayer {
    max-height: 45vh;
  }
}


/* ---------- TABLET (approx iPad, landscape phones) ---------- */
@media (min-width: 768px) and (max-width: 1199px) {
  .app-main {
    max-width: 1100px;
    padding: 16px 24px 12px;
  }

  .brand-logo {
    width: 48px;
    height: 48px;
  }

  .brand-text h1 {
    font-size: 20px;
  }

  #tvPlayer {
    max-height: 55vh;
  }

  .now-playing-bar h2 {
    font-size: 18px;
  }

  .guide-header h3 {
    font-size: 18px;
  }

  .btn,
  .chip {
    font-size: 13px;
  }
}



/* ---------- DESKTOP / LARGE LAPTOP ---------- */
@media (min-width: 1200px) {
  .app-main {
    flex-direction: row;         /* player + guide side by side */
    align-items: stretch;
    gap: 18px;
    max-width: 1400px;
    padding: 16px 32px 12px;
  }

  .player-section {
    flex: 0 0 60%;               /* ~60% width for video */
    display: flex;
    flex-direction: column;
  }

  .guide-section {
    flex: 1 1 40%;               /* remaining space for guide */
    min-width: 0;
  }

  /* Make video a bit taller on desktop, but still respect viewport */
  #tvPlayer {
    max-height: 65vh;
  }

  .now-playing-bar h2 {
    font-size: 19px;
  }

  .guide-header h3 {
    font-size: 18px;
  }

  .guide-list {
    /* Already flex + scroll; ensure it uses full height here */
    flex: 1 1 auto;
    max-height: none;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
  }

  .brand-text h1 {
    font-size: 22px;
  }

  .btn,
  .chip {
    font-size: 14px;
  }
}


/* ---------- TV / VERY LARGE DISPLAYS ---------- */
@media (min-width: 1600px) {
  .app-main {
    max-width: 1600px;
    padding: 24px 48px 16px;
  }

  .brand-logo {
    width: 64px;
    height: 64px;
  }

  .brand-text h1 {
    font-size: 26px;
  }

  .brand-text p {
    font-size: 14px;
  }

  .player-overlay-btn {
    width: 80px;
    height: 80px;
    font-size: 32px;
  }

  .now-playing-bar h2 {
    font-size: 22px;
  }

  .now-playing-bar p {
    font-size: 13px;
  }

  .guide-header h3 {
    font-size: 20px;
  }

  .guide-title {
    font-size: 15px;
  }

  .guide-time,
  .guide-meta {
    font-size: 13px;
  }

  .btn,
  .chip {
    font-size: 15px;
    padding: 9px 18px;
  }

  .small-text {
    font-size: 12px;
  }

  .tiny-text {
    font-size: 11px;
  }
}

/* ---------- Fullscreen video behaviour ---------- */

#playerWrapper:fullscreen,
#playerWrapper:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
}

#playerWrapper:fullscreen #tvPlayer,
#playerWrapper:-webkit-full-screen #tvPlayer {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain; /* change to 'cover' if you want it edge-to-edge with cropping */
}


/* ========== ADMIN LAYOUT & FORMS ========== */

.admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(5, 7, 18, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-brand-logo {
  width: 36px;
  height: 36px;
}

.admin-brand h1 {
  margin: 0;
  font-size: 18px;
}

.admin-tagline {
  margin: 0;
  font-size: 11px;
  color: #9ba4d7;
}

.admin-main {
  flex: 1;
  padding: 12px 16px 16px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-footer {
  padding: 8px 16px 16px;
  text-align: center;
}

/* Cards */

.admin-card {
  background: rgba(8, 12, 30, 0.95);
  border-radius: 16px;
  padding: 14px 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.admin-card-header h2 {
  margin: 0;
  font-size: 16px;
}

.admin-card-header .muted {
  font-size: 12px;
}

/* Forms */

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-field label {
  font-size: 13px;
  color: #e3e6ff;
}

.admin-field small {
  font-size: 11px;
  color: #9ba4d7;
}

.admin-input,
.admin-select,
.admin-textarea {
  background: rgba(4, 7, 20, 0.95);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f5f5f5;
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
}

.admin-input[type="datetime-local"],
.admin-input[type="date"],
.admin-input[type="time"] {
  padding-right: 32px;
}

.admin-textarea {
  min-height: 80px;
  resize: vertical;
}

.admin-input[type="file"] {
  padding: 6px 10px;
  background: rgba(4, 7, 20, 0.95);
}

/* Thumbnail preview */

.thumb-preview {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: radial-gradient(circle at top, #3c4b85, #050712);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #9ba4d7;
}

/* Program actions row */

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* Tables */

.admin-table-wrapper {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table thead {
  background: rgba(14, 19, 50, 0.95);
}

.admin-table th,
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: left;
}

.admin-table th {
  font-weight: 600;
  color: #cfd4ff;
}

.admin-table tbody tr:hover {
  background: rgba(19, 26, 72, 0.7);
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(42, 124, 247, 0.2);
  color: #cfd4ff;
}

/* Thumbnail in table */

.admin-thumb-small {
  width: 64px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
}

/* Advert timing tags */

.ad-slot-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ad-slot-row.single {
  grid-template-columns: 1fr;
}

/* Responsive for admin forms */

@media (min-width: 768px) {
  .admin-main {
    padding: 16px 20px 18px;
  }

  .admin-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-field.full-width {
    grid-column: 1 / -1;
  }

  .thumb-preview {
    max-width: 220px;
  }
}

@media (min-width: 1200px) {
  .admin-main {
    max-width: 1200px;
  }

  .admin-card-header h2 {
    font-size: 18px;
  }
}


