/* ==========================================================================
   IMPORTAÇÃO DE FONTE (GOOGLE FONTS)
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;700&display=swap");

/* ==========================================================================
   VARIÁVEIS DE CORES (TEMAS)
   ========================================================================== */
:root {
  /* Padrão: DARK MODE */
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --card-bg: #1e1e1e;
  --input-bg: #2c2c2c;
  --input-border: #333;
  --highlight: #ff9900; /* Laranja */
  --highlight-hover: #e68a00;
  --link-color: #00ccff; /* Azul Ciano */
  --danger-color: #ff4d4d; /* Vermelho */
  --purple-color: #d580ff; /* Roxo */
  --shadow: rgba(0, 0, 0, 0.5);
  --border-color: #444;
}

/* TEMA CLARO */
.light-mode {
  --bg-color: #f4f4f9;
  --text-color: #1a1a1a; /* Preto suave */
  --card-bg: #ffffff;
  --input-bg: #e8e8e8;
  --input-border: #ccc;
  --highlight: #d35400; /* Laranja escuro para contraste */
  --highlight-hover: #bf360c;
  --link-color: #005580; /* Azul escuro */
  --danger-color: #cc0000;
  --purple-color: #8e44ad;
  --shadow: rgba(0, 0, 0, 0.15);
  --border-color: #ddd;
}

/* ==========================================================================
   CONFIGURAÇÕES GERAIS
   ========================================================================== */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  padding: 20px;
  padding-bottom: 140px; /* Espaço para o rodapé fixo */
  max-width: 900px;
  margin: auto;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition:
    background-color 0.3s,
    color 0.3s;
}

img,
iframe {
  max-width: 100%;
}

a {
  text-decoration: none;
  transition: 0.2s;
}
a:hover {
  opacity: 0.8;
}

h1 {
  color: var(--text-color);
  margin-bottom: 10px;
  font-size: 24px;
}
h2,
h3 {
  color: var(--highlight);
}

/* --- CABEÇALHO --- */
.header-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

/* Botão de Tema (Sol/Lua) */
.btn-theme {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 8px 12px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 18px;
  margin-right: 5px;
}
.btn-theme:hover {
  background-color: var(--input-bg);
}

/* ==========================================================================
   FORMULÁRIOS E BOTÕES
   ========================================================================== */
label {
  display: block;
  margin-top: 15px;
  font-weight: bold;
  color: var(--highlight);
}

input,
textarea,
select {
  width: 100%;
  padding: 12px;
  margin-top: 5px;
  border: 1px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--text-color);
  outline: none;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 16px;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--highlight);
}

textarea {
  height: 300px;
  font-family: "Roboto Mono", "Consolas", monospace;
  line-height: 1.5;
}

/* Botões Padrão (Laranja) */
.btn-tom,
button[type="submit"] {
  margin-top: 10px;
  padding: 12px 20px;
  background: var(--highlight);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  border-radius: 4px;
}
button:hover {
  opacity: 0.9;
}

/* ==========================================================================
   BARRA DE PESQUISA (ESTILO GOOGLE)
   ========================================================================== */
.busca-container {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 600px;
  margin: 0 auto 30px auto;
  gap: 10px;
}

.input-busca {
  padding: 0 20px;
  border-radius: 24px;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-color);
  height: 48px;
  margin-top: 0;
}

.btn-busca {
  background-color: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--input-border);
  border-radius: 24px;
  padding: 0 20px;
  font-weight: 500;
  cursor: pointer;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
}
.btn-busca:hover {
  background-color: var(--border-color);
}

/* ==========================================================================
   LISTAS E CARTÕES
   ========================================================================== */
.item-musica,
.card-box {
  background-color: var(--card-bg);
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 5px var(--shadow);
}
.item-musica {
  border-left: 5px solid var(--highlight);
}
.card-box {
  border: 1px solid var(--border-color);
  padding: 25px;
}

.card-title {
  margin-top: 0;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 20px;
  font-size: 18px;
  color: var(--text-color);
}

.row-inputs {
  display: flex;
  gap: 15px;
}
.row-inputs div {
  flex: 1;
}

.conteudo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Botões de Ação Pequenos */
.btn-excluir,
.btn-editar,
.btn-agendar {
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  margin-left: 5px;
  display: inline-block;
  border: 1px solid transparent;
  text-decoration: none !important;
}
.btn-excluir {
  color: var(--danger-color);
  border-color: var(--danger-color);
}
.btn-editar {
  color: var(--link-color);
  border-color: var(--link-color);
}
.btn-agendar {
  color: var(--purple-color);
  border-color: var(--purple-color);
  cursor: pointer;
}

/* ==========================================================================
   VISUALIZAÇÃO DA CIFRA (RESPONSIVO COM SCROLL)
   ========================================================================== */
.cifra-display {
  background-color: var(--card-bg);
  padding: 15px;
  border-radius: 8px;

  /* Fonte Monoespaçada Profissional */
  font-family: "Roboto Mono", "Consolas", monospace;
  font-size: 16px; /* Tamanho base (controlado pelo JS depois) */
  line-height: 2;
  font-weight: 500;

  color: var(--text-color);
  border-left: 5px solid var(--highlight);
  border: 1px solid var(--border-color);

  /* O Segredo da Responsividade: Não quebra linha, cria scroll */
  white-space: pre;
  overflow-x: auto;

  display: block;
  width: 100%;
  box-sizing: border-box;
}

