/* AP5 · Sistema visual premium unificado Leveling */
:root {
  --lvl-ink: #12110e;
  --lvl-ink-soft: #272219;
  --lvl-paper: #fbfaf6;
  --lvl-paper-soft: #f3eee4;
  --lvl-gold: #c99537;
  --lvl-gold-bright: #efca78;
  --lvl-gold-pale: #f7e5b9;
  --lvl-text: #211d17;
  --lvl-text-secondary: #5f594f;
  --lvl-text-muted: #716a60;
  --lvl-line: rgba(105,76,29,.17);
  --lvl-line-strong: rgba(168,119,39,.38);
  --lvl-danger: #8f372e;
  --lvl-danger-bg: #f9e9e6;
  --lvl-success: #2e6f45;
  --lvl-success-bg: #e7f2e9;
  --lvl-warning: #7c581a;
  --lvl-warning-bg: #f7edda;
  --lvl-info: #385c75;
  --lvl-info-bg: #e8f0f4;
  --lvl-radius-control: 12px;
  --lvl-radius-card: 19px;
  --lvl-radius-dialog: 24px;
  --lvl-shadow-card: 0 18px 45px rgba(45,32,12,.09), inset 0 1px rgba(255,255,255,.82);
  --lvl-shadow-dialog: 0 34px 100px rgba(8,7,5,.4);
  --lvl-focus: rgba(203,148,54,.62);
  --lvl-ease: cubic-bezier(.16,1,.3,1);
}

