@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src:
    local('Vazirmatn'),
    url('../fonts/Vazirmatn-regular.ttf') format('truetype');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+20AC;
}

:root {
  /* Light theme for main UI */
  --bg: #f3f4f6;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #d4af37;   /* gold accent (subtle) */
  --accent-2: #334155; /* slate (no green/orange) */
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.12);

  /* Buttons (glass / clean) */
  --btn-bg: rgba(255, 255, 255, 0.92);
  --btn-bg-hover: rgba(255, 255, 255, 0.98);
  --btn-border: rgba(15, 23, 42, 0.14);
  --btn-border-hover: rgba(15, 23, 42, 0.24);
  --btn-text: #111827;
  --btn-shadow: 0 10px 26px rgba(15, 23, 42, 0.10);
  --btn-shadow-hover: 0 14px 34px rgba(15, 23, 42, 0.14);
  --btn-disabled-bg: rgba(243, 244, 246, 0.9);
  --btn-disabled-border: rgba(148, 163, 184, 0.35);
  --btn-disabled-text: rgba(107, 114, 128, 0.95);
  --btn-blur: 10px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: 'Vazirmatn', 'Vazir', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}
button,
input,
textarea,
select {
  font-family: inherit;
}
body.no-scroll { overflow: hidden; }
body {
  --page-padding: clamp(14px, 2vw, 24px);
  --advisor-safe-extra: 0px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: var(--page-padding);
  padding-bottom: calc(var(--page-padding) + var(--advisor-safe-extra));
  position: relative;
}
body.advisor-active {
  --advisor-safe-extra: 130px;
}
header, main, .panel, .stage { width: 100%; box-sizing: border-box; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: clamp(18px, 2vw, 22px);
  min-width: 0;
}
.brand-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.brand-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
#brandMainTitle {
  line-height: 1.2;
}
.brand-shopline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-shop-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.brand-version {
  font-size: 12px;
  color: #ef4444;
  font-weight: 700;
  white-space: nowrap;
}
.brand-shop {
  font-weight: 800;
  font-size: 13px;
  color: rgba(15, 23, 42, 0.82);
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.45);
}
.tagline {
  color: #334155;
  font-size: 14px;
  margin: 0;
  text-align: start;
  width: 100%;
}
.safe-note {
  color: #334155;
  font-weight: 600;
}

.vip-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  font-size: 12px;
  font-weight: 700;
  color: #111827;
}
.vip-header-pill .vip-star {
  font-size: 14px;
}

