/* =========================================================
   Sistema de Disponibilidade — tema claro/escuro
   ========================================================= */
:root {
  --bg: #f5f6f8;
  --bg-panel: #ffffff;
  --bg-alt: #f0f1f4;
  --text: #1c1f26;
  --text-muted: #6b7280;
  --border: #e3e5ea;
  --primary: #3b6ef6;
  --primary-hover: #2f57c9;
  --accent: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(20, 20, 30, .06);
  --sidebar-bg: #14161c;
}

[data-theme="dark"] {
  --bg: #0f1115;
  --bg-panel: #171a21;
  --bg-alt: #1e222b;
  --text: #eef0f4;
  --text-muted: #9aa1ae;
  --border: #2a2f3a;
  --primary: #5b86ff;
  --primary-hover: #7a9dff;
  --shadow: 0 2px 14px rgba(0, 0, 0, .45);
  --sidebar-bg: #0b0c10;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .2s ease, color .2s ease;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.app-shell { display: flex; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--bg-panel); border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.topbar .brand img { height: 34px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }

.main-content { flex: 1; padding: 24px; max-width: 1200px; margin: 0 auto; width: 100%; }

.main-wrapper { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- Sidebar categorizada ---------- */
.sidebar {
  width: 250px; flex-shrink: 0; background: var(--sidebar-bg);
  border-right: 1px solid var(--border); padding: 20px 0; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 0 20px 20px;
  color: #fff; font-weight: 700; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 14px;
}
.sidebar-brand img { height: 30px; border-radius: 6px; }
.sidebar-section { margin-bottom: 18px; }
.sidebar-section-title {
  display: block; padding: 0 20px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: #8b93a3; font-weight: 700; margin-bottom: 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 20px;
  color: #d1d5db; font-weight: 600; font-size: 14px; text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-link.active { background: rgba(59,110,246,.15); border-left-color: var(--primary); color: #fff; }

.sidebar-toggle-btn {
  display: none; background: none; border: none; color: var(--text);
  font-size: 22px; cursor: pointer; line-height: 1; padding: 4px;
}
.sidebar-backdrop { display: none; }

@media (max-width: 880px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.4); }
  .sidebar-toggle-btn { display: block; }
  .sidebar-backdrop.open {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 150;
  }
}

.card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px;
}

h1, h2, h3 { color: var(--text); }
.subtitle { color: var(--text-muted); margin-top: -8px; }

label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-alt); color: var(--text); font-size: 15px; margin-bottom: 14px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator { filter: invert(0.8); }

/* Controles compactos dentro de tabelas/linhas de ação (ex.: trocar nível
   de acesso ao lado dos botões Desativar/Excluir) — sem largura 100% nem
   margem de formulário empilhado, para não desalinhar a linha. */
.inline-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-actions form { display: inline-flex; margin: 0; }
.inline-actions select, .inline-actions input {
  width: auto; margin-bottom: 0; padding: 6px 10px; font-size: 13px; min-width: 100px;
}

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 11px 20px; border-radius: 8px; border: none;
  background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; font-size: 15px;
  transition: background .15s ease, transform .05s ease; white-space: nowrap;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn.secondary { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--border); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #dc2626; }
