/* Layout principal: Barra Demo Comercial, Marcos Mobile 390px y Shell Escritorio 1440px */

.app-shell {
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
}

/* Barra superior de Modo Demo Comercial */
.demo-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  max-width: 100%;
  overflow-x: clip;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-bottom: 1px solid var(--sidebar-border);
  padding: 0.625rem 1rem;
  box-shadow: var(--shadow-sm);
}

.demo-bar[hidden] {
  display: none;
}

.demo-bar-inner {
  max-width: 1440px;
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem 1rem;
}

.demo-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.demo-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.demo-brand-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.demo-brand-sub {
  font-size: 0.75rem;
  color: var(--sidebar-muted);
  white-space: nowrap;
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
}

.demo-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  max-width: 100%;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.demo-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 32px;
  padding: 0.25rem 0.65rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.demo-pill-btn:hover {
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, 0.08);
}

.demo-pill-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
}

.theme-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.theme-swatch.editorial { background: #B87D5B; }
.theme-swatch.emerald { background: #0F766E; }
.theme-swatch.boutique { background: #C9A66B; }

.demo-screen-select {
  min-height: 34px;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--sidebar-surface);
  color: var(--sidebar-text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.demo-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.25rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.demo-action-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Botón flotante para reabrir la barra cuando está colapsada */
.demo-restore-fab {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 65;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.demo-restore-fab[hidden] {
  display: none;
}

/* Stage contenedor */
.stage-root {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* === Modo Celular (390px en escritorio, 100% en móvil) === */
.mobile-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 0.75rem 2.5rem;
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 45%),
    var(--bg-canvas);
}

.phone-frame {
  width: 100%;
  max-width: 390px;
  min-height: 760px;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 30px;
  box-shadow: var(--shadow-device);
  overflow: clip;
  position: relative;
}

.phone-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.phone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 15;
}

.phone-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.phone-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border: 1px solid var(--accent-soft-border);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.phone-brand-name {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phone-brand-loc {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.phone-scroll-body {
  flex: 1;
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.phone-sticky-summary {
  position: sticky;
  bottom: 58px;
  z-index: 14;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-strong);
  padding: 0.75rem 0.95rem;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.08);
}

.phone-bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 16;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 0.25rem 0.35rem calc(0.25rem + env(safe-area-inset-bottom, 0px));
}

.phone-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 50px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.phone-nav-btn[aria-current="page"] {
  color: var(--accent-text);
  background: var(--accent-soft);
}

.phone-nav-btn[aria-current="page"]::after {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: 22%;
  border-block-start: 2.5px solid var(--accent);
}

@media (max-width: 639px) {
  .mobile-stage {
    padding: 0;
  }

  .phone-frame {
    max-width: 100%;
    min-height: calc(100dvh - 54px);
    border-radius: 0;
    border-inline: 0;
    box-shadow: none;
  }

  .demo-brand-sub {
    display: none;
  }
}

/* === Modo Escritorio Salón (1440px fluido con Sidebar) === */
.desktop-stage {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  background: var(--bg-canvas);
  border-inline: 1px solid var(--border);
}

.admin-sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-inline-end: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.15rem 0.9rem;
  position: sticky;
  top: 52px;
  height: calc(100dvh - 52px);
  overflow-y: auto;
}

.demo-bar[hidden] ~ .stage-root .admin-sidebar {
  top: 0;
  height: 100dvh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.45rem 0.9rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--sidebar-surface);
  border: 1.5px solid var(--accent);
  color: var(--sidebar-text);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.sidebar-salon-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--sidebar-text);
}

.sidebar-salon-loc {
  font-size: 0.74rem;
  color: var(--sidebar-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.15rem;
}

.sidebar-status-box {
  margin: 0.75rem 0.15rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--sidebar-surface);
  border: 1px solid var(--sidebar-border);
  font-size: 0.73rem;
  color: var(--sidebar-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-status-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--sidebar-text);
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22);
  flex-shrink: 0;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  padding: 0.75rem 0.6rem 0.35rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 40px;
  padding: 0.48rem 0.65rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 0.83rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--sidebar-text);
}

.nav-item[aria-current="page"] {
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--accent);
  color: var(--sidebar-text);
  font-weight: 600;
}

.nav-item-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.nav-code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.nav-badge {
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--sidebar-text);
}

.sidebar-user-role {
  font-size: 0.74rem;
  color: var(--sidebar-muted);
}

.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 52px;
  z-index: 18;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.demo-bar[hidden] ~ .stage-root .admin-topbar {
  top: 0;
}

.admin-mobile-menu-btn {
  display: none;
}

.admin-content {
  padding: 1.25rem 1.4rem 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.admin-mobile-nav-strip {
  display: none;
}

@media (max-width: 1023px) {
  .desktop-stage {
    grid-template-columns: 1fr;
    border-inline: 0;
  }

  .admin-sidebar {
    display: none;
  }

  .admin-mobile-menu-btn {
    display: inline-flex;
  }

  .admin-mobile-nav-strip {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.55rem 1rem;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
  }

  .admin-mobile-nav-strip .nav-item {
    width: auto;
    flex-shrink: 0;
    min-height: 36px;
    padding: 0.35rem 0.65rem;
  }

  .admin-topbar {
    position: static;
    padding: 0.85rem 1rem;
  }

  .admin-content {
    padding: 1rem;
  }
}

@media (max-width: 640px) {
  .demo-bar {
    padding: 0.5rem 0.65rem;
  }

  .demo-brand-sub {
    display: none;
  }

  .demo-group {
    width: 100%;
  }

  .demo-pill-btn {
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
    white-space: normal;
    text-align: left;
  }

  .demo-screen-select {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
  }

  .mobile-stage {
    padding: 0.5rem 0.45rem 1.25rem;
  }

  .phone-frame {
    max-width: 100%;
    border-radius: 18px;
    min-height: 0;
  }
}
