@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');

:root {
  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-700: #1e3a5f;
  --indigo-800: #0f172a;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-800: #1e293b;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06);
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --sidebar-width: 260px;
  --transition: .2s ease;
}

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

body {
  font-family: var(--font-body);
  background: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.5
}

.hidden {
  display: none !important
}

.auth-screen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh
}

@media(max-width:900px) {
  .auth-screen {
    grid-template-columns: 1fr
  }

  .auth-brand {
    display: none !important
  }
}

.auth-brand {
  background: #0f172a;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3.5rem;
  border-right: 1px solid rgba(255, 255, 255, .06);
  position: relative
}

.auth-brand::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #3b82f6
}

.auth-brand h1 {
  font-family: var(--font-display);
  font-size: 2.25rem;
  margin-bottom: .75rem
}

.auth-brand p {
  opacity: .75;
  max-width: 360px;
  line-height: 1.65
}

.auth-brand .badge {
  display: inline-block;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  padding: .35rem .85rem;
  border-radius: 6px;
  font-size: .75rem;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: .04em
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: #fff
}

.auth-card {
  width: 100%;
  max-width: 420px
}

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

.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width var(--transition)
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--slate-100)
}

.sidebar-header .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--indigo-700);
  display: flex;
  align-items: center;
  gap: .5rem
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #1e3a5f, #334155);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .9rem
}

.sidebar-nav {
  flex: 1;
  padding: 1rem .75rem;
  overflow-y: auto
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .9rem;
  border-radius: var(--radius-sm);
  color: var(--slate-600);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  margin-bottom: 2px
}

.nav-item:hover {
  background: var(--slate-50);
  color: var(--slate-800)
}

.nav-item.active {
  background: var(--indigo-50);
  color: var(--indigo-700)
}

.nav-item svg,
.nav-item i {
  width: 20px;
  font-size: 1.1rem;
  text-align: center;
  flex-shrink: 0;
  opacity: .8
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--slate-100)
}

.user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #334155, #1e293b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .85rem
}

.user-meta .name {
  font-weight: 600;
  font-size: .875rem
}

.user-meta .role {
  font-size: .75rem;
  color: var(--slate-500)
}

.sidebar.collapsed {
  width: 72px
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-meta,
.sidebar.collapsed .btn-logout-text {
  display: none
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: .75rem 0;
  gap: 0
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition)
}

.app-layout.sidebar-is-collapsed .main-content {
  margin-left: 72px
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  padding: .85rem 1.75rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  position: sticky;
  top: 0;
  z-index: 50
}

.topbar h1 {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: var(--font-display)
}

.topbar-sidebar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--slate-200);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  color: var(--slate-600)
}

.topbar-sidebar-btn:hover {
  background: var(--slate-50);
  color: var(--indigo-700)
}

.page-content {
  padding: 1.75rem;
  flex: 1
}

.page {
  display: none
}

.page.active {
  display: block
}

.card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem
}

.card-header {
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap
}

.card-header h3 {
  font-size: 1.05rem;
  font-family: var(--font-display)
}

.card-body {
  padding: 1.35rem
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.75rem
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  cursor: pointer
}

.stat-card .label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: .03em
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: .25rem
}

.stat-card .hint {
  font-size: .8rem;
  color: var(--slate-400);
  margin-top: .25rem
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none
}

.btn-primary {
  background: #1e3a5f;
  color: #fff
}

.btn-primary:hover {
  background: #0f172a
}

.btn-secondary {
  background: #fff;
  border-color: var(--slate-200);
  color: var(--slate-700)
}

.btn-secondary:hover {
  background: var(--slate-50)
}

.btn-ghost {
  background: transparent;
  color: var(--slate-600)
}

.btn-ghost:hover {
  background: var(--slate-50)
}

.btn-danger {
  background: var(--danger);
  color: #fff
}

.btn-sm {
  padding: .35rem .65rem;
  font-size: .8rem
}

.btn-block {
  width: 100%
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed
}

.form-group {
  margin-bottom: 1rem
}

.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: .35rem;
  color: var(--slate-600)
}

.form-control {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: inherit;
  background: #fff
}

.form-control:focus {
  outline: none;
  border-color: #1e3a5f;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, .12)
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem
}

@media(max-width:600px) {
  .form-row {
    grid-template-columns: 1fr
  }
}

.table-wrap {
  overflow-x: auto
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem
}

th {
  text-align: left;
  padding: .75rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--slate-500);
  border-bottom: 1px solid var(--slate-200)
}

td {
  padding: .75rem;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle
}

.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500
}

.badge-sugerido {
  background: #fef3c7;
  color: #92400e
}

.badge-confirmado {
  background: #d1fae5;
  color: #065f46
}

.badge-imprevisto {
  background: #fee2e2;
  color: #991b1b
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem
}

.modal-overlay.open {
  display: flex
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .2)
}

.modal-lg {
  max-width: 720px
}

.modal-header {
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  justify-content: space-between;
  align-items: center
}

.modal-body {
  padding: 1.35rem
}

.modal-footer {
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--slate-100);
  display: flex;
  justify-content: flex-end;
  gap: .5rem
}

.modal-close {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--slate-500)
}

.toast-wrap {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .875rem;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease
}

.toast.error {
  background: var(--danger)
}

.toast.warning {
  background: var(--warning)
}

.toast.success {
  background: var(--success)
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  background: #fff
}

.cal-day.selected {
  background: #1e3a5f !important;
  color: #fff !important;
  font-weight: 700
}

.cal-day.today {
  border-color: #1e3a5f
}

.cal-day.other {
  visibility: hidden;
  pointer-events: none
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--slate-400)
}