.btn.small { padding: 7px 14px; font-size: 13.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.admin { background: #7c3aed22; color: #7c3aed; }
.badge.lider { background: #f59e0b22; color: #f59e0b; }
.badge.musico { background: #3b6ef622; color: #3b6ef6; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:nth-child(even) td { background: var(--bg-alt); }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert.success { background: #22c55e22; color: #16a34a; border: 1px solid #22c55e55; }
.alert.error { background: #ef444422; color: #dc2626; border: 1px solid #ef444455; }
.alert.info { background: #3b6ef622; color: #3b6ef6; border: 1px solid #3b6ef655; }

.theme-toggle {
  cursor: pointer; background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 999px; width: 40px; height: 40px; display: flex; align-items: center;
  justify-content: center; font-size: 18px;
}

.notif-wrapper { position: relative; }
.notif-bell { cursor: pointer; font-size: 20px; position: relative; }
.notif-count {
  position: absolute; top: -6px; right: -8px; background: var(--danger); color: #fff;
  font-size: 11px; border-radius: 999px; padding: 1px 6px; font-weight: 700;
}
.notif-dropdown {
  display: none; position: absolute; right: 0; top: 34px; width: 320px; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 50;
  max-height: 360px; overflow-y: auto;
}
.notif-dropdown.open { display: block; }
.notif-item { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.notif-item:last-child { border-bottom: none; }

.login-shell { display: flex; min-height: 100vh; }
.login-side { flex: 1; background: var(--sidebar-bg); display: flex; align-items: center; justify-content: center; }
.login-side img { max-width: 180px; }
.login-form-side { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { width: 100%; max-width: 380px; padding: 20px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 800px) {
  .login-side { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--border);
  font-size: 13px; cursor: pointer; user-select: none;
}
.chip.checked { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Resumo estilo painel (stat cards) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-card .stat-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat-card .stat-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.accent .stat-value { color: var(--accent); }

/* ---------- Catálogo de músicas: ícones de link + form recolhível ---------- */
.song-links a { font-size: 18px; text-decoration: none; margin-right: 8px; }
.song-links a:hover { opacity: .7; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸ '; }
details[open] > summary::before { content: '▾ '; }

/* ---------- Cifra ChordPro (estrutura gerada pelo ChordSheetJS) ---------- */
#chordPreview, #printArea { font-family: 'Courier New', monospace; line-height: 1.5; }
#chordPreview h1, #printArea h1 { font-size: 20px; margin: 0 0 4px; font-family: 'Segoe UI', sans-serif; }
#chordPreview h2, #printArea h2 { font-size: 14px; font-weight: 400; color: #666; margin: 0 0 16px; font-family: 'Segoe UI', sans-serif; }
#chordPreview .paragraph, #printArea .paragraph { margin-bottom: 18px; }
#chordPreview .paragraph.chorus, #printArea .paragraph.chorus { border-left: 3px solid #999; padding-left: 10px; }
#chordPreview .row, #printArea .row { display: flex; flex-wrap: wrap; }
#chordPreview .column, #printArea .column { display: flex; flex-direction: column; margin-right: 2px; }
#chordPreview .chord, #printArea .chord { font-weight: 700; color: #b91c1c; min-height: 1.4em; white-space: pre; }
#chordPreview .lyrics, #printArea .lyrics { white-space: pre; }
#chordPreview .comment, #printArea .comment { font-style: italic; color: #555; margin-bottom: 6px; font-family: 'Segoe UI', sans-serif; }

/* ---------- Campo de senha: botão mostrar/ocultar + dica de requisitos ---------- */
.password-field { position: relative; }
.password-field input[type=password], .password-field input[type=text] { padding-right: 44px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 17px; padding: 6px;
  color: var(--text-muted); line-height: 1;
}
.password-toggle:hover { color: var(--text); }
.field-hint { color: var(--text-muted); font-size: 12px; margin: -10px 0 14px; }

/* ---------- Badge "Cifra do sistema" (ChordPro) — diferencia do link externo ---------- */
.chordpro-badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 700; text-decoration: none; white-space: nowrap;
}
.chordpro-badge-has { background: #22c55e22; color: #16a34a; border: 1px solid #22c55e55; }
.chordpro-badge-empty { background: transparent; color: var(--text-muted); border: 1px dashed var(--border); }
.chordpro-badge-has:hover { background: #22c55e33; }
.chordpro-badge-empty:hover { color: var(--primary); border-color: var(--primary); }

/* ---------- Abas "Adicionar música" (buscar no catálogo / música nova) ---------- */
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.catalog-search-item {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px;
  cursor: pointer; font-size: 14px; background: var(--bg-alt);
}
.catalog-search-item:hover { border-color: var(--primary); background: var(--bg-panel); }

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-panel); border-radius: var(--radius); padding: 24px; width: 90%; max-width: 440px;
  border: 1px solid var(--border);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.weekday-block h3 { margin-bottom: 6px; }
.weekday-block { margin-bottom: 28px; overflow-x: auto; }

.tag-conflict { color: var(--warning); font-weight: 700; }
.footer-note { color: var(--text-muted); font-size: 12px; text-align: center; margin-top: 30px; }
