/* Alpha Labs — admin, chat, toasts, preloader, motion. */

/* Admin */

.admin-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  visibility: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s var(--ease);
}

.admin-panel.is-open {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.admin-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--primary);
  color: var(--cream);
}

.admin-panel__brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.admin-panel__brand div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
}

.admin-panel__brand span {
  color: rgba(250, 245, 243, 0.5);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.admin-panel__brand strong {
  color: var(--cream);
  font-size: 17px;
  font-weight: 600;
}

.admin-panel__head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-panel__head .icon-button {
  color: var(--cream);
}

.admin-panel__head .icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--cream);
}

.admin-panel__head .btn--ghost {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--cream);
}

.admin-panel__head .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.admin-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 0 24px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar {
  display: none;
}

.admin-tabs button {
  position: relative;
  flex: none;
  padding: 16px 18px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.admin-tabs button::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.25s var(--ease);
}

.admin-tabs button[aria-selected="true"] {
  color: var(--primary);
}

.admin-tabs button[aria-selected="true"]::after {
  transform: scaleX(1);
}

.admin-tabs button:hover {
  color: var(--accent);
}

.admin-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.admin-view {
  max-width: 1180px;
  margin: 0 auto;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.admin-product-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-product {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 13px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.admin-product__thumb {
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--cream);
}

.admin-product__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-product__main {
  min-width: 0;
}

.admin-product__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.admin-product__head strong {
  display: block;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.admin-product__head span {
  color: var(--muted);
  font-size: 10px;
}

.admin-product__fields {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.7fr;
  gap: 8px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.admin-field label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-field input,
.admin-field select {
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--cream);
  color: var(--primary);
  font-size: 12px;
  outline: none;
}

.admin-field input:focus,
.admin-field select:focus {
  border-color: var(--accent);
  background: var(--white);
}

.admin-product__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
}

.admin-product__actions span {
  color: var(--muted);
  font-size: 10px;
}

.admin-delete {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 0;
  border-radius: 5px;
  background: rgba(138, 31, 22, 0.08);
  color: var(--danger);
  font-size: 10px;
  font-weight: 600;
}

.admin-delete:hover {
  background: var(--danger);
  color: var(--white);
}

.admin-delete .icon {
  width: 12px;
  height: 12px;
}

.admin-card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-card {
  position: relative;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.admin-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.admin-card__top strong {
  display: block;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.admin-card__top span {
  color: var(--muted);
  font-size: 10px;
}

.admin-card__meta {
  display: grid;
  gap: 4px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
}

.admin-card__meta b {
  color: var(--primary);
  font-weight: 600;
}

.admin-card__badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 99px;
  background: rgba(153, 0, 0, 0.08);
  color: var(--accent);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.admin-card__actions .btn {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 10px;
  border-radius: 5px;
}

.admin-card__actions .icon {
  width: 12px;
  height: 12px;
}

.admin-card__items {
  margin: 7px 0;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.admin-empty {
  grid-column: 1 / -1;
  padding: 60px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}

.admin-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 18px;
}

/* Chat */

.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 180;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 18px;
  border: 0;
  border-radius: 99px;
  background: var(--primary);
  color: var(--cream);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(41, 8, 4, 0.3);
  transition: transform 0.28s var(--ease), background 0.28s ease;
}

.chat-launcher .icon {
  width: 18px;
  height: 18px;
  color: var(--accent-light);
}

.chat-launcher:hover {
  transform: translateY(-3px);
  background: var(--accent);
}

.chat-window {
  position: fixed;
  right: 22px;
  bottom: 82px;
  z-index: 190;
  display: flex;
  flex-direction: column;
  width: min(calc(100% - 32px), 382px);
  height: min(72vh, 570px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-lg);
  visibility: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.28s var(--ease);
}

.chat-window.is-open {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.chat-window__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--primary);
  color: var(--cream);
}

.chat-window__head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-window__avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
}

.chat-window__avatar .icon {
  width: 19px;
  height: 19px;
}

.chat-window__head strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.chat-window__head span:not(.chat-window__avatar) {
  display: block;
  margin-top: 2px;
  color: rgba(250, 245, 243, 0.5);
  font-size: 10px;
}

.chat-window__head .icon-button {
  color: var(--cream);
}

.chat-window__head .icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--cream);
}

.chat-window__messages {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 9px;
  overflow-y: auto;
  padding: 16px;
  background: var(--cream);
}

.chat-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.55;
}

.chat-bubble--bot {
  align-self: flex-start;
  border-bottom-left-radius: 3px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(41, 8, 4, 0.04);
}

.chat-bubble--user {
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  background: var(--primary);
  color: var(--cream);
}

.chat-bubble a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-bubble .chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.chat-bubble .chat-actions button {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--white);
  color: var(--primary);
  font-size: 10px;
  font-weight: 600;
}

.chat-bubble .chat-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.chat-prompts button {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--text);
  font-size: 10px;
}

.chat-prompts button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 11px 13px;
}

.chat-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-dot 1.2s infinite ease-in-out;
}

.chat-typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.chat-window__input {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--white);
}

.chat-window__input input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--cream);
  font-size: 12px;
  outline: none;
}

.chat-window__input input:focus {
  border-color: var(--accent);
  background: var(--white);
}

.chat-window__input button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: var(--white);
}

.chat-window__input button:hover {
  background: var(--accent-dark);
}

.chat-window__input .icon {
  width: 16px;
  height: 16px;
}

.chat-window__human {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  font-size: 10px;
}

.chat-window__human:hover {
  color: var(--accent);
}

.chat-window__human .icon {
  width: 13px;
  height: 13px;
}

/* Toasts */

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 330;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(calc(100% - 32px), 430px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  padding: 11px 15px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  background: var(--primary);
  color: var(--cream);
  box-shadow: 0 16px 34px rgba(41, 8, 4, 0.26);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: auto;
  animation: toast-in 0.28s var(--ease);
}

.toast.is-leaving {
  animation: toast-out 0.25s ease forwards;
}

.toast--success .toast__dot {
  background: #68c18c;
}

.toast--error .toast__dot {
  background: var(--accent-light);
}

.toast__dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-light);
}

.toast__action {
  margin-left: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Preloader */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--cream);
  animation: preloader-out 0.2s ease 0.5s forwards;
}

.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

@keyframes preloader-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.preloader__logo {
  display: block;
  width: min(56vw, 220px);
  height: auto;
  animation: preloader-logo-in 0.3s var(--ease) both;
}

.preloader__bar {
  display: block;
  width: 132px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(153, 0, 0, 0.14);
}

.preloader__bar i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: preloader-bar 0.9s ease-in-out infinite;
}

@keyframes preloader-logo-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes preloader-bar {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(360%);
  }
}

@media (max-width: 640px) {
  .preloader__logo {
    width: min(62vw, 180px);
  }
}

/* Scroll reveals */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease var(--delay, 0ms), transform 0.7s var(--ease) var(--delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .hero__media,
  .deal-slide:hover .deal-slide__media img,
  .product-card:hover .product-media img {
    transform: none;
  }
}


body:has(.drawer-shell.is-open) .toast-stack {
  bottom: 280px;
}
