/* Classic Executive Light Theme System - Mini Radio Station */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-dark: #f4f6f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-color: #e2e8f0;
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.12);
  --accent-success: #059669;
  --accent-warning: #d97706;
  --accent-danger: #dc2626;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-code: 'JetBrains Mono', monospace;
  --shadow-glow: 0 4px 20px rgba(37, 99, 235, 0.12);
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(5, 150, 105, 0.04) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Glassmorphism & Panel Containers (Classic Light Executive) */
.glass-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.glass-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.5rem;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.03);
}

/* App Header & Navbar */
.nav-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
}

.brand-logo i {
  color: var(--accent-primary);
  font-size: 1.6rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.online {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-badge.stopped {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.status-badge.paused {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.6); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

/* Layout Grid */
.main-wrapper {
  max-width: 1300px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  min-width: 0;
  box-sizing: border-box;
}

/* Custom Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  text-decoration: none;
  box-sizing: border-box;
  max-width: 100%;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-danger:hover {
  background: #fee2e2;
  color: #991b1b;
}

.btn-icon {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  flex: 0 0 38px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Visualizer Wave Animation */
.visualizer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 32px;
  padding: 4px;
}

.visualizer-bar {
  width: 4px;
  background: var(--accent-primary);
  border-radius: 2px;
  height: 20%;
}

.visualizer.active .visualizer-bar {
  animation: soundWave 1.2s ease-in-out infinite alternate;
}

.visualizer.active .visualizer-bar:nth-child(1) { animation-delay: 0.1s; }
.visualizer.active .visualizer-bar:nth-child(2) { animation-delay: 0.3s; }
.visualizer.active .visualizer-bar:nth-child(3) { animation-delay: 0.2s; }
.visualizer.active .visualizer-bar:nth-child(4) { animation-delay: 0.4s; }
.visualizer.active .visualizer-bar:nth-child(5) { animation-delay: 0.25s; }

@keyframes soundWave {
  0% { height: 15%; }
  100% { height: 100%; }
}

/* Navigation Tabs */
.tabs-header {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #64748b;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--accent-primary);
}

.tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background: rgba(37, 99, 235, 0.04);
  border-radius: 6px 6px 0 0;
}

/* Tab Content Areas */
.tab-pane {
  display: none;
  min-width: 0;
  box-sizing: border-box;
}

.tab-pane.active {
  display: block;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}

.form-control, .form-select, input[type="range"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  color: #0f172a;
  font-family: inherit;
  font-size: 0.92rem;
  transition: var(--transition-fast);
}

.card-action-group, .playlist-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.form-control:focus, .form-select:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Dropzone Upload Area */
.upload-dropzone {
  border: 2px dashed #93c5fd;
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  background: #eff6ff;
  cursor: pointer;
  transition: var(--transition-fast);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-primary);
  background: #dbeafe;
}

/* Data Tables */
.table-container, .table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  display: block;
  box-sizing: border-box;
}

/* Tab content areas with internal scroll */
#tab-audios .table-container,
#tab-editor .table-container {
  max-height: 480px;
  overflow-y: auto;
}

#tab-schedule .table-container {
  max-height: 400px;
  overflow-y: auto;
}

/* Editor two-column responsive: stack on smaller screens */
@media (max-width: 1200px) {
  #editor-two-columns {
    grid-template-columns: 1fr !important;
  }
}

.data-table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
}

.data-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  font-weight: 700;
  background: #f8fafc;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-song {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-commercial {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Empty & Loading States */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text-dim);
  display: block;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Login Page Styles */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 0.75rem;
  color: var(--text-main);
}

/* Drag & Drop Playlist Item Styles */
.drag-handle {
  cursor: grab;
  color: var(--text-dim);
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.drag-handle:hover {
  color: var(--accent-primary);
  background: #eff6ff;
}

.drag-handle:active {
  cursor: grabbing;
}

tr.draggable-row {
  transition: transform 0.15s ease, background-color 0.15s ease;
}

tr.draggable-row.dragging {
  opacity: 0.4;
  background: #eff6ff !important;
  border: 1px dashed var(--accent-primary) !important;
}

tr.draggable-row.drag-over-top {
  border-top: 2px solid var(--accent-primary) !important;
}

tr.draggable-row.drag-over-bottom {
  border-bottom: 2px solid var(--accent-primary) !important;
}

/* Inline Audio Preview Button */
.btn-preview-audio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 20px;
  background: #eff6ff;
  color: var(--accent-primary);
  border: 1px solid #bfdbfe;
  cursor: pointer;
  transition: var(--transition-fast);
  min-width: 88px;
  box-sizing: border-box;
}

