/* Musiveo Theme Extended — frontend. Scoped to [data-mte-*] + html.mte-enabled. */
html[data-mte-accent] { color-scheme: dark; }
html.mte-enabled body { background-color: var(--body-bg-color, #000); color: var(--text-color, #F2F3F4); }

/* Chrome surfaces follow the active background (specificity beats .dark rules, no theme edits). */
html.mte-enabled .site-header { background-color: var(--mte-header-bg); }
html.mte-enabled .site-header .search-form { background-color: var(--mte-surface-2); }
html.mte-enabled .site-sidebar { background-color: var(--mte-surface); }
html.mte-enabled .site-footer { background-color: var(--mte-bg); }
html.mte-enabled .navigation { background-color: var(--mte-header-bg); }
html.mte-enabled .plyr-playlist,
html.mte-enabled .plyr-playlist .plyr,
html.mte-enabled .mobile-menu { background-color: var(--mte-surface); color: var(--text-color); }

/* Prompt field in the music generator keeps its native look. */
html.mte-enabled .musiveo-form-group input[type="text"],
html.mte-enabled .musiveo-form-group textarea,
html.mte-enabled .musiveo-form-group input[type="text"]:focus,
html.mte-enabled .musiveo-form-group textarea:focus {
  background-color: #181818 !important;
  -webkit-box-shadow: 0 0 0 1000px #181818 inset !important;
  box-shadow: 0 0 0 1000px #181818 inset !important;
  -webkit-text-fill-color: #fff !important;
  color: #fff !important;
  border-color: #181818;
}
/* ---------- Companion plugins (var-driven; their files are untouched) ---------- */
html.mte-enabled .mshub-dashboard { background-color: var(--mshub-background); color: var(--mshub-text); }
html.mte-enabled .mshub-card { background: var(--mshub-card-bg); border-color: var(--mshub-border); }
html.mte-enabled .aie-container { background: var(--aie-bg-secondary); color: var(--aie-text-primary); }
html.mte-enabled .musiveo-container.musiveo-theme-dark,
html.mte-enabled .musiveo-theme-dark { background-color: transparent; color: var(--musiveo-dark-text); }
.dark .wp-block-column {
    flex-grow: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    margin: auto;
    padding: 0.3rem;
    border-radius: 9px;
    background-color: #00000000;
    box-shadow: none;
    z-index: 1;
}
html.mte-enabled .site-footer {
    background-color: transparent;
}

/* ---------- Brand gradients (purple -> ice blue signature) ---------- */
html[data-mte-gradient="1"] .btn-play-normal,
html[data-mte-gradient="1"] .nav li.btn-link a {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-2) 100%);
  border-color: transparent; color: #fff; }
html[data-mte-gradient="1"] [data-mte-switcher] .mte-trigger__dot {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-2) 100%); }
html[data-mte-gradient="1"] #mte-progress {
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-2));
  box-shadow: 0 0 10px var(--color-primary); }
html[data-mte-gradient="1"] [data-mte-menu] .mte-card.is-active {
  box-shadow: 0 0 0 1px var(--color-primary), 0 4px 22px -6px var(--color-primary); }