@media (min-width: 768px) {
  .tagline {
    text-align: start;
    width: auto;
  }
}
.tryon-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.tryon-overlay.active {
  display: flex;
}
.tryon-overlay-box {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  max-width: 320px;
  width: 90%;
  text-align: center;
}
.tryon-overlay-text {
  margin: 0 0 12px;
  font-size: 14px;
}
.tryon-overlay-cancel {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid #ef4444;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
  cursor: pointer;
}
main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 0;
  position: relative;
  padding-bottom: 70px;
}
.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 14px;
  box-shadow: var(--shadow);
  min-height: 0;
}
.panel h2 {
  margin: 0 0 6px;
  font-size: 16px;
  letter-spacing: 0.02em;
}
.search-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 15;
  transition: transform 0.18s ease, opacity 0.18s ease;
  will-change: transform, opacity;
}
.search-header.search-header-hidden {
  transform: translateY(-100%);
  opacity: 0;
}
.search-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tab {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.tab.active {
  border-color: rgba(15, 23, 42, 0.22);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
}
.tab.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.search-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
.search-input-wrap {
  position: relative;
}
.search-input-wrap input,
.search-input-wrap textarea {
  padding-inline-end: 80px;
}
.search-loading {
  position: absolute;
  inset-inline-end: 56px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(156, 163, 175, 0.4);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  display: none;
  z-index: 2;
}
.search-loading.visible {
  display: inline-block;
}
.search-bar input,
.search-bar textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: var(--text);
  font-size: 14px;
  outline: none;
  resize: none;
}
.search-bar button,
.controls button,
.upload-group button,
#applySelf,
.profile-save-btn,
.loading-login-btn,
.logout-btn,
.modal-link,
.detail-btn,
.tryon-btn,
.primary,
.secondary,
#photoConsentConfirm,
.tryon-overlay-cancel,
.advisor-action-btn {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-text);
  box-shadow: var(--btn-shadow);
  backdrop-filter: blur(var(--btn-blur));
  -webkit-backdrop-filter: blur(var(--btn-blur));
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.search-bar button:hover,
.controls button:hover,
.upload-group button:hover,
#applySelf:hover,
.profile-save-btn:hover,
.loading-login-btn:hover,
.logout-btn:hover,
.modal-link:hover,
.detail-btn:hover,
.tryon-btn:hover,
.primary:hover,
.secondary:hover,
#photoConsentConfirm:hover,
.tryon-overlay-cancel:hover,
.advisor-action-btn:hover {
  background: var(--btn-bg-hover);
  border-color: var(--btn-border-hover);
  box-shadow: var(--btn-shadow-hover);
  transform: translateY(-1px);
}
.search-bar button:active,
.controls button:active,
.upload-group button:active,
#applySelf:active,
.profile-save-btn:active,
.loading-login-btn:active,
.logout-btn:active,
.modal-link:active,
.detail-btn:active,
.tryon-btn:active,
.primary:active,
.secondary:active,
#photoConsentConfirm:active,
.tryon-overlay-cancel:active,
.advisor-action-btn:active {
  transform: translateY(0);
}
button:disabled,
.profile-save-btn:disabled,
.loading-login-btn[aria-disabled="true"],
.tryon-btn.disabled,
.disabled,
.bottom-nav .nav-btn.nav-btn-disabled {
  background: var(--btn-disabled-bg) !important;
  border-color: var(--btn-disabled-border) !important;
  color: var(--btn-disabled-text) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.search-bar button {
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}
.search-clear {
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(156, 163, 175, 0.6);
  font-size: 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.products {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding-bottom: 10px;
  scrollbar-width: thin;
  min-height: 140px;
  align-items: stretch;
  max-width: 1280px;
  margin: 0 auto;
}
.products::-webkit-scrollbar { width: 6px; }
.products::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}
.products::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.20);
  border-radius: 999px;
}
.product-card {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.06);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 51, 102, 0.4);
}
.product-card.selected {
  border-color: rgba(79, 209, 197, 0.8);
  box-shadow: 0 0 0 2px rgba(79, 209, 197, 0.35);
}
.product-card img {
  width: 100%;
  height: 320px;
  object-fit: contain;
  border-radius: 10px;
  background: #e5e7eb;
}
.product-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 800;
  z-index: 2;
}
.price-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.price-old {
  color: #f87171;
  text-decoration: line-through;
  font-size: 13.5px;
}
.product-name {
  font-size: 14px;
  margin: 0;
  line-height: 1.4;
  color: var(--text);
  text-align: center;
}
.product-price {
  margin: 0;
  color: var(--accent-2);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
}
.product-color {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.product-color-inline {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
  position: relative;
}
.color-toggle {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
}
.color-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 4px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}
.color-menu[hidden] {
  display: none !important;
}
.color-option {
  padding: 4px 8px;
  border-radius: 8px;
  border: 0;
  background: #f9fafb;
  font-size: 11px;
  cursor: pointer;
  color: #374151;
  text-align: right;
}
.color-option:hover {
  background: rgba(212, 175, 55, 0.12);
}
.price-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.price-old {
  color: #f87171;
  text-decoration: line-through;
  font-size: 13.5px;
}
.product-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.detail-btn {
  background: #f9fafb;
  border: 1px solid #d1d5db;
  color: #374151;
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
}
.tryon-btn {
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.tryon-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.controls input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.controls input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 51, 102, 0.15);
}
.controls button {
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  min-width: 130px;
}
.controls button:hover { transform: translateY(-1px); }
.controls button:active { transform: translateY(0); }
.helper {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}
.try-options {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.try-options h3 {
  margin: 0;
  font-size: 15px;
}
.try-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.upload-group {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.style-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

.style-checkbox input {
  width: 14px;
  height: 14px;
}

#photoConsentModal .modal {
  max-width: 420px;
}

#photoConsentModal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#photoConsentModal .secondary {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #4b5563;
  font-size: 13px;
}

