/* Bloom Launch Polish v1 — design system, motion, states, mobile, a11y */

:root {
  --bloom-radius-sm: 10px;
  --bloom-radius-md: 14px;
  --bloom-radius-lg: 18px;
  --bloom-radius-xl: 22px;
  --bloom-shadow-soft: 0 8px 26px #5b23400d;
  --bloom-shadow-lift: 0 14px 40px #5b234018;
  --bloom-space-1: 6px;
  --bloom-space-2: 10px;
  --bloom-space-3: 14px;
  --bloom-space-4: 18px;
  --bloom-space-5: 24px;
  --bloom-brand: var(--brand-primary, #a72f67);
  --bloom-brand-deep: #7e214e;
  --bloom-surface: #ffffff;
  --bloom-border: #eadde5;
  --bloom-text-muted: #7e707a;
  --bloom-focus: #a72f67;
  --bloom-motion-fast: 0.16s;
  --bloom-motion-med: 0.22s;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.primary, .secondary, aside button, .lily-fab, .lily-send {
  transition: transform var(--bloom-motion-fast) ease, box-shadow var(--bloom-motion-fast) ease, background var(--bloom-motion-fast) ease;
}
.primary:active, .secondary:active, aside button:active {
  transform: scale(0.98);
}
.primary:focus-visible, .secondary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--bloom-focus);
  outline-offset: 2px;
}

.card, .panel, .product-card, .kpi-card, .stats article {
  transition: transform var(--bloom-motion-fast) ease, box-shadow var(--bloom-motion-fast) ease;
}
.card:hover, .product-card:hover, .kpi-card:hover {
  box-shadow: var(--bloom-shadow-lift);
}
@media (hover: hover) {
  .product-card:hover { transform: translateY(-2px); }
}

dialog {
  animation: bloomDialogIn var(--bloom-motion-med) ease;
}
dialog::backdrop {
  animation: bloomFadeIn var(--bloom-motion-med) ease;
}
@keyframes bloomDialogIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes bloomFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page {
  animation: bloomPageIn var(--bloom-motion-med) ease;
}
.page.bloom-page-exit {
  opacity: 0.6;
  pointer-events: none;
}
@keyframes bloomPageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.bloom-empty-state, .bloom-error-state {
  text-align: center;
  padding: var(--bloom-space-5);
  border: 1px dashed var(--bloom-border);
  border-radius: var(--bloom-radius-lg);
  background: linear-gradient(145deg, #fff, #faf6f8);
  color: #4b3c47;
}
.bloom-empty-state strong, .bloom-error-state strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 1.15rem;
  margin: 8px 0 6px;
}
.bloom-empty-state p, .bloom-error-state p {
  margin: 0 0 12px;
  color: var(--bloom-text-muted);
  max-width: 36ch;
  margin-inline: auto;
}
.bloom-empty-icon {
  font-size: 2rem;
  display: block;
}
.bloom-error-state {
  border-color: #e8c4a8;
  background: linear-gradient(145deg, #fffaf5, #fff);
}

.bloom-skeleton-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.bloom-skeleton-card, .bloom-skeleton-row {
  border-radius: var(--bloom-radius-lg);
  background: linear-gradient(90deg, #f3ecef 0%, #faf6f8 40%, #f3ecef 80%);
  background-size: 200% 100%;
  animation: bloomShimmer 1.1s ease-in-out infinite;
  min-height: 120px;
}
.bloom-skeleton-row { min-height: 52px; margin-bottom: 8px; }
@keyframes bloomShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.bloom-page-help {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: -8px 0 16px;
  padding: 12px 14px;
  border-radius: var(--bloom-radius-md);
  background: #faf6f8;
  border: 1px solid var(--bloom-border);
}
.bloom-page-help p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--bloom-text-muted);
  max-width: 62ch;
}
.bloom-page-help-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.bloom-page-help-actions button, .bloom-page-help-actions a {
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.bloom-onboarding-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--bloom-radius-lg);
  background: linear-gradient(135deg, #fff 0%, #f7e5ee 70%);
  border: 1px solid var(--bloom-border);
}
.bloom-onboarding-banner progress {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  accent-color: var(--bloom-brand);
}
.bloom-onboarding-steps {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.bloom-onboarding-steps label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin: 0;
}
.bloom-onboarding-steps input { width: auto; }

.bloom-toast-success::before {
  content: "✓ ";
  font-weight: 900;
}

.bloom-product-gallery-thumb {
  position: relative;
  cursor: zoom-in;
  border: 0;
  padding: 0;
  background: transparent;
  width: 100%;
  display: block;
}
.bloom-product-gallery-thumb img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--bloom-radius-md) var(--bloom-radius-md) 0 0;
}
.bloom-gallery-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: #30232dcc;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
}

.bloom-gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: #1a1218ee;
  display: grid;
  grid-template-rows: auto 1fr auto;
  animation: bloomFadeIn var(--bloom-motion-med) ease;
}
.bloom-gallery-overlay[hidden] { display: none !important; }
.bloom-gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  color: #fff;
}
.bloom-gallery-stage {
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}
.bloom-gallery-stage img {
  max-width: min(96vw, 1200px);
  max-height: 72vh;
  object-fit: contain;
  transition: transform var(--bloom-motion-med) ease;
  user-select: none;
}
.bloom-gallery-stage img.zoomed {
  transform: scale(1.75);
  cursor: zoom-out;
}
.bloom-gallery-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 14px;
}
.bloom-gallery-nav button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid #ffffff44;
  background: #ffffff18;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

dialog form label { margin-bottom: var(--bloom-space-3); }
dialog .actions button { min-height: 44px; min-width: 44px; }

@media (max-width: 760px) {
  .heading h1, h1 { font-size: 1.65rem; }
  .primary, .secondary { min-height: 44px; padding: 12px 16px; }
  .card-actions button { flex: 1 1 calc(50% - 8px); min-height: 44px; }
  .report-row { font-size: 13px; }
  dialog { width: 100%; max-width: none; margin: 0; border-radius: 18px 18px 0 0; align-self: end; }
  .bloom-page-help { margin-bottom: 12px; }
  .bloom-onboarding-banner { flex-direction: column; align-items: stretch; }
  .lily-panel { bottom: calc(78px + env(safe-area-inset-bottom, 0)); }
  .lily-fab { bottom: calc(16px + env(safe-area-inset-bottom, 0)); }
}

.bloom-network-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 11000;
  background: #9a5d00;
  color: #fff;
  text-align: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}
.bloom-network-banner[hidden] { display: none !important; }

.bloom-skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 13000;
  background: #fff;
  color: #30232d;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 800;
  box-shadow: var(--bloom-shadow-lift);
}
.bloom-skip-link:focus {
  left: 12px;
}