:where(.admin-page,.barber-portal,.shop-page,.club-page,.booking-app,.customer-booking-page,.staff-login-page) {
  color: var(--lvl-text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:where(.admin-page,.barber-portal,.shop-page,.club-page,.booking-app,.customer-booking-page,.staff-login-page)
  :where(a,button,input,select,textarea,summary,[tabindex]):focus-visible {
  outline: 3px solid var(--lvl-focus) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 5px rgba(201,149,55,.1) !important;
}

:where(.admin-page,.barber-portal,.shop-page,.club-page,.booking-app,.customer-booking-page,.staff-login-page)
  :where(button,a,input,select,textarea) {
  -webkit-tap-highlight-color: rgba(201,149,55,.16);
}

:where(
  .wizard-next,.wizard-back,.booking-retry-button,
  .shop-checkout button,.product-add > button,.checkout-button,.shop-empty button,.shop-catalogue-error button,
  .club-submit,.club-compare-trigger,.club-plan-card > button,.club-checkout-closed button,
  .admin-main form button,.admin-command-tools button,.admin-mobile-action-grid button,
  .barber-booking-actions button,.barber-agenda-sync button,.barber-filter button,
  .customer-booking-card button,.staff-login-submit
) {
  min-height: 44px !important;
  font-size: 14px !important;
  line-height: 1.2;
}

:where(
  .booking-form,.waitlist-invite form,.shop-checkout,.club-contract-form,
  .quick-agenda-dialog,.booking-editor-dialog,.customer-crm-dialog,.customer-delete-dialog,
  .membership-action-dialog,.automation-modal,.staff-login-card,.customer-booking-card
) :where(input,select,textarea) {
  min-height: 44px !important;
  border-radius: var(--lvl-radius-control) !important;
  color: var(--lvl-text) !important;
  font-size: 14px !important;
  line-height: 1.45;
}

:where(
  .booking-form,.waitlist-invite form,.shop-checkout,.club-contract-form,
  .quick-agenda-dialog,.booking-editor-dialog,.customer-crm-dialog,.customer-delete-dialog,
  .membership-action-dialog,.automation-modal,.staff-login-card,.customer-booking-card
) :where(input,select,textarea)::placeholder { color: #797268 !important; opacity: 1; }

:where(
  .booking-calendar-card,.booking-times-card,.booking-available-barbers,
  .product-grid > article,.shop-cart,.shop-assurances > span,
  .club-plan-card,.club-comparison,.club-checkout,.club-how article,
  .admin-stats article,.operations-kpi-grid article,.operations-panel,.operations-alerts-panel,
  .barber-portal-stats article,.barber-bookings article,.schedule-days article
) {
  border-radius: var(--lvl-radius-card);
  box-shadow: var(--lvl-shadow-card);
}

/* Mensajes compartidos */
.lvl-feedback {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--lvl-line);
  border-left-width: 3px;
  border-radius: 15px;
  background: var(--lvl-paper-soft);
  box-shadow: 0 10px 26px rgba(42,30,12,.06), inset 0 1px rgba(255,255,255,.82);
}
.lvl-feedback.is-compact { grid-template-columns: 36px minmax(0,1fr) auto; padding: 11px 13px; }
.lvl-feedback-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--lvl-ink); color: var(--lvl-gold-bright); font: 700 17px/1 Georgia,serif; }
.lvl-feedback.is-compact .lvl-feedback-icon { width: 34px; height: 34px; }
.lvl-feedback-copy { display: grid; gap: 4px; min-width: 0; }
.lvl-feedback-copy > strong { color: var(--lvl-text); font-family: Georgia,"Times New Roman",serif; font-size: 18px; font-weight: 400; }
.lvl-feedback-copy > div { color: var(--lvl-text-secondary); font-size: 12px; line-height: 1.55; }
.lvl-feedback-copy p { margin: 0; color: inherit; font-size: inherit; }
.lvl-feedback-action { display: flex; align-items: center; gap: 8px; }
.lvl-feedback-action :where(button,a) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 15px; border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; font-size: 14px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.lvl-feedback[data-tone="error"] { border-color: rgba(143,55,46,.25); border-left-color: var(--lvl-danger); background: var(--lvl-danger-bg); color: var(--lvl-danger); }
.lvl-feedback[data-tone="error"] .lvl-feedback-icon { background: var(--lvl-danger); color: #fff; }
.lvl-feedback[data-tone="warning"] { border-color: rgba(124,88,26,.25); border-left-color: var(--lvl-warning); background: var(--lvl-warning-bg); color: var(--lvl-warning); }
.lvl-feedback[data-tone="success"] { border-color: rgba(46,111,69,.23); border-left-color: var(--lvl-success); background: var(--lvl-success-bg); color: var(--lvl-success); }
.lvl-feedback[data-tone="success"] .lvl-feedback-icon { background: var(--lvl-success); color: #fff; }
.lvl-feedback[data-tone="info"] { border-color: rgba(56,92,117,.22); border-left-color: var(--lvl-info); background: var(--lvl-info-bg); color: var(--lvl-info); }

.lvl-empty-state {
  display: grid;
  justify-items: center;
  place-content: center;
  gap: 8px;
  min-height: 220px;
  padding: 34px 22px;
  border: 1px dashed var(--lvl-line-strong);
  border-radius: var(--lvl-radius-card);
  background: linear-gradient(145deg,rgba(255,255,255,.84),rgba(244,238,226,.72));
  text-align: center;
}
.lvl-empty-state.is-compact { min-height: 150px; padding: 22px 18px; }
.lvl-empty-state > span { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--lvl-line-strong); border-radius: 50%; background: var(--lvl-ink); color: var(--lvl-gold-bright); font: 400 19px/1 Georgia,serif; }
.lvl-empty-state > strong { color: var(--lvl-text); font-family: Georgia,"Times New Roman",serif; font-size: 20px; font-weight: 400; }
.lvl-empty-state > div:not(.lvl-empty-action) { max-width: 440px; color: var(--lvl-text-secondary); font-size: 12px; line-height: 1.55; }
.lvl-empty-state p { margin: 0; font-size: inherit; }
.lvl-empty-action { margin-top: 3px; }
.lvl-empty-action :where(button,a) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--lvl-ink); border-radius: 999px; background: var(--lvl-ink); color: var(--lvl-gold-bright); cursor: pointer; font-size: 14px; font-weight: 800; text-decoration: none; }

