/*
 * WP Chords 1.3.8 — modern UI skin
 * The original chord-rendering geometry is intentionally preserved.
 */
.app-handler.wpchords-modernized {
  --wpchords-blue: #0e14e3;
  --wpchords-hover: #070c9f;
  --wpchords-red: #cc0000;
  --wpchords-focus: rgba(14, 20, 227, 0.18);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ===================== HEADER / NATIVE CONTROLS ===================== */
.app-handler.wpchords-modernized .header-handler { width: 100%; }

.app-handler.wpchords-modernized .header-handler .cover > .d-flex {
  align-items: center !important;
  gap: 6px;
  flex-wrap: nowrap !important;
  width: 100%;
  box-sizing: border-box;
}

.app-handler.wpchords-modernized .header-handler .btn-group {
  display: inline-flex;
  align-items: stretch;
  gap: 0 !important;
  vertical-align: middle;
}

.app-handler.wpchords-modernized .header-handler .btn-group > .btn {
  min-height: 41px;
  border: 1px solid var(--wpchords-blue) !important;
  border-radius: 0 !important;
  margin: 0 0 0 -1px !important;
  background: #fff !important;
  color: var(--wpchords-blue) !important;
  box-shadow: none !important;
  outline: none !important;
  font-family: inherit !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}

.app-handler.wpchords-modernized .header-handler .btn-group > .btn:first-child {
  margin-left: 0 !important;
  border-top-left-radius: 5px !important;
  border-bottom-left-radius: 5px !important;
}

.app-handler.wpchords-modernized .header-handler .btn-group > .btn:last-child {
  border-top-right-radius: 5px !important;
  border-bottom-right-radius: 5px !important;
}

.app-handler.wpchords-modernized .header-handler button.btn:hover,
.app-handler.wpchords-modernized .header-handler select.btn:hover,
.app-handler.wpchords-modernized .header-handler .wpchords-mode-button:hover,
.app-handler.wpchords-modernized .header-handler .wpchords-print-button:hover {
  background: var(--wpchords-hover) !important;
  border-color: var(--wpchords-hover) !important;
  color: #fff !important;
}

.app-handler.wpchords-modernized .header-handler button.btn:hover svg,
.app-handler.wpchords-modernized .header-handler .wpchords-mode-button:hover svg,
.app-handler.wpchords-modernized .header-handler .wpchords-print-button:hover svg,
.app-handler.wpchords-modernized .header-handler .custom-print-icon:hover {
  fill: #fff !important;
  color: #fff !important;
}

.app-handler.wpchords-modernized .header-handler button.btn:focus-visible,
.app-handler.wpchords-modernized .header-handler select.btn:focus-visible,
.app-handler.wpchords-modernized .header-handler .wpchords-mode-button:focus-visible,
.app-handler.wpchords-modernized .header-handler .wpchords-print-button:focus-visible {
  box-shadow: 0 0 0 3px var(--wpchords-focus) !important;
}

.app-handler.wpchords-modernized .header-handler button.wasbase,
.app-handler.wpchords-modernized .header-handler button.active {
  background: var(--wpchords-blue) !important;
  border-color: var(--wpchords-blue) !important;
  color: #fff !important;
}

.app-handler.wpchords-modernized .header-handler button.wasbase {
  border-bottom-width: 4px !important;
}

.app-handler.wpchords-modernized .header-handler .btn-toolbar {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 5px !important;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

.app-handler.wpchords-modernized .header-handler .btn-toolbar .btn-group {
  display: inline-flex;
  flex-wrap: nowrap;
  min-width: max-content;
}

.app-handler.wpchords-modernized .header-handler .btn-toolbar .btn {
  min-width: 36px;
  min-height: 34px;
  padding: 6px 9px !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

/* ===================== CIFRA / LETRA ===================== */
/* This element is kept INSIDE the native toolbar row. Only CSS decides when
   it moves to a second line, so Elementor/editor viewport quirks cannot move
   it incorrectly on desktop. */
.app-handler.wpchords-modernized .header-handler .wpchords-action-row {
  display: inline-flex !important;
  align-items: stretch !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  box-sizing: border-box !important;
  vertical-align: middle !important;
  order: 99 !important;
}

.app-handler.wpchords-modernized .header-handler .wpchords-mode-group {
  display: inline-flex !important;
  align-items: stretch !important;
  flex: 0 0 auto !important;
  gap: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Same button height and typography as the native controls above. */
.app-handler.wpchords-modernized .header-handler .wpchords-mode-button {
  box-sizing: border-box !important;
  width: 74px !important;
  min-width: 74px !important;
  height: 41px !important;
  min-height: 41px !important;
  margin: 0 0 0 -1px !important;
  padding: 0 10px !important;
  border: 1px solid var(--wpchords-blue) !important;
  border-radius: 0 !important;
  background: #fff !important;
  color: var(--wpchords-blue) !important;
  box-shadow: none !important;
  cursor: pointer;
  font-family: inherit !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}

.app-handler.wpchords-modernized .header-handler .wpchords-mode-button:first-child {
  margin-left: 0 !important;
  border-top-left-radius: 5px !important;
  border-bottom-left-radius: 5px !important;
}

.app-handler.wpchords-modernized .header-handler .wpchords-mode-button:last-child {
  border-top-right-radius: 5px !important;
  border-bottom-right-radius: 5px !important;
}

.app-handler.wpchords-modernized .header-handler .wpchords-mode-button.is-active {
  background: var(--wpchords-blue) !important;
  border-color: var(--wpchords-blue) !important;
  color: #fff !important;
}

/* ===================== DISPLAY MODES ===================== */
.app-handler.wpchords-modernized .wpChordsBody {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.app-handler.wpchords-modernized .wp-chords { font-size: 18px; }

.app-handler.wpchords-modernized.wpchords-lyrics-only .chordHold,
.app-handler.wpchords-modernized.wpchords-lyrics-only .chordBlock,
.app-handler.wpchords-modernized.wpchords-lyrics-only .akorItem {
  display: none !important;
}

.app-handler.wpchords-modernized.wpchords-lyrics-only .wp-chords {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif !important;
  font-size: 18px;
}

/* Remove the old gray chord-card appearance without changing native geometry. */
.app-handler.wpchords-modernized .wpChordsBody .wp-chords { color: #161b24 !important; }
.app-handler.wpchords-modernized .wpChordsBody .chordBlock,
.app-handler.wpchords-modernized .wpChordsBody .chordBlock[style] {
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  color: var(--wpchords-red) !important;
  box-shadow: none !important;
}
.app-handler.wpchords-modernized .wpChordsBody .chordHold { background: transparent !important; }

/* ===================== PRINTER BUTTON ===================== */
/* Keep the printer white with the blue icon on every viewport. */
.app-handler.wpchords-modernized .header-handler button.wpchords-print-button,
.app-handler.wpchords-modernized .header-handler button.wpchords-print-button.btn-secondary,
.app-handler.wpchords-modernized .header-handler button:has(svg[data-icon="print"]) {
  background: #fff !important;
  background-color: #fff !important;
  background-image: none !important;
  color: var(--wpchords-blue) !important;
  border: 1px solid var(--wpchords-blue) !important;
  border-color: var(--wpchords-blue) !important;
  opacity: 1 !important;
  filter: none !important;
}

.app-handler.wpchords-modernized .header-handler button.wpchords-print-button svg,
.app-handler.wpchords-modernized .header-handler button.wpchords-print-button .custom-print-icon,
.app-handler.wpchords-modernized .header-handler button.wpchords-print-button .custom-print-icon path,
.app-handler.wpchords-modernized .header-handler button:has(svg[data-icon="print"]) svg,
.app-handler.wpchords-modernized .header-handler button:has(svg[data-icon="print"]) path {
  fill: var(--wpchords-blue) !important;
  color: var(--wpchords-blue) !important;
}

.app-handler.wpchords-modernized .header-handler button.wpchords-print-button:hover svg,
.app-handler.wpchords-modernized .header-handler button.wpchords-print-button:hover .custom-print-icon,
.app-handler.wpchords-modernized .header-handler button.wpchords-print-button:hover .custom-print-icon path,
.app-handler.wpchords-modernized .header-handler button:has(svg[data-icon="print"]):hover svg,
.app-handler.wpchords-modernized .header-handler button:has(svg[data-icon="print"]):hover path {
  fill: #fff !important;
  color: #fff !important;
}

/* ===================== RESPONSIVE POSITION ONLY ===================== */
/* Desktop/tablet landscape: everything stays on the original FIRST row. */
@media (min-width: 992px) {
  .app-handler.wpchords-modernized .header-handler .cover > .d-flex {
    flex-wrap: nowrap !important;
    align-items: center !important;
  }

  .app-handler.wpchords-modernized .header-handler .wpchords-action-row {
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 !important;
  }
}

/* Mobile/tablet portrait: ONLY Cifra/Letra drops to a centered second row.
   Native controls above stay in their original row and are not resized. */
@media (max-width: 991px) {
  /*
   * Mobile/tablet portrait:
   * - The native controls remain in ONE row.
   * - The two native button groups expand only as groups, never as individual
   *   stretched controls.
   * - The printer keeps a compact fixed width.
   * - Only Cifra/Letra moves to the second row.
   */
  .app-handler.wpchords-modernized .header-handler .cover > .d-flex {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 48px !important;
    grid-template-rows: max-content max-content !important;
    grid-auto-flow: row !important;
    align-items: center !important;
    justify-items: stretch !important;
    column-gap: 6px !important;
    row-gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex-wrap: nowrap !important;
  }

  /* The first two native groups use all available width as groups. */
  .app-handler.wpchords-modernized .header-handler .cover > .d-flex > .btn-group:nth-child(1),
  .app-handler.wpchords-modernized .header-handler .cover > .d-flex > .btn-group:nth-child(2) {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 0 0 auto !important;
  }

  .app-handler.wpchords-modernized .header-handler .cover > .d-flex > .btn-group:nth-child(1) {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  .app-handler.wpchords-modernized .header-handler .cover > .d-flex > .btn-group:nth-child(2) {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  /* Preserve the native equal distribution inside each group. */
  .app-handler.wpchords-modernized .header-handler .cover > .d-flex > .btn-group > .btn {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  /* Printer occupies only its compact column and stays vertically centered. */
  .app-handler.wpchords-modernized .header-handler .cover > .d-flex > .wpchords-print-button,
  .app-handler.wpchords-modernized .header-handler .cover > .d-flex > button:has(svg[data-icon="print"]) {
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: stretch !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    margin: 0 !important;
  }

  /* Cifra / Letra centered below, larger than before while keeping native
     41px height and 16px typography. */
  .app-handler.wpchords-modernized .header-handler .cover > .d-flex > .wpchords-action-row {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    justify-self: center !important;
    width: 68% !important;
    min-width: 220px !important;
    max-width: 720px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    flex: 0 0 auto !important;
    order: initial !important;
  }

  .app-handler.wpchords-modernized .header-handler .wpchords-mode-group {
    width: 100% !important;
    display: flex !important;
  }

  .app-handler.wpchords-modernized .header-handler .wpchords-mode-button {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 41px !important;
    min-height: 41px !important;
    font-family: inherit !important;
    font-size: 16px !important;
    font-weight: 600 !important;
  }
}
