/* Worship Planner — tokens idénticos a lib/core/theme/app_theme.dart */
:root {
  color-scheme: light;
  --wp-primary: #ffb300;
  --wp-primary-strong: #ff8f00;
  --wp-primary-container: #ffe082;
  --wp-on-primary-container: #3a2a00;
  --wp-secondary: #2196f3;
  --wp-secondary-container: #d7ecff;
  --wp-error: #ff5252;
  --wp-success: #4caf50;
  --wp-bg: #eeeeee;
  --wp-surface: #ffffff;
  --wp-surface-container: #e0e0e0;
  --wp-text: #000000;
  --wp-muted: #757575;
  --wp-on-surface-variant: #6a6a6a;
  --wp-border: #e0e0e0;
  --wp-outline: #dddddd;
  --wp-zebra: #fafafc;
  --wp-appbar-bg: #eeeeee;
  --wp-radius-card: 24px;
  --wp-radius-section: 12px;
  --wp-radius-btn: 18px;
  --wp-radius-input: 18px;
  --wp-topbar-height: 76px;
  --wp-nav-float-height: 60px;
  --wp-nav-float-gap: 14px;
  --wp-nav-float-offset: calc(var(--wp-nav-float-height) + var(--wp-nav-float-gap) * 2);
  --section-intro: #90a4ae;
  --section-verse: #4dd0e1;
  --section-pre-chorus: #ffd54f;
  --section-chorus: #ffb74d;
  --section-bridge: #9575cd;
  --section-tag: #f06292;
  --section-outro: #e57373;
  --section-other: #9e9e9e;
  /* Layout — igual que SectionScaffold Flutter: padding 16px; en pantallas anchas ~95% */
  --wp-content-width: 95%;
  --wp-content-pad-x: 16px;
  --wp-content-pad-bottom: 28px;
}

html[data-theme="light"] {
  color-scheme: light;
  --wp-bg: #eeeeee;
  --wp-surface: #ffffff;
  --wp-surface-container: #e0e0e0;
  --wp-text: #000000;
  --wp-muted: #757575;
  --wp-border: #e0e0e0;
  --wp-appbar-bg: #eeeeee;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --wp-bg: #080808;
  --wp-surface: #1e1e1e;
  --wp-surface-container: #2d2d2d;
  --wp-text: #ffffff;
  --wp-muted: #b0b0b0;
  --wp-on-surface-variant: #b0b0b0;
  --wp-border: #232323;
  --wp-outline: #2d2d2d;
  --wp-zebra: #141414;
  --wp-primary-container: #5c4300;
  --wp-on-primary-container: #ffe082;
  --wp-appbar-bg: #080808;
  --wp-secondary-container: #0e4a74;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --wp-bg: #080808;
    --wp-surface: #1e1e1e;
    --wp-surface-container: #2d2d2d;
    --wp-text: #ffffff;
    --wp-muted: #b0b0b0;
    --wp-on-surface-variant: #b0b0b0;
    --wp-border: #232323;
    --wp-outline: #2d2d2d;
    --wp-zebra: #141414;
    --wp-primary-container: #5c4300;
    --wp-on-primary-container: #ffe082;
    --wp-appbar-bg: #080808;
    --wp-secondary-container: #0e4a74;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  background: var(--wp-bg);
  color: var(--wp-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--wp-primary-strong);
}

button,
input,
select,
textarea {
  font: inherit;
}

#app-root {
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#wp-main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: calc(var(--wp-nav-float-offset) + env(safe-area-inset-bottom, 0px));
}

#wp-main.is-auth-screen {
  padding-bottom: 0;
}

/* ── Top bar (AppTopBar: 76px, fondo #EEE) ── */
#wp-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  width: 100%;
  background: var(--wp-appbar-bg);
  flex-shrink: 0;
}

#wp-topbar[hidden] {
  display: none !important;
}

.wp-topbar-inner {
  width: 100%;
  min-height: var(--wp-topbar-height);
  padding: 0 8px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wp-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
  padding-right: 12px;
}

