:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #d4af37;
  --accent-gold-hover: #b89628;
  --accent-blue: #38bdf8;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-main: 0 4px 20px rgba(0, 0, 0, 0.25);
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

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

.admin-wrapper {
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px 20px 100px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-symbol {
  font-size: 2.2rem;
  background: rgba(212, 175, 55, 0.15);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mqtt-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 500;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.connected {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.status-dot.disconnected {
  background: var(--accent-red);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gold);
  color: #0f172a;
}
.btn-primary:hover {
  background: var(--accent-gold-hover);
  transform: translateY(-1px);
}

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

.btn-accent {
  background: #2563eb;
  color: #fff;
}
.btn-accent:hover {
  background: #1d4ed8;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  font-size: 1rem;
}

/* ==========================================================================
   METRICS GRID
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.05);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   TABS
   ========================================================================== */
.admin-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 20px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

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

.tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

.tab-badge {
  background: #334155;
  color: #cbd5e1;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 12px;
  font-weight: 600;
}

.tab-btn.active .tab-badge {
  background: rgba(212, 175, 55, 0.2);
  color: var(--accent-gold);
}

.tab-content {
  display: none;
}

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

.tab-intro {
  margin-bottom: 20px;
}
.tab-intro h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.tab-intro p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ==========================================================================
   TOOLBAR
   ========================================================================== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar-search {
  position: relative;
  flex: 1;
  max-width: 450px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.toolbar-search input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 14px 10px 38px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.toolbar-search input:focus {
  border-color: var(--accent-gold);
}

/* ==========================================================================
   STATIONS TABLE
   ========================================================================== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-main);
}

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

.stations-table th {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
  font-weight: 600;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.stations-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.stations-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.station-cell-title {
  display: flex;
  flex-direction: column;
}

.station-title-text {
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
}

.station-saint-text {
  font-size: 0.78rem;
  color: var(--accent-gold);
}

.codec-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.codec-aac {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.codec-mp3 {
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.stream-url-preview {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
}

.status-badge.online {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
}

.status-badge.offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.table-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  white-space: nowrap;
}

.btn-action {
  background: #334155;
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.btn-action.btn-play-action {
  background: rgba(212, 175, 55, 0.2);
  color: var(--accent-gold);
}
.btn-action.btn-play-action:hover {
  background: var(--accent-gold);
  color: #000;
}

.btn-action.btn-delete-action:hover {
  background: var(--accent-red);
}

/* ==========================================================================
   CARDS GRID (SUGESTÕES E ENCOMENDAS)
   ========================================================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-main);
}

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

.info-card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.info-card-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
  background: #334155;
  color: #cbd5e1;
}

.info-card-badge.gold {
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent-gold);
}

.info-card-body {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-card-body strong {
  color: #e2e8f0;
}

.info-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   FLOATING AUDIO PLAYER
   ========================================================================== */
.floating-player {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  width: 90%;
  max-width: 650px;
  transition: all 0.3s ease;
}

.floating-player.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(30px);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.playing-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.playing-equalizer span {
  width: 4px;
  background: var(--accent-gold);
  border-radius: 2px;
  animation: equalize 0.8s infinite ease-in-out alternate;
}
.playing-equalizer span:nth-child(2) { animation-delay: 0.2s; height: 16px; }
.playing-equalizer span:nth-child(3) { animation-delay: 0.4s; height: 10px; }

@keyframes equalize {
  from { height: 4px; }
  to { height: 20px; }
}

.player-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.player-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-url {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-player {
  background: var(--accent-gold);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #000;
  transition: transform 0.2s;
}
.btn-player:hover { transform: scale(1.05); }

.volume-slider-box {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.volume-slider-box input[type="range"] {
  width: 80px;
  accent-color: var(--accent-gold);
}

.btn-close-player {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}
.btn-close-player:hover { color: #fff; }

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  transition: opacity 0.2s;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}
.modal-close:hover { color: #fff; }

#stationForm {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #cbd5e1;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-gold);
}

.input-with-button {
  display: flex;
  gap: 8px;
}
.input-with-button input {
  flex: 1;
}

.stream-test-feedback {
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 4px;
  margin-top: 4px;
}
.stream-test-feedback.online {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.stream-test-feedback.offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-gold);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

.toast.success { border-left-color: var(--accent-green); }
.toast.error { border-left-color: var(--accent-red); }

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

@media (max-width: 768px) {
  .admin-header { flex-direction: column; align-items: flex-start; }
  .form-row { flex-direction: column; }
  .floating-player { flex-direction: column; gap: 12px; }
  .player-controls { width: 100%; justify-content: space-between; }
}