.table-toolbar {
  display: flex;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-size: .85rem;
  color: var(--slate-500)
}

.grav-row {
  cursor: pointer
}

.grav-row:hover {
  background: var(--slate-50)
}

.grav-row.is-open {
  background: var(--indigo-50)
}

.grav-player {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  max-width: 720px
}

.grav-player-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center
}

.grav-progress-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .75rem;
  color: var(--slate-500)
}

.grav-progress-wrap input[type=range] {
  flex: 1;
  accent-color: #1e3a5f
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .4);
  z-index: 90
}

@media(max-width:768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important
  }

  .sidebar.open {
    transform: translateX(0)
  }

  .sidebar-overlay.open {
    display: block
  }

  .main-content,
  .app-layout.sidebar-is-collapsed .main-content {
    margin-left: 0 !important
  }

  .menu-toggle {
    display: flex !important
  }

  .topbar-sidebar-btn {
    display: none !important
  }
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  color: var(--slate-600)
}
/* Month calendar views */
.month-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.month-cal-head {
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  color: var(--slate-400);
  padding: .35rem 0;
}
.month-cal-cell {
  min-height: 88px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}
.month-cal-cell.empty { background: transparent; border-color: transparent; }
.month-cal-cell.today { border-color: var(--indigo-400); box-shadow: 0 0 0 2px var(--indigo-100); }
.month-cal-num { font-size: .8rem; font-weight: 600; color: var(--slate-500); margin-bottom: 4px; }
.month-cal-item {
  display: block;
  width: 100%;
  text-align: left;
  font-size: .7rem;
  line-height: 1.25;
  padding: 3px 5px;
  margin-bottom: 3px;
  border: none;
  border-radius: 4px;
  background: var(--indigo-50);
  color: var(--indigo-700);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.month-cal-item.static { cursor: default; background: var(--slate-50); color: var(--slate-600); }
.month-cal-item:hover:not(.static) { background: var(--indigo-100); }
@media (max-width: 700px) {
  .month-cal-cell { min-height: 64px; }
  .month-cal-item { font-size: .65rem; }
}

/* ========== Responsividade de modais (sem scroll horizontal) ========== */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

.modal-overlay {
  align-items: flex-start;
  padding: .75rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal,
.modal.modal-lg {
  width: 100%;
  max-width: min(560px, 100%);
  max-height: calc(100vh - 1.5rem);
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal.modal-lg {
  max-width: min(720px, 100%);
}

.modal-body {
  overflow-x: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.modal-header,
.modal-footer {
  max-width: 100%;
  box-sizing: border-box;
}

/* Cifra / letra: quebra de linha, sem barra horizontal */
#cifraConteudo,
pre#cifraConteudo {
  white-space: pre-wrap !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow-x: hidden !important;
  max-width: 100%;
  box-sizing: border-box;
  font-size: clamp(.75rem, 2.8vw, .9rem);
  line-height: 1.45;
}

#tomBtns {
  max-width: 100%;
  overflow-x: hidden;
}

.tom-btns {
  max-width: 100%;
}

/* Tabelas: scroll só na tabela, nunca no modal inteiro de forma horizontal “solta” */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card, .page, .main-content, .app-layout {
  max-width: 100%;
  box-sizing: border-box;
}

/* Calendário mensal em mobile: evita estourar */
.month-cal {
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: .5rem;
  }
  .modal,
  .modal.modal-lg {
    max-height: calc(100vh - 1rem);
    border-radius: 12px;
  }
  .modal-body {
    padding: 1rem;
  }
  .modal-header {
    padding: 1rem;
  }
  #cifraConteudo,
  pre#cifraConteudo {
    padding: .75rem !important;
    font-size: .78rem;
  }
  /* formulário escala inline no evento */
  #eventoEscalaForm {
    grid-template-columns: 1fr !important;
  }
}


.btn.is-loading,
.btn:disabled {
  opacity: .7;
  cursor: wait;
  pointer-events: none;
}


/* ===== Cifra Club style ===== */
.cifra-club {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--slate-50);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--slate-200);
  max-width: 100%;
  overflow-x: hidden;
  line-height: 1.35;
  font-size: clamp(.78rem, 2.6vw, .92rem);
}
.cifra-club .cc-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: .35rem;
  gap: 0;
}
.cifra-club .cc-pair {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  margin-right: .15em;
  max-width: 100%;
}
.cifra-club .cc-chord {
  color: #e65100;
  font-weight: 700;
  font-size: .85em;
  line-height: 1.1;
  min-height: 1.1em;
  white-space: nowrap;
}
.cifra-club .cc-lyric {
  white-space: pre-wrap;
  word-break: break-word;
}
.cifra-club .cc-chord-only {
  color: #e65100;
  font-weight: 700;
  margin-right: .5em;
  white-space: nowrap;
}
.cifra-club .cc-section {
  font-weight: 700;
  color: var(--slate-600);
  margin: .75rem 0 .35rem;
}
.cifra-club .cc-fallback {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== YouTube fullscreen modal ===== */
.modal-video-overlay {
  z-index: 400;
  background: rgba(0,0,0,.82);
  padding: 0;
  align-items: center;
  justify-content: center;
}
.modal-video-overlay.open {
  display: flex;
}
.modal-video-frame {
  position: relative;
  width: min(960px, 96vw);
  max-height: 90vh;
}
.modal-video-inner {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
.modal-video-inner iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.modal-video-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 2;
}
.modal-video-close:hover { background: rgba(255,255,255,.28); }


/* Modal empilhado por cima de outro modal aberto */
.modal-overlay.modal-stack {
  z-index: 280;
}