#photoConsentConfirm {
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.primary {
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
.upload-label {
  font-size: 13px;
  color: var(--muted);
}
.upload-input-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.upload-group button {
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}
.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.upload-actions button:nth-child(2) {
  background: var(--btn-bg);
}
.upload-actions button:nth-child(3) {
  background: var(--btn-bg);
  border-color: var(--btn-border);
}
.upload-group input[type="file"] {
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px;
  color: var(--text);
  cursor: pointer;
}
.apply-status {
  font-size: 13px;
  color: var(--muted);
}
.apply-status.loading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-left: 6px;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}
#applySelf {
  width: 100%;
  padding: 12px 16px;
  font-weight: 800;
  border-radius: 12px;
}
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.45);
}
.vendor-select {
  display: grid;
  grid-auto-flow: column;
  justify-content: end;
  align-items: center;
  column-gap: 8px;
  width: 100%;
  direction: ltr;
}
.vendor-select select {
  padding: 7px 28px 7px 10px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: var(--text);
  font-size: 13px;
  direction: rtl;
  text-align: right;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2l4 4 4-4' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.vendor-select-compact {
  margin-bottom: 6px;
}
.vendor-select-compact select {
  min-width: 140px;
}
.vendor-link {
  border: none;
  background: transparent;
  color: #111827;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0;
}
.profile-form {
  display: grid;
  gap: 10px;
}
.vip-status-badge {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(249, 250, 251, 0.9);
  border: 1px dashed rgba(156, 163, 175, 0.6);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.vip-status-badge::before {
  content: "★";
  font-size: 14px;
  color: rgba(156, 163, 175, 0.9);
}
.vip-status-badge.vip {
  background: rgba(255, 255, 255, 0.9);
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.16);
  color: #111827;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.10);
}
.vip-status-badge.vip::before {
  content: "★";
  color: #facc15;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.8);
}
.profile-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.profile-form input[type="text"],
.profile-form input[type="number"],
.profile-form input[type="file"],
.profile-form select {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: var(--text);
}
.profile-save-btn {
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}
.profile-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.preview-frame {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #f9fafb;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 320px;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: zoom-in;
}
.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.preview-frame.animated img {
  animation: previewFloat 8s ease-in-out infinite;
}
.zoom-icon {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: rgba(17, 24, 39, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--text);
  pointer-events: none;
  opacity: 0.9;
}
.preview-frame.expanded {
  position: fixed;
  inset: 5%;
  z-index: 30;
  max-height: 90vh;
  max-width: 90vw;
  min-height: 60vh;
  background: rgba(0, 0, 0, 0.9);
  cursor: zoom-out;
}
.preview-frame.expanded img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.profile-photo-preview {
  width: 100%;
  min-height: 260px;
  max-height: 520px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  background: #f9fafb;
}
.profile-photo-preview img {
  width: 100%;
  max-width: 420px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.tryon-panel {
  margin-top: 12px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 12px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  gap: 10px;
}
.tryon-panel.open {
  display: flex;
}
.advisor-input-wrapper {
  position: fixed;
  inset-inline: 0;
  bottom: 60px;
  display: none;
  justify-content: center;
  padding: 0 0 10px;
  z-index: 40;
  pointer-events: none;
}
.advisor-input-wrapper.visible {
  display: flex;
}
.advisor-input-inner {
  width: 100%;
  max-width: 640px;
  background: rgba(17,24,39,0.95);
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.7);
  box-shadow: 0 18px 55px rgba(15,23,42,0.9);
  padding: 8px 10px 8px;
  backdrop-filter: blur(16px);
  pointer-events: auto;
}
.advisor-input-top {
  margin-bottom: 6px;
}
.advisor-last-question {
  border-radius: 12px;
  background: rgba(15,23,42,0.9);
  border: 1px dashed rgba(148,163,184,0.6);
  padding: 6px 8px;
}
.advisor-last-label {
  display: inline-block;
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 2px;
}
.advisor-last-text {
  margin: 0;
  font-size: 13px;
  color: #e5e7eb;
  line-height: 1.5;
}
.advisor-input-row {
  display: block;
  margin-bottom: 8px;
}
.advisor-input-row textarea {
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.85);
  background: rgba(15,23,42,0.92);
  color: #e5e7eb;
  font-size: 13px;
  resize: none;
  outline: none;
  overflow: hidden;
  direction: rtl;
}
.advisor-input-row textarea::placeholder {
  color: rgba(156,163,175,0.8);
}
.advisor-send-btn,
.advisor-close-btn {
  border-radius: 999px;
}
.advisor-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 2px;
  direction: ltr;
}
.advisor-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.9);
  background: rgba(15,23,42,0.98);
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
}
.advisor-action-icon {
  font-size: 16px;
  line-height: 1;
}
.advisor-send-btn {
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.22);
}
.advisor-upload-btn {
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.22);
}
.advisor-attachment-status {
  font-size: 11px;
  color: #e5e7eb;
  opacity: 0.9;
  white-space: nowrap;
  direction: rtl;
  text-align: right;
}
.advisor-actions-buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}
.advisor-input-hint {
  display: none;
}