.wp-icon-btn {
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  color: var(--wp-text);
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}

.wp-icon-btn:hover {
  background: color-mix(in srgb, var(--wp-surface-container) 60%, transparent);
}

.wp-icon-btn svg {
  width: 24px;
  height: 24px;
}

.wp-offline-banner {
  background: #fff3e0;
  color: #e65100;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 1px solid #ffcc80;
  flex-shrink: 0;
}

html[data-theme="dark"] .wp-offline-banner {
  background: color-mix(in srgb, #e65100 22%, var(--wp-surface));
  color: #ffb74d;
  border-bottom-color: color-mix(in srgb, #e65100 35%, var(--wp-border));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wp-offline-banner {
    background: color-mix(in srgb, #e65100 22%, var(--wp-surface));
    color: #ffb74d;
    border-bottom-color: color-mix(in srgb, #e65100 35%, var(--wp-border));
  }
}

.wp-offline-banner[hidden] {
  display: none !important;
}

/* ── Navegación flotante estilo Pinterest (siempre abajo) ── */
#wp-nav {
  position: fixed;
  left: 50%;
  bottom: calc(var(--wp-nav-float-gap) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 30;
  width: min(calc(100% - 20px), 480px);
  pointer-events: none;
}

#wp-nav[hidden] {
  display: none !important;
}

.wp-nav-dock {
  pointer-events: auto;
  background: var(--wp-surface);
  border: 1px solid var(--wp-border);
  border-radius: 999px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.12),
    0 2px 10px rgba(0, 0, 0, 0.06);
  padding: 6px 8px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.wp-nav-row {
  display: flex;
  align-items: center;
  min-height: var(--wp-nav-float-height);
}

.wp-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--wp-on-surface-variant);
  cursor: pointer;
  padding: 10px 4px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease;
  min-width: 0;
}

.wp-nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.wp-nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}

.wp-nav-item.is-active {
  color: var(--wp-primary-strong);
  background: var(--wp-primary-container);
  font-weight: 700;
}

.wp-nav-item:hover:not(.is-active) {
  background: color-mix(in srgb, var(--wp-primary-container) 35%, transparent);
}

@media (max-width: 719px) {
  .wp-nav-item span {
    display: none;
  }

  .wp-nav-item {
    padding: 12px 4px;
  }
}

.wp-skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--wp-primary);
  color: #111;
  padding: 8px 12px;
  border-radius: var(--wp-radius-btn);
  font-weight: 700;
  text-decoration: none;
}

.wp-skip-link:focus {
  left: 8px;
}

.wp-noscript {
  padding-top: 24px;
}

/* ── Páginas (SectionScaffold: padding 16, ancho fluido como Flutter) ── */
.wp-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--wp-content-pad-x) var(--wp-content-pad-x) var(--wp-content-pad-bottom);
  box-sizing: border-box;
}

@media (min-width: 720px) {
  .wp-page {
    width: var(--wp-content-width);
    margin-inline: auto;
  }
}

.wp-section-head {
  margin-bottom: 24px;
}

.wp-eyebrow {
  margin: 0 0 6px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wp-muted);
}

.wp-title {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
}

.wp-description {
  margin: 0;
  font-size: 1rem;
  color: var(--wp-muted);
}

