:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --muted: #6b7280;
  --accent: #374151;
  --accent-2: #4b5563;
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --border: #e5e7eb;
  --shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding: 1.5rem;
  color: #0f172a;
  background: var(--bg);
}

main {
  max-width: 900px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.coffee-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #ead8c3;
  background: #fdf8f2;
  color: #854d0e;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.coffee-link svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #b45309;
  opacity: 0.9;
}

.coffee-link:hover {
  color: #713f12;
  border-color: #dec09a;
  background: #fbf0df;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.08);
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(55, 65, 81, 0.2);
}

h1 {
  font-size: 1.6rem;
  margin: 0;
  color: var(--accent);
}

p.lead {
  margin: 0.2rem 0 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Barra de navegación de pestañas (Cantos / Esquemas) */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  background: #e5e7eb;
  padding: 0.35rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
}

.tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn svg {
  width: 18px;
  height: 18px;
}

.tab-btn.active {
  background: var(--card);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-btn:hover:not(.active) {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.5);
}

/* Contenedor de controles */
.controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.controls input.search-input {
  flex: 2;
  min-width: 180px;
  font-size: 0.95rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.controls input.search-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.15);
}

.controls select.group-select {
  flex: 1;
  min-width: 160px;
  font-size: 0.95rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--card);
  color: #374151;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.btn-icon {
  padding: 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: #f3f4f6;
  color: #111827;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* Lista de cantos */
ul.cantos {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.625rem;
}

li.canto-item {
  display: flex;
  flex-direction: column;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(13, 42, 148, 0.02), rgba(13, 42, 148, 0.01));
  border: 1px solid rgba(229, 231, 235, 0.5);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

li.canto-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(13, 42, 148, 0.06);
  border-color: rgba(209, 213, 219, 0.8);
}

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

.canto-title {
  font-weight: 700;
  color: #07103a;
  flex: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: #e5e7eb;
  color: #374151;
  white-space: nowrap;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.chev {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--accent);
  transition: transform 0.18s ease, background 0.18s ease;
}

.expanded > .row .chev,
.expanded > .esquema-header .chev {
  transform: rotate(90deg);
  background: rgba(107, 114, 128, 0.12);
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.6rem;
  display: none;
  white-space: pre-wrap;
  line-height: 1.5;
  border-top: 1px solid #f3f4f6;
  padding-top: 0.75rem;
}

.meta .chord {
  color: #0ea5a4;
  font-weight: 700;
  padding: 0 0.25rem;
  border-radius: 4px;
  background: rgba(14, 165, 164, 0.08);
  margin-right: 0.25rem;
  font-family: monospace;
}

li.canto-item.expanded .meta {
  display: block;
}

/* Apartado de Esquemas */
.esquemas-list {
  display: grid;
  gap: 1rem;
}

.esquema-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.esquema-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.esquema-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  cursor: pointer;
  background: #fafafa;
  user-select: none;
}

.esquema-header-main {
  flex: 1;
  min-width: 0;
}

.esquema-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.esquema-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.esquema-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.esquema-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.esquema-body {
  display: none;
  padding: 0.75rem 1.15rem 1.15rem 1.15rem;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.esquema-card.expanded .esquema-body {
  display: block;
}

.esquema-cantos-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.esquema-canto-item {
  border-radius: 8px;
  border: 1px solid #f1f5f9;
  background: #f8fafc;
  overflow: hidden;
}

.esquema-canto-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.esquema-canto-header:hover {
  background: #f1f5f9;
}

.esquema-canto-index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.esquema-canto-name {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
}

.esquema-canto-details {
  display: none;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  font-size: 0.92rem;
  white-space: pre-wrap;
  line-height: 1.5;
  color: #334155;
}

.esquema-canto-details .chord {
  color: #0ea5a4;
  font-weight: 700;
  padding: 0 0.25rem;
  border-radius: 4px;
  background: rgba(14, 165, 164, 0.08);
  margin-right: 0.25rem;
  font-family: monospace;
}

.esquema-canto-item.expanded .esquema-canto-details {
  display: block;
}

.esquema-canto-item.expanded .chev {
  transform: rotate(90deg);
  background: rgba(107, 114, 128, 0.12);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1e293b;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2000;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

#status, #status-esquemas {
  color: var(--muted);
  padding: 1.5rem;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  color: #9ca3af;
}

.empty-state h3 {
  margin: 0 0 0.25rem 0;
  color: var(--accent);
}

.empty-state p {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  body {
    padding: 1rem;
  }

  h1 {
    font-size: 1.35rem;
  }

  .controls {
    flex-direction: column;
  }

  .controls input.search-input,
  .controls select.group-select {
    width: 100%;
  }
}