.nav-btn[data-action="advisor"] .nav-icon {
  opacity: 1;
}
.bottom-nav {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  display: none;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  padding: 6px 14px calc(8px + env(safe-area-inset-bottom));
  gap: 10px;
  z-index: 20;
}
.bottom-nav.nav-hidden { display: none !important; }
.bottom-nav.nav-visible { display: flex; }
.bottom-nav .nav-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}
.bottom-nav .nav-btn.active {
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  border-color: rgba(212, 175, 55, 0.85);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.22), 0 10px 26px rgba(15, 23, 42, 0.14);
}
.bottom-nav .nav-btn.nav-btn-disabled {
  opacity: 0.6;
}
.bottom-nav .nav-icon {
  font-size: 16px;
  display: inline-flex;
}
.bottom-nav .nav-label {
  font-size: 11px;
  white-space: nowrap;
}
.bottom-nav.locked .nav-btn {
  opacity: 0.5;
  pointer-events: none;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
}
.modal-overlay.active { display: flex; }
.modal {
  width: min(900px, 96vw);
  max-width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  position: relative;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.vip-only-modal {
  width: min(92vw, 440px);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 23, 42, 0.16);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 16px;
  gap: 10px;
}
.vip-only-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: #111827;
}
.vip-only-text {
  margin: 0;
  color: rgba(15, 23, 42, 0.78);
}
.vip-only-close {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
}
.auth-required-modal {
  width: min(92vw, 460px);
  background: rgba(255, 255, 255, 0.80);
  border: 1px solid rgba(15, 23, 42, 0.16);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 16px;
  gap: 10px;
}
.auth-required-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: #111827;
}
.auth-required-text {
  margin: 0;
  color: rgba(15, 23, 42, 0.78);
}
.auth-required-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}
.auth-required-close {
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
}
.auth-required-login-btn {
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 900;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(212, 175, 55, 1), rgba(255, 228, 150, 1));
  color: #0b1220;
  border: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow: 0 12px 26px rgba(212, 175, 55, 0.22);
  min-width: 140px;
}
.auth-required-login-btn:active { transform: scale(0.99); }
.auth-required-login-btn.disabled {
  opacity: 0.6;
  pointer-events: none;
}
.modal::-webkit-scrollbar {
  width: 6px;
}
.modal::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}
.modal::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.20);
  border-radius: 999px;
}
.modal-close {
  position: absolute;
  top: 8px;
  left: 8px;
  display: none;
}
.logout-btn {
  padding: 10px 16px;
  border-radius: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  position: relative;
}
.modal-gallery img {
  width: 100%;
  border-radius: 12px;
  background: #f3f4f6;
  object-fit: contain;
  max-height: 420px;
  margin: 0 auto;
}
.modal-zoom-toggle {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(17, 24, 39, 0.15);
  background: rgba(243, 244, 246, 0.9);
  color: #111827;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 15px;
  z-index: 3;
}
.modal-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  width: 100%;
  padding: 4px 0 6px;
}
.modal-thumbs img {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
}
.modal-thumbs img.active {
  border-color: var(--accent);
}
.modal-info h3 { margin: 0 0 6px; }
.modal-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-price {
  color: var(--accent-2);
  font-weight: 800;
  margin: 0 0 10px;
  min-height: 20px;
}
.modal-selected-color {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}
.modal-attrs {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}
.modal-attrs .attr {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.modal-attrs .attr strong { color: var(--text); }
.modal-colors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.color-chip {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: var(--text);
  cursor: pointer;
}
.color-chip.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.14);
}
.modal-link {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 800;
  align-self: center;
}
.loading-cover {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05050b;
  z-index: 30;
  color: #f4f6fb;
  transition: opacity 0.5s ease;
  padding: 18px;
}
.loading-box {
  width: min(92vw, 540px);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
  overflow: hidden;
}
.loading-hero {
  position: relative;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
}
.loading-hero img {
  width: 100%;
  border-radius: 14px;
  display: block;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  animation: heroPulse 3s ease-in-out infinite;
}
.loading-text {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.loading-title {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 16px;
}
.loading-desc {
  margin: 0;
  color: #cdd2e0;
  font-size: 14px;
}
.loader {
  width: 52px;
  height: 52px;
  margin: 12px auto 4px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.loading-login-btn {
  margin-top: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  color: #111827;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { opacity: 0; pointer-events: none; }
@keyframes heroPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); filter: brightness(0.9); }
  50% { opacity: 1; transform: scale(1.015); filter: brightness(1.05); }
}
@keyframes previewFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@media (max-width: 960px) {
  main { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Desktop-only: keep the whole UI centered with side whitespace */
@media (min-width: 1024px) {
  body {
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
  }
  .bottom-nav {
    inset-inline: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(1320px, calc(100% - (2 * var(--page-padding))));
    border-inline: 1px solid #e5e7eb;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
  }
}
@media (max-width: 640px) {
  body {
    padding: 10px 8px 14px;
    overflow-y: auto;
    align-items: center;
    max-width: 380px;
    margin: 0 auto;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
  }
  main {
    gap: 10px;
    width: 100%;
    max-width: 360px;
    justify-items: center;
    margin: 0 auto;
  }
  .stage {
    min-height: 240px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    }
  .model-frame {
    inset: 6px;
  }
  .panel {
    width: 100%;
    max-width: 360px;
    padding: 10px;
    gap: 8px;
    margin: 0 auto;
  }
  .vendor-select {
    justify-content: flex-end;
    gap: 6px;
  }
  .products {
    min-height: 180px;
    grid-template-columns: 1fr;
  }
  .product-card img { height: 280px; object-fit: contain; }
  .controls { grid-template-columns: 1fr; }
  .controls button { width: 100%; }
  .search-bar { grid-template-columns: 1fr; width: 100%; }
  .upload-group { grid-template-columns: 1fr; align-items: flex-start; }
  .upload-actions {
    justify-content: stretch;
    flex-direction: column;
  }
  .upload-actions button {
    width: 100%;
  }
  .tab { font-size: 13px; padding: 7px 10px; }
  .search-bar input, .search-bar button { min-height: 44px; }
  .try-buttons { grid-template-columns: 1fr; }
  .loading-cover, .loading-box { width: 100%; max-width: 520px; }
  .products { padding-left: 4px; padding-right: 4px; }
  .search-tabs { width: 100%; }
  .bottom-nav { display: none; }
  .bottom-nav.nav-visible { display: flex; }
  .preview-frame { min-height: 280px; max-height: 380px; }
  .advisor-input-inner {
    max-width: 360px;
  }
  .modal { width: 100%; padding: 12px; }
  .modal-gallery img { max-height: 300px; }
  .modal-thumbs img { width: 64px; height: 64px; }
}

@media (min-width: 768px) {
  .upload-group {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .upload-actions button {
    min-width: 140px;
  }
}