html[data-mte-gradient="1"] [data-mte-menu] .mte-accent.is-active span {
  box-shadow: 0 0 0 2px #0e0e10, 0 0 16px var(--color-primary); }

/* ---------- Page transitions (coexist with theme page-progress) ---------- */
html.mte-motion body main { animation: mtewx-enter .5s cubic-bezier(.22,.61,.36,1) both; }
@keyframes mtewx-enter { from { opacity: 0; transform: translateY(14px) scale(.998); } to { opacity: 1; transform: none; } }
html.mte-motion.mte-navigating body main { opacity: .25; transition: opacity .25s ease; }
#mte-progress { position: fixed; top: 0; left: 0; z-index: 200000; width: 0; height: 3px;
  background-color: var(--color-primary, #E8EAED); opacity: 0; transition: width .3s ease, opacity .3s ease;
  box-shadow: 0 0 8px var(--color-primary, #E8EAED); }
html.mte-navigating #mte-progress { opacity: 1; }

/* ---------- Switcher trigger ---------- */
[data-mte-switcher] { font-family: inherit; display: inline-flex; max-width: 100%; }
[data-mte-switcher] .mte-trigger { display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700;
  background: #111318; color: #fff; border: 1px solid rgba(255,255,255,.14);
  transition: transform .15s ease, box-shadow .15s ease; -webkit-tap-highlight-color: transparent; }
[data-mte-switcher] .mte-trigger:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
[data-mte-switcher] .mte-trigger:focus-visible { outline: 2px solid var(--color-primary, #E8EAED); outline-offset: 2px; }
[data-mte-switcher] .mte-trigger__dot { width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: var(--color-primary, #E8EAED); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
[data-mte-switcher] .mte-trigger__name { opacity: .65; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mte-switcher--icon .mte-trigger { padding: 9px; }

/* ---------- Popup (portaled to <body>, viewport-centered like mt overlay) ---------- */
[data-mte-menu].mte-overlay { position: fixed !important; top: 0; right: 0; bottom: 0; left: 0; z-index: 999999;
  display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto;
  background: rgba(0,0,0,.74); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
[data-mte-menu].mte-overlay[hidden] { display: none !important; pointer-events: none !important; }
[data-mte-menu] .mte-dialog { display: flex; flex-direction: column; width: 720px; max-width: 100%;
  max-height: calc(100vh - 48px); overflow: hidden; color: #fff; background: #0e0e10;
  border: 1px solid rgba(255,255,255,.14); border-radius: 18px; box-shadow: 0 24px 80px rgba(0,0,0,.65); }
html.mte-motion [data-mte-menu]:not([hidden]) .mte-dialog { animation: mtewx-pop .28s cubic-bezier(.22,.61,.36,1) both; }
@keyframes mtewx-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
[data-mte-menu] .mte-dialog__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
[data-mte-menu] .mte-dialog__eyebrow { display: block; margin-bottom: 5px; color: rgba(255,255,255,.55);
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
[data-mte-menu] .mte-dialog__header strong { display: block; font-size: 19px; line-height: 1.2; }
[data-mte-menu] .mte-dialog__sub { display: block; margin-top: 4px; color: rgba(255,255,255,.55); font-size: 12px; }
[data-mte-menu] .mte-dialog__close { display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.08);
  color: inherit; cursor: pointer; font-size: 24px; line-height: 1; }
[data-mte-menu] .mte-dialog__close:hover { background: rgba(255,255,255,.16); }
[data-mte-menu] .mte-dialog__body { overflow: auto; padding: 16px 18px 20px; -webkit-overflow-scrolling: touch; }
[data-mte-menu] .mte-section-title { margin: 6px 0 2px; font-size: 11px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.6); }
[data-mte-menu] .mte-section-title:not(:first-child) { margin-top: 18px; }
[data-mte-menu] .mte-section-hint { margin: 0 0 10px; color: rgba(255,255,255,.4); font-size: 11.5px; }
/* Accent swatches */
[data-mte-menu] .mte-accents { display: flex; flex-wrap: wrap; gap: 10px; }
[data-mte-menu] .mte-accent { position: relative; width: 42px; height: 42px; padding: 0; border-radius: 50%;
  border: 2px solid transparent; background: transparent; cursor: pointer; }
[data-mte-menu] .mte-accent span { display: block; width: 100%; height: 100%; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2); transition: transform .15s ease; }
[data-mte-menu] .mte-accent:hover span { transform: scale(1.1); }
[data-mte-menu] .mte-accent:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
[data-mte-menu] .mte-accent.is-active { border-color: #fff; }
[data-mte-menu] .mte-accent.is-active span { box-shadow: 0 0 0 2px #0e0e10, 0 0 14px rgba(255,255,255,.25); }
[data-mte-menu] .mte-accent--custom { border-style: dashed; border-color: rgba(255,255,255,.35); overflow: hidden; }
[data-mte-menu] .mte-accent--custom input[type="color"] { position: absolute; inset: -8px; width: 200%; height: 200%;
  padding: 0; border: 0; background: none; cursor: pointer; }
[data-mte-menu] .mte-accent--custom span { position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 20px; font-weight: 300; color: #fff; pointer-events: none; border: 0; }
[data-mte-menu] .mte-grid { display: grid; grid-gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
[data-mte-menu] .mte-grid--wall { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
[data-mte-menu] .mte-card { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px;
  padding: 10px 12px; border: 1px solid transparent; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,.04); color: inherit; font: inherit; text-align: left; }
[data-mte-menu] .mte-card:hover { background: rgba(255,255,255,.09); }
[data-mte-menu] .mte-card:focus-visible { outline: 2px solid var(--color-primary, #E8EAED); outline-offset: 1px; }
[data-mte-menu] .mte-card.is-active { border-color: var(--color-primary, #E8EAED); background: rgba(255,255,255,.08); }
[data-mte-menu] .mte-card__preview { position: relative; flex: none; width: 52px; height: 38px; border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.15); }
[data-mte-menu] .mte-card__preview--wall { width: 44px; }
[data-mte-menu] .mte-live-badge { position: absolute; top: 3px; right: 3px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0,0,0,.65); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
[data-mte-menu] .mte-card__text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; gap: 2px; }
[data-mte-menu] .mte-card__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 700; }
[data-mte-menu] .mte-card__text small { color: rgba(255,255,255,.55); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-mte-menu] .mte-card__check { flex: none; color: var(--color-primary, #E8EAED); font-size: 16px; font-weight: 800; opacity: 0; }
[data-mte-menu] .mte-card.is-active .mte-card__check { opacity: 1; }
/* Motion toggle: labeled pill switch */
[data-mte-menu] .mte-motion-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.04); }
[data-mte-menu] .mte-motion-row strong { display: block; font-size: 13.5px; }
[data-mte-menu] .mte-motion-row small { color: rgba(255,255,255,.55); font-size: 11.5px; }
[data-mte-menu] .mte-toggle { display: inline-block; flex: none; width: 44px; height: 24px; padding: 3px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 999px; cursor: pointer; background: rgba(255,255,255,.07); }
[data-mte-menu] .mte-toggle__knob { display: block; width: 18px; height: 18px; border-radius: 50%; background: #6b7078;
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
  transition: transform .22s cubic-bezier(.22,.61,.36,1), background .22s ease, box-shadow .22s ease; }
[data-mte-menu] .mte-toggle.is-on { border-color: var(--color-primary, #E8EAED); background: rgba(255,255,255,.05); }
[data-mte-menu] .mte-toggle.is-on .mte-toggle__knob { transform: translateX(20px); background: #fff;
  box-shadow: 0 0 8px var(--color-primary, #E8EAED); }
[data-mte-menu] .mte-motion-state { flex: none; min-width: 26px; font-size: 10px; font-weight: 800;
  letter-spacing: .1em; color: rgba(255,255,255,.4); }
[data-mte-menu] .mte-toggle.is-on + .mte-motion-state { color: #fff; }
/* Live row: status glow dot + locked live options when calm. */
[data-mte-menu] .mte-live-row { padding: 14px 16px; border: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015)); }
[data-mte-menu] .mte-live-ico { flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: #4a4e55; transition: background .25s ease, box-shadow .25s ease; }
[data-mte-menu] .mte-live-row.is-on .mte-live-ico { background: var(--color-primary, #E8EAED);
  box-shadow: 0 0 10px var(--color-primary, #E8EAED);
  animation: mtewx-live-pulse 2.2s ease-in-out infinite; }
@keyframes mtewx-live-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.72); opacity: .6; } }
[data-mte-menu] .mte-card--wall.is-disabled { opacity: .35; filter: grayscale(.7); }
[data-mte-menu] .mte-card--wall:disabled { cursor: not-allowed; }
[data-mte-menu] .mte-card--wall:disabled:hover { background: rgba(255,255,255,.04); }
[data-mte-menu] .mte-dialog__note { margin: 14px 2px 0; color: rgba(255,255,255,.5); font-size: 11.5px; }
[data-mte-menu] .mte-motion-note { margin: 12px 2px 0; padding: 9px 12px; border-radius: 9px;
  background: rgba(245,165,36,.1); border: 1px solid rgba(245,165,36,.35);
  color: #f5cf8a; font-size: 12px; }
[data-mte-menu] .mte-motion-note[hidden] { display: none; }

/* ---------- Switcher trigger: neutral button, color shown in the dot ---------- */
[data-mte-switcher] .mte-trigger { border: 1px solid rgba(255,255,255,.14); box-shadow: none; }
[data-mte-switcher] .mte-trigger__dot { width: 20px; height: 20px;
  background: linear-gradient(135deg, var(--color-primary, #E8EAED), var(--color-primary-2, #38BDF8)); }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  [data-mte-menu].mte-overlay { padding: 12px; }
  [data-mte-menu] .mte-dialog { max-height: calc(100vh - 24px); border-radius: 15px; }
  [data-mte-menu] .mte-dialog__header { padding: 16px 16px 12px; }
  [data-mte-menu] .mte-dialog__body { padding: 12px 12px 16px; }
  [data-mte-menu] .mte-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  [data-mte-switcher] .mte-trigger__name { display: none; }
}

/* ---------- Reduced motion (only when the admin enables respect AND the user never chose) ---------- */
@media (prefers-reduced-motion: reduce) {
  html[data-mte-respect="1"][data-mte-explicit="0"].mte-motion body main { animation: none; }
  html[data-mte-respect="1"][data-mte-explicit="0"].mte-motion [data-mte-menu]:not([hidden]) .mte-dialog { animation: none; }
}