.btn-preview-audio:hover {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-preview-audio.playing {
  background: var(--accent-success);
  color: #ffffff;
  border-color: var(--accent-success);
}

/* Custom Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  border: 1px solid #94a3b8;
  transition: .2s;
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #059669;
  border-color: #047857;
}

input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

/* Classic Light Modal System */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s cubic-bezier(0, 0, 0.2, 1);
}

.modal-content {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  width: 95%;
  max-width: 950px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.25s cubic-bezier(0, 0, 0.2, 1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--accent-danger);
  background: #fef2f2;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
}

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

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Floating Audio Preview Bar for Admin */
#admin-preview-bar {
  background: #ffffff !important;
  border: 1px solid var(--accent-primary) !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12) !important;
  color: var(--text-main) !important;
}

/* ==========================================================================
   Responsive Layout Adaptations (Mobile & Tablet)
   ========================================================================== */

@media (max-width: 992px) {
  .hero-split-grid, .tab-grid {
    grid-template-columns: 1fr !important;
  }

  .main-wrapper {
    padding: 1rem;
    margin: 1rem auto;
    width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 768px) {
  .glass-nav {
    padding: 0.75rem 1rem;
  }

  .nav-container {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .header-actions {
    justify-content: center;
    width: 100%;
    gap: 0.5rem;
  }

  .brand-logo {
    justify-content: center;
    font-size: 1.2rem;
  }

  .tabs-header {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    border-bottom: 2px solid #e2e8f0;
    width: 100%;
    max-width: 100%;
  }

  .tab-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .glass-panel {
    padding: 1rem !important;
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
  }

  .playlist-card-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 6px;
    margin-top: 8px;
  }

  .playlist-card-actions .btn:not(.btn-icon) {
    width: 100% !important;
    flex: 1 1 auto !important;
    padding: 8px 12px;
    font-size: 0.85rem;
    box-sizing: border-box;
  }

  .playlist-card-actions .btn-icon {
    align-self: flex-end;
    margin-top: 2px;
  }

  .card-action-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  .card-action-group .btn {
    flex: 1 1 calc(33.33% - 6px);
    min-width: 0;
    padding: 7px 6px;
    font-size: 0.8rem;
    box-sizing: border-box;
  }

  .modal-content {
    width: 96%;
    max-width: 100%;
    margin: 8px auto;
    max-height: 94vh;
  }

  .modal-header, .modal-body, .modal-footer {
    padding: 1rem;
  }

  .data-table th, .data-table td {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .pos-badge {
    font-size: 0.78rem;
  }

  .form-control, .form-select, input[type="range"] {
    font-size: 0.9rem;
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions > * {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  #admin-preview-bar {
    position: fixed;
    bottom: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
  }

  #admin-preview-bar > div {
    justify-content: space-between;
    width: 100%;
  }

  .track-icon-art {
    width: 40px;
    height: 40px;
  }

  .track-details h2 {
    font-size: 0.95rem;
  }

  .current-track-info {
    gap: 10px;
  }
}

/* Playlist Card Subtle Expand Indicator */
.playlist-card-item .playlist-expand-chevron {
  font-size: 1.15rem;
  color: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.playlist-card-item:hover .playlist-expand-chevron {
  color: var(--accent-primary);
}

.playlist-card-item.is-open .playlist-expand-chevron {
  transform: rotate(180deg);
  color: var(--accent-primary);
}

.playlist-expand-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: var(--transition-fast);
}

.playlist-card-item:hover .playlist-expand-badge {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent-primary);
}

.schedule-slot-row {
  transition: var(--transition-fast);
}
.schedule-slot-row:hover {
  background: #f8fafc;
}
.schedule-day-btn.active {
  background: var(--accent-primary) !important;
  color: #fff !important;
  border-color: var(--accent-primary) !important;
}
#editor-library-body tr.dimmed {
  opacity: 0.5;
  pointer-events: none;
}
#editor-library-body tr {
  transition: background 0.2s ease;
}
#editor-library-body tr:not(.dimmed):hover {
  background: #eff6ff;
}
#editor-two-columns {
  display: none;
}
#editor-progress-bar {
  transition: width 0.4s ease, background 0.3s ease;
}