:where(.admin-error,.wizard-error,.shop-error,.club-form-error,.staff-login-error,.customer-booking-error,.member-renewal-error) {
  min-height: 44px;
  padding: 12px 14px !important;
  border: 1px solid rgba(143,55,46,.24) !important;
  border-left: 3px solid var(--lvl-danger) !important;
  border-radius: 12px !important;
  background: var(--lvl-danger-bg) !important;
  color: #762b24 !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}
:where(.admin-notice,.shop-success,.booking-email-confirmed) {
  min-height: 44px;
  padding: 12px 14px !important;
  border: 1px solid rgba(46,111,69,.22) !important;
  border-left: 3px solid var(--lvl-success) !important;
  border-radius: 12px !important;
  background: var(--lvl-success-bg) !important;
  color: #245c39 !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}

.staff-shortcut-tip {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid var(--lvl-line);
  border-radius: 12px;
  background: var(--lvl-paper-soft);
}
.staff-shortcut-tip strong { color: var(--lvl-text) !important; font-size: 12px !important; }
.staff-shortcut-tip span { color: var(--lvl-text-secondary) !important; font-size: 12px !important; line-height: 1.55 !important; }

:where(.admin-empty,.customer-empty,.promotion-empty,.operations-empty,.shop-empty,.club-empty) {
  color: var(--lvl-text-secondary) !important;
  font-size: 12px !important;
  line-height: 1.55 !important;
}
:where(.admin-empty,.customer-empty,.promotion-empty,.operations-empty,.shop-empty,.club-empty) :where(p,span,small) {
  color: var(--lvl-text-secondary) !important;
  font-size: 12px !important;
  line-height: 1.55 !important;
}

/* Club alterna superficies oscuras y claras: evita que la regla histórica
   de texto blanco reduzca el contraste en las secciones color marfil. */
.club-storefront .club-section-heading > p,
.club-page .club-how :where(li,li p),
.club-storefront .lvl-empty-state > div:not(.lvl-empty-action) {
  color: var(--lvl-text-secondary) !important;
}
.club-page .club-how li strong,
.club-storefront .lvl-empty-state > strong { color: var(--lvl-text) !important; }

/* Filtros compartidos */
:where(.barber-filter,.reminder-filters,.order-filters,.admin-notification-filters,.customer-toolbar > div,.shop-category-buttons) {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--lvl-line);
  border-radius: 14px;
  background: rgba(255,255,255,.7);
  scrollbar-width: thin;
}
:where(.barber-filter,.reminder-filters,.order-filters,.admin-notification-filters,.customer-toolbar > div,.shop-category-buttons) > button {
  flex: 0 0 auto;
  min-height: 44px !important;
  padding: 0 14px !important;
  border-radius: 10px !important;
  color: var(--lvl-text-secondary);
  font-size: 14px !important;
  font-weight: 750;
  white-space: nowrap;
}
:where(.barber-filter,.reminder-filters,.order-filters,.admin-notification-filters,.customer-toolbar > div,.shop-category-buttons) > button.active {
  border-color: var(--lvl-ink) !important;
  background: linear-gradient(145deg,var(--lvl-ink-soft),var(--lvl-ink)) !important;
  color: var(--lvl-gold-bright) !important;
  box-shadow: 0 7px 17px rgba(27,21,12,.15) !important;
}

/* Diálogos compartidos */
:where(.admin-module-dialog,.quick-agenda-dialog,.customer-crm-dialog,.customer-delete-dialog,.membership-action-dialog,.automation-modal,.gift-payment-modal,.product-modal > article) {
  border-radius: var(--lvl-radius-dialog) !important;
  box-shadow: var(--lvl-shadow-dialog) !important;
}
:where(.admin-module-dialog,.quick-agenda-dialog,.customer-crm-dialog,.customer-delete-dialog,.membership-action-dialog,.automation-modal,.gift-payment-modal,.product-modal > article)
  > header > button[aria-label] { min-width: 44px !important; width: 44px !important; min-height: 44px !important; height: 44px !important; }

/* Esqueletos y niveles de movimiento */
:where(.premium-panel-skeleton,.booking-choice-skeletons,.booking-slots-skeleton,.shop-product-skeletons,.operations-skeleton) { border-radius: var(--lvl-radius-card); }
html.leveling-motion-capable :where(.lvl-feedback,.lvl-empty-state) { animation: lvlSurfaceIn .42s var(--lvl-ease) both; }
@keyframes lvlSurfaceIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  :where(
    .booking-form,.waitlist-invite form,.shop-checkout,.club-contract-form,
    .quick-agenda-dialog,.booking-editor-dialog,.customer-crm-dialog,.customer-delete-dialog,
    .membership-action-dialog,.automation-modal,.staff-login-card,.customer-booking-card
  ) :where(input,select,textarea) { font-size: 16px !important; }
  .lvl-feedback { grid-template-columns: 38px minmax(0,1fr); padding: 13px; }
  .lvl-feedback-icon { width: 36px; height: 36px; }
  .lvl-feedback-action { grid-column: 1 / -1; width: 100%; }
  .lvl-feedback-action :where(button,a) { width: 100%; }
  .lvl-empty-state { min-height: 180px; padding: 27px 17px; }
  :where(.barber-filter,.reminder-filters,.order-filters,.admin-notification-filters,.customer-toolbar > div,.shop-category-buttons) { margin-inline: -2px; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; }
  html.leveling-motion-capable :where(.lvl-feedback,.lvl-empty-state) { animation: none !important; }
}

html.leveling-lite-mode :where(.lvl-feedback,.lvl-empty-state) { animation: none !important; box-shadow: none; }
html.leveling-lite-mode :where(.admin-module-dialog,.quick-agenda-dialog,.customer-crm-dialog,.customer-delete-dialog,.membership-action-dialog,.automation-modal,.gift-payment-modal,.product-modal > article) { box-shadow: 0 14px 35px rgba(8,7,5,.24) !important; }
