/* public/assets/css/app.css */
/* ADRNL IPTV Player — production stylesheet
   - Dark theme base, glass panels, gradients
   - Video.js skin tweaks
   - EPG grid layout
   - Skeleton loaders
   - Subtle accessibility & motion preferences
*/

/* ---------- Root Theme ---------- */
:root {
  --bg: #0d1117;
  --panel: rgba(13, 17, 23, 0.5);
  --panel-fallback: rgba(13, 17, 23, 0.85);
  --panel-border: rgba(48, 54, 61, 0.5);
  --ink: #c9d1d9;
  --muted: #8b949e;
  --line: #30363d;
  --line-strong: #48515c;
  --brand-100: #e6fafd;
  --brand-400: #22d3ee;
  --brand-500: #06b6d4;
  --brand-600: #0891b2;
  --brand-700: #0e7490;
  --glow: rgba(34, 211, 238, 0.4);
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at top left, rgba(34, 211, 238, 0.1), transparent 30%),
    radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.1), transparent 40%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Slightly crisper text on WebKit dark backgrounds */
@supports (-webkit-touch-callout: none) {
  body { text-rendering: geometricPrecision; }
}

/* Focus styles for accessibility when not using Tailwind's focus rings */
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Scrollbar (WebKit) ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #30363D; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #48515c; }

/* ---------- Utility & Components ---------- */
.gradient-text {
  background: linear-gradient(90deg, var(--brand-400), #0ea5e9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.glass-panel {
  background: var(--panel);
  background-color: var(--panel-fallback); /* Fallback if backdrop-filter unsupported */
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
}

#sidebar { transition: transform .3s ease-in-out; }

/* ---------- Video.js Skin Tweaks ---------- */
.video-js { width: 100%; height: 100%; }

.vjs-big-play-button {
  background-color: rgba(34, 211, 238, 0.7) !important;
  border: 2px solid var(--glow) !important;
  border-radius: 50%;
  box-shadow: 0 0 20px var(--glow);
}

.vjs-control-bar {
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent) !important;
}

.vjs-play-progress,
.vjs-volume-level {
  background-color: var(--brand-400) !important;
}

/* Improve control hit targets on touch */
.video-js .vjs-control { touch-action: manipulation; }

/* ---------- EPG Grid ---------- */
.epg-grid-container {
  position: relative;
  overflow: auto;
  height: calc(100% - 60px); /* Adjust if header height changes */
}

.epg-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
}

.epg-channels { position: sticky; left: 0; z-index: 10; }

.epg-time-slot,
.epg-channel-cell,
.epg-program-cell {
  background-color: rgba(22, 27, 34, 0.5);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.epg-channel-cell { height: 60px; }

.epg-programs-container {
  position: relative;
  display: flex;
  height: 60px;
}

.epg-program-cell {
  position: absolute;
  height: 100%;
  padding: 4px;
  font-size: 12px;
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Accordion (Categories) ---------- */
.category-accordion[open] .accordion-icon { transform: rotate(90deg); }
.accordion-icon { transition: transform .2s ease-in-out; }

/* ---------- Skeleton Loader ---------- */
@keyframes pulse { 0%{opacity:1} 50%{opacity:.5} 100%{opacity:1} }
.skeleton {
  animation: pulse 2s cubic-bezier(.4,0,.6,1) infinite;
  background-color: #161B22;
  border-radius: .375rem;
}

/* ---------- Mini Player ---------- */
#mini-player {
  box-shadow: 0 20px 45px rgba(0,0,0,.45);
}

/* ---------- Images ---------- */
img {
  image-rendering: -webkit-optimize-contrast;
  max-width: 100%;
  height: auto;
}

/* ---------- Buttons (fallback if Tailwind not applied) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1rem;
  border-radius: .5rem;
  border: 1px solid transparent;
  background: var(--brand-600);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: transform .06s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn:hover { background: var(--brand-700); }
.btn:active { transform: translateY(1px); }
.btn--secondary { background: #374151; }
.btn--secondary:hover { background: #4b5563; }

/* ---------- Cards ---------- */
.card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: .75rem;
  padding: 1rem;
}

/* ---------- Tables (Dashboard) ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.table th,
.table td {
  padding: .75rem;
  border-bottom: 1px solid var(--line);
}
.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 9999px;
  font-size: .75rem;
  line-height: 1.2;
}
.badge--ok { background: rgba(16,185,129,.15); color: #34d399; }
.badge--warn { background: rgba(234,179,8,.15); color: #facc15; }
.badge--err { background: rgba(239,68,68,.15); color: #f87171; }

/* ---------- Links ---------- */
a { color: var(--brand-400); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Forms (fallback styles) ---------- */
.input {
  width: 100%;
  padding: .6rem .8rem;
  color: var(--ink);
  background: rgba(255,255,255,0.04);
  border: 1px solid #2a3138;
  border-radius: .5rem;
}
.input::placeholder { color: #6b7280; }
.input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(6,182,212,.25);
}

/* ---------- Helper classes ---------- */
.text-muted { color: var(--muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ensure sticky headers/columns appear above grid content */
.sticky { position: sticky; background: #111827; z-index: 20; }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 1024px) {
  .epg-grid { grid-template-columns: 120px 1fr; }
  .epg-channel-cell,
  .epg-programs-container { height: 56px; }
}

@media (max-width: 640px) {
  .epg-grid { grid-template-columns: 100px 1fr; }
  .vjs-big-play-button { transform: scale(.9); }
}