/* CMS Audio Web Admin Panel Styles */
:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-sidebar: #0b0f19;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Timeline Zooming Variable */
  --timeline-zoom: 1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

/* Hidden Utility */
.hidden {
  display: none !important;
}

/* Login Container */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1e1b4b 0%, #0f172a 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.login-card .logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.login-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: #475569;
}

.btn-success {
  background: var(--accent-success);
  color: white;
}

.btn-danger {
  background: var(--accent-danger);
  color: white;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
}

/* App Layout */
#app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
aside.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-title span {
  font-size: 0.7rem;
  color: var(--accent-secondary);
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-main);
  background: rgba(99, 102, 241, 0.12);
}

.nav-item.active {
  color: #818cf8;
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #312e81;
  color: #c7d2fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.user-details h4 {
  font-size: 0.8rem;
  font-weight: 600;
}

.user-details p {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Main Content Area */
main.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0b0f19;
}

.top-bar {
  height: 64px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.top-bar-title h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.domain-badge {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(6, 182, 212, 0.3);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-family: monospace;
}

.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Dashboard Cards Grid */
.grid-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.player-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
}

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

.player-card.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

.player-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.player-name {
  font-weight: 600;
  font-size: 1rem;
}

.player-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-weight: 600;
}

.status-registered, .status-online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
}

.status-unpaired, .status-offline {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.player-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.5);
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

.metric-item span {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.stream-url-tag {
  background: rgba(15, 23, 42, 0.8);
  border: 1px dashed var(--border-color);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--accent-secondary);
  word-break: break-all;
  font-family: monospace;
}

/* 24-HOUR TIMELINE SCHEDULER & ZOOMING */
.timeline-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.timeline-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.timeline-scroll-wrapper {
  overflow-x: auto;
  padding-bottom: 1rem;
}

.timeline-grid {
  /* Dynamic width driven by CSS variable */
  min-width: calc(1000px * var(--timeline-zoom));
  position: relative;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 0;
  user-select: none;
  transition: min-width 0.2s ease-out;
}

/* Time Ruler (00:00 - 23:00) */
.timeline-ruler {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  position: relative;
}

.ruler-hour {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  font-family: monospace;
  position: relative;
}

.ruler-hour::after {
  content: '';
  position: absolute;
  bottom: -0.75rem;
  left: 50%;
  width: 1px;
  height: 6px;
  background: var(--border-color);
}

/* Current Time Red Line Marker */
.current-time-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-danger);
  z-index: 10;
  pointer-events: none;
}

.current-time-marker::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: var(--accent-danger);
  border-radius: 50%;
}

/* Dual Channels Styling */
.channel-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.channel-label-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.25rem;
}

.channel-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.03em;
}

.badge-stream {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-announcements {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.track-stream {
  min-height: 52px !important;
  background: rgba(6, 182, 212, 0.05) !important;
  border: 1px dashed rgba(6, 182, 212, 0.25) !important;
}

.track-announcements {
  min-height: 100px !important;
}

.channel-row-stacked {
  position: relative;
  min-height: 100px;
  background: rgba(30, 41, 59, 0.4);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  padding: 8px 0;
}

.schedule-block {
  position: absolute;
  height: 38px;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 28px;
}

.schedule-block:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.2);
  z-index: 25 !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
  overflow: visible !important;
}

.schedule-block.is-selected {
  outline: 2px solid #ef4444 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.9), 0 4px 12px rgba(0, 0, 0, 0.7) !important;
  z-index: 30 !important;
}

.schedule-block.is-dragging {
  opacity: 0.85;
  cursor: grabbing !important;
  z-index: 50 !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8), 0 0 12px var(--accent-primary);
  transform: scale(1.04);
}

.block-rule {
  background: #3b82f6;
  border: 1px solid #60a5fa;
}

.block-event {
  background: #8b5cf6;
  border: 1px solid #a78bfa;
}

.block-title {
  font-weight: 600;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 0.5rem;
}

.block-actions {
  display: flex;
  gap: 0.3rem;
}

.block-btn {
  background: rgba(0, 0, 0, 0.3);
  border: none;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.block-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.block-btn-delete {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
}

.block-btn-delete:hover {
  background: rgba(239, 68, 68, 0.85) !important;
  color: white !important;
}

/* Assets Table */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

table.data-table th {
  background: rgba(15, 23, 42, 0.6);
  padding: 0.85rem 1.25rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

table.data-table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

table.data-table tr:hover {
  background: rgba(51, 65, 85, 0.3);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

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

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

/* Version Badge & Save Button */
.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #a5b4fc;
}

.unsaved-tag {
  color: #f59e0b;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 0.25rem;
  animation: pulse-unsaved 1.5s infinite;
}

@keyframes pulse-unsaved {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.btn-save-schedule {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: white !important;
  border: none !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.btn-save-schedule:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Real-time Play Button Active Glow */
.realtime-playing {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: white !important;
  border-color: #f87171 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5) !important;
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Interactive Floating Tooltip (Chmurka Informacyjna) */
.timeline-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--accent-primary);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 18px rgba(99, 102, 241, 0.25);
  pointer-events: none;
  font-size: 0.8rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 240px;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.timeline-tooltip .tt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 0.35rem;
  margin-bottom: 0.1rem;
}

.timeline-tooltip .tt-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: #38bdf8;
  word-break: break-word;
}

.timeline-tooltip .tt-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.timeline-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.timeline-tooltip .tt-label {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.timeline-tooltip .tt-value {
  font-weight: 600;
  color: #ffffff;
  font-family: monospace;
}