/* Estilo da barra de rolagem da cifra */
.cifra-display::-webkit-scrollbar {
  height: 8px;
}
.cifra-display::-webkit-scrollbar-track {
  background: var(--input-bg);
  border-radius: 4px;
}
.cifra-display::-webkit-scrollbar-thumb {
  background: var(--highlight);
  border-radius: 4px;
}

.artista-header {
  color: var(--text-color);
  opacity: 0.7;
  margin-top: -10px;
  margin-bottom: 20px;
  font-size: 16px;
  font-style: italic;
}

.acorde {
  color: var(--highlight);
  font-weight: bold;
  cursor: pointer;
}
.acorde:hover {
  color: var(--highlight-hover);
  background: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   BARRA DE FERRAMENTAS (FIXA NO RODAPÉ)
   ========================================================================== */
.ferramentas-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--card-bg);
  border-top: 1px solid var(--highlight);
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  z-index: 100;
}

.scroll-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 1px solid var(--border-color);
  padding-left: 10px;
  margin-left: 10px;
}

.btn-scroll {
  background-color: var(--highlight);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  width: 80px;
  font-size: 14px;
  margin-top: 0;
}

input[type="range"] {
  margin-top: 0;
  width: 80px;
}

/* ==========================================================================
   MODAL (POP-UP)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-box {
  background: var(--card-bg);
  color: var(--text-color);
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 350px;
  text-align: center;
  border: 1px solid var(--purple-color);
}

/* ==========================================================================
   RESPONSIVIDADE (MOBILE)
   ========================================================================== */
@media (max-width: 768px) {
  .header-topo {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .header-topo div {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
  }
  .row-inputs {
    flex-direction: column;
    gap: 0;
  }

  .conteudo-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .conteudo-item > div:last-child {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
  }
  .btn-excluir,
  .btn-editar,
  .btn-agendar {
    flex-grow: 1;
    text-align: center;
  }

  /* Ferramentas Mobile */
  .ferramentas-container {
    flex-wrap: wrap;
    padding: 10px 5px;
  }
  .btn-tom {
    flex-grow: 1;
    padding: 10px;
    font-size: 14px;
  }

  .scroll-controls {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    justify-content: center;
    margin-left: 0;
  }
  input[type="range"] {
    width: 100%;
  }
}

/* ==========================================================================
   IMPRESSÃO (PDF / PAPEL)
   ========================================================================== */
@media print {
  .header-topo,
  .ferramentas-container,
  .btn-theme,
  button,
  a,
  input,
  select,
  .modal-overlay,
  .scroll-controls {
    display: none !important;
  }

  body {
    background-color: white !important;
    color: black !important;
    padding: 0 !important;
    margin: 20px !important;
    max-width: 100% !important;
  }

  .cifra-display {
    background-color: white !important;
    color: black !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    font-size: 12pt !important;
    line-height: 1.8 !important;
    white-space: pre-wrap !important; /* Na impressão pode quebrar linha */
  }

  h1 {
    color: black !important;
    font-size: 20pt !important;
    text-align: center;
    margin-bottom: 5px;
  }
  .artista-header {
    color: #333 !important;
    text-align: center;
    font-size: 14pt !important;
    margin-bottom: 30px;
  }
  .acorde {
    color: #000 !important;
    font-weight: 900 !important;
  }
  /* --- PLAYERS DE ÁUDIO/VÍDEO --- */
  .video-container {
    position: relative;
    padding-bottom: 56.25%; /* Proporção 16:9 (Padrão YouTube) */
    height: 0;
    overflow: hidden;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
  }

  .video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  .spotify-container {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
  }
}
/* --- VISUALIZADOR DE PDF --- */
.pdf-viewer {
  width: 100%;
  height: 85vh; /* Ocupa 85% da altura da tela */
  border: none;
  border-radius: 8px;
  background-color: #333; /* Fundo cinza enquanto carrega */
  box-shadow: 0 4px 10px var(--shadow);
}

/* No celular, o PDF precisa de ajuste para não ficar minúsculo */
@media (max-width: 768px) {
  .pdf-viewer {
    height: 70vh;
  }
}
/* --- NOTIFICAÇÕES TOAST (MENSAGENS AUTOMÁTICAS) --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast-msg {
  background-color: #333;
  color: white;
  padding: 15px 25px;
  margin-bottom: 10px;
  border-radius: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  border-left: 5px solid #ff9900; /* Laranja padrão */
  font-size: 16px;
  opacity: 0;
  transform: translateX(100%); /* Começa escondido na direita */
  animation:
    slideIn 0.5s forwards,
    fadeOut 0.5s 3s forwards;
  display: flex;
  align-items: center;
}

.toast-msg.success {
  border-left-color: #2ecc71;
} /* Verde */
.toast-msg.error {
  border-left-color: #e74c3c;
} /* Vermelho */

/* Animação de entrada e saída */
@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}
