/* ============================================
   StreamHub - Modern Glassmorphism Styling
   ============================================ */

:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(22, 30, 49, 0.7);
  --bg-card-hover: rgba(30, 41, 67, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.75);

  --accent-orange: #f97316;
  --accent-amber: #f59e0b;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;

  --gradient-primary: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
  --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);

  --text-main: #f8fafc;
  --text-sub: #94a3b8;
  --text-muted: #64748b;

  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(249, 115, 22, 0.5);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
  --font-main: "Outfit", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ---------- Ambient Background ---------- */
.glow-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-orange), transparent 70%);
  top: -10%;
  right: -10%;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-blue), transparent 70%);
  bottom: -10%;
  left: -5%;
}

/* ---------- App Layout ---------- */
.app-layout {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

/* ---------- Navbar ---------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #000;
  box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

.version-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-orange);
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  margin-left: 0.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 12px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.25s ease;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #000;
  box-shadow: 0 4px 15px rgba(249, 115, 22, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(249, 115, 22, 0.5);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-glow {
  background: var(--gradient-blue);
  color: #fff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

/* ---------- Player Card ---------- */
.player-container-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--border-glass);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.current-channel-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.live-dot {
  width: 9px;
  height: 9px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.current-channel-info h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(249, 115, 22, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.player-controls-right {
  display: flex;
  gap: 0.5rem;
}

.screen-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.player-mount {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.placeholder-state i {
  font-size: 3.5rem;
  color: rgba(255, 255, 255, 0.15);
  margin-bottom: 1rem;
}

.placeholder-state p {
  font-size: 0.95rem;
  max-width: 380px;
}

/* ---------- Dashboard Section ---------- */
.section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.section-title-bar h3 {
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.channel-counter {
  font-size: 0.8rem;
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border-glass);
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.channel-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(249, 115, 22, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.channel-card.active-card {
  border-color: var(--accent-orange);
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.25);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-title-wrap h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.card-category {
  font-size: 0.72rem;
  color: var(--text-sub);
}

.type-pill {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.type-pill.hls { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.type-pill.dash { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.type-pill.iframe { background: rgba(249, 115, 22, 0.2); color: #fb923c; }

.card-url-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-left-btns {
  display: flex;
  gap: 0.4rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

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

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.25s ease;
}

.modal-overlay.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 1.2rem;
  cursor: pointer;
}

.btn-close:hover { color: #fff; }

.modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="url"],
select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.25);
}

.drm-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 0.5rem;
  margin-bottom: 1.2rem;
}

.drm-box h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-amber);
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.drm-box.hidden { display: none; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  background: var(--gradient-primary);
  color: #000;
  padding: 0.8rem 1.4rem;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.4);
  animation: toastIn 0.3s ease;
}

.toast.hidden { display: none; }

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

/* Responsive */
@media (max-width: 768px) {
  .app-layout { padding: 0.75rem 0.75rem 2rem; }
  .navbar { flex-direction: column; gap: 0.75rem; align-items: flex-start; padding: 1rem; }
  .nav-actions { width: 100%; }
  .nav-actions .btn { width: 100%; justify-content: center; }
  .player-header { flex-direction: column; align-items: flex-start; }
  .player-controls-right { width: 100%; justify-content: space-between; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
}
