:root {
  --primary-blue: #0f2b48;
  --secondary-blue: #1a446c;
  --gold: #c59b27;
  --gold-hover: #b0881c;
  --gold-light: #fef9e7;
  --bg-page: #f8fafc;
  --card-bg: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --accent-check: #10b981;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-dark);
  padding: 12px;
  overflow-x: hidden;
}

.catalog-container {
  max-width: 1000px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(15, 43, 72, 0.08);
  border: 1px solid var(--border-color);
  padding: 20px;
  padding-bottom: 24px;
}

/* Header */
.catalog-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--gold-light);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand .cross {
  font-size: 24px;
  color: var(--gold);
  line-height: 1;
  flex-shrink: 0;
}

.brand h2 {
  font-family: 'Cinzel', serif;
  color: var(--primary-blue);
  font-size: 20px;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.brand p {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-counter {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-blue);
  background: var(--gold-light);
  border: 1px solid rgba(197, 155, 39, 0.3);
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-box {
  width: 100%;
}

#searchInput {
  width: 100%;
  padding: 9px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s;
  background: #f1f5f9;
}

#searchInput:focus {
  border-color: var(--gold);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.15);
}

/* Categorias */
.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-pills::-webkit-scrollbar {
  display: none;
}

.pill {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill:hover {
  background: #f8fafc;
  color: var(--primary-blue);
}

.pill.active {
  background: var(--primary-blue);
  color: #ffffff;
  border-color: var(--primary-blue);
}

/* Grid de Estações */
.stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.station-card {
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  background: #ffffff;
}

.station-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

/* Estado 1: Tocando Agora (NO AR) */
.station-card.is-playing {
  border: 2px solid #10b981;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.18);
  cursor: default;
}
.station-card.is-playing:hover {
  transform: none;
  border-color: #10b981;
}

/* Estado 2: Já Gravada no Aparelho */
.station-card.is-installed {
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  cursor: default;
  opacity: 0.92;
}
.station-card.is-installed:hover {
  transform: none;
  border-color: #94a3b8;
}

/* Estado 3: Disponível e Selecionada para Adicionar */
.station-card.selected {
  border-color: var(--gold);
  background: var(--gold-light);
  box-shadow: 0 4px 14px rgba(197, 155, 39, 0.2);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.saint-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 2px solid var(--gold);
}

.card-meta {
  min-width: 0;
  flex: 1;
}

.card-meta h3 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--primary-blue);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-saint {
  display: inline-block;
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 10px;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.05);
  gap: 8px;
}

.card-bottom-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.codec-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #475569;
  text-transform: uppercase;
}

.codec-tag.aac {
  background: #dbeafe;
  color: #1e40af;
}

/* Badges de Status do Aparelho */
.badge-status {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-status.playing {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
  animation: pulseBadge 2s infinite ease-in-out;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.88; transform: scale(1.02); }
}

.badge-status.saved {
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.custom-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: white;
  transition: all 0.2s;
  background: white;
  flex-shrink: 0;
}

.custom-checkbox.locked-playing {
  background: #10b981;
  border-color: #10b981;
  color: white;
  cursor: default;
}

.custom-checkbox.locked-saved {
  background: #94a3b8;
  border-color: #94a3b8;
  color: white;
  cursor: default;
}

.station-card.selected .custom-checkbox {
  background: var(--gold);
  border-color: var(--gold);
  color: white;
}

/* Rodapé Sticky */
.catalog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 -4px 16px rgba(15, 43, 72, 0.08);
  z-index: 20;
}

.footer-info {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-save {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--gold);
  color: #ffffff;
  border: none;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(197, 155, 39, 0.35);
  transition: all 0.2s;
}

.btn-save:hover:not(:disabled) {
  background: var(--gold-hover);
  transform: scale(1.02);
}

.btn-save:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-save:disabled {
  background: #94a3b8 !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

/* =========================================================
   Ajustes Mobile (< 640px)
   ========================================================= */
@media (max-width: 640px) {
  body {
    padding: 6px 4px;
  }

  .catalog-container {
    padding: 12px 10px 20px;
    border-radius: 12px;
  }

  .brand h2 {
    font-size: 17px;
  }

  .brand p {
    font-size: 11px;
  }

  .selection-counter {
    font-size: 11px;
    padding: 5px 10px;
  }

  #searchInput {
    padding: 8px 14px;
    font-size: 13px;
  }

  .category-pills {
    padding: 10px 0 12px;
    gap: 6px;
  }

  .pill {
    padding: 6px 12px;
    font-size: 12px;
  }

  .stations-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .station-card {
    padding: 12px 10px;
  }

  .saint-avatar {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .card-meta h3 {
    font-size: 13.5px;
  }

  .catalog-footer {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 10px 14px;
    gap: 8px;
    border-radius: 0 0 12px 12px;
  }

  .footer-info {
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
  }

  .btn-save {
    width: 100%;
    justify-content: center;
    padding: 11px 16px;
    font-size: 13.5px;
    border-radius: 12px;
  }
}