/* CardTheme: radius 24, border, sin sombra */
.wp-card {
  background: var(--wp-surface);
  border: 1px solid var(--wp-border);
  border-radius: var(--wp-radius-card);
  padding: 16px;
  box-shadow: none;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

a.wp-card,
.wp-card[href],
.wp-card[role="link"],
.wp-card[role="button"],
.wp-card.is-interactive {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

a.wp-card:hover,
.wp-card[href]:hover,
.wp-card[role="link"]:hover,
.wp-card[role="button"]:hover,
.wp-card.is-interactive:hover {
  border-color: color-mix(in srgb, var(--wp-primary) 45%, var(--wp-border));
  background: color-mix(in srgb, var(--wp-primary) 6%, var(--wp-surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--wp-primary) 18%, transparent);
}

a.wp-card:focus-visible,
.wp-card[href]:focus-visible,
.wp-card[role="link"]:focus-visible,
.wp-card[role="button"]:focus-visible,
.wp-card.is-interactive:focus-visible {
  outline: 2px solid var(--wp-primary);
  outline-offset: 2px;
}

/* Formularios secundarios (auth, editar) */
.wp-mono-section form,
form.wp-mono-section {
  padding: 16px;
}

.wp-card + .wp-card {
  margin-top: 16px;
}

.wp-list {
  display: flex;
  flex-direction: column;
}

.wp-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--wp-border);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}

.wp-list-item:last-child {
  border-bottom: none;
}

.wp-list-item:hover {
  background: var(--wp-zebra);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: var(--wp-radius-section);
}

.wp-list-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--wp-primary-container) 55%, var(--wp-surface));
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.wp-list-body {
  flex: 1;
  min-width: 0;
}

.wp-list-title {
  font-weight: 700;
  margin: 0;
  font-size: 1rem;
}

.wp-list-sub {
  margin: 2px 0 0;
  color: var(--wp-muted);
  font-size: 0.875rem;
}

.wp-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--wp-muted);
}

/* Interactive controls — hover / focus for desktop a11y */
.wp-btn,
button:not(:disabled),
[role="button"]:not([aria-disabled="true"]),
.wp-chip,
.wp-icon-btn {
  cursor: pointer;
}

.wp-btn,
button {
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease,
    color 0.12s ease;
}

.wp-btn:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--wp-primary);
  outline-offset: 2px;
}

.wp-btn:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* FilledButton / OutlinedButton */
.wp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--wp-radius-btn);
  padding: 16px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
}

.wp-btn:hover:not(:disabled) {
  filter: brightness(0.96);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--wp-text) 8%, transparent);
}

.wp-btn:active:not(:disabled) {
  filter: brightness(0.92);
}

.wp-btn-primary {
  background: var(--wp-primary);
  color: #000;
}

.wp-btn-primary:hover:not(:disabled) {
  filter: brightness(1.04);
}

.wp-btn-secondary {
  background: var(--wp-surface);
  border: 1px solid var(--wp-border);
  color: var(--wp-text);
}

.wp-btn-secondary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--wp-surface) 88%, var(--wp-text));
  filter: none;
}

.wp-btn-block {
  width: 100%;
}

.wp-field {
  margin-bottom: 16px;
}

.wp-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.wp-field input,
.wp-field textarea,
.wp-field select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--wp-border);
  border-radius: var(--wp-radius-input);
  background: var(--wp-surface);
}

.wp-field input:focus,
.wp-field textarea:focus,
.wp-field select:focus {
  outline: none;
  border-color: var(--wp-primary);
  border-width: 1.4px;
}

.wp-auth-frame {
  max-width: 420px;
  margin: 40px auto;
  padding: 24px 16px;
}

.wp-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--wp-muted, #6b7280);
  font-size: 0.85rem;
}

.wp-auth-divider::before,
.wp-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, currentColor 35%, transparent);
}

.wp-auth-divider span {
  flex-shrink: 0;
}

.wp-error {
  color: var(--wp-error);
  font-size: 0.9rem;
  margin: 12px 0;
}

.wp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.wp-search {
  flex: 1;
  min-width: 200px;
}

.wp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--wp-radius-btn);
  background: color-mix(in srgb, var(--wp-primary-container) 55%, var(--wp-surface));
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--wp-text);
}

.wp-chip.is-active {
  background: var(--wp-primary-container);
}

.wp-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  gap: 12px;
  color: var(--wp-muted);
}

.wp-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--wp-border);
  border-top-color: var(--wp-primary);
  border-radius: 50%;
  animation: wp-spin 0.8s linear infinite;
}

@keyframes wp-spin {
  to {
    transform: rotate(360deg);
  }
}
