/* =========================
   common.css — shared styles for sofa & pillows
   ========================= */

@font-face {
  font-family: 'Vazirmatn';
  src: url('/ui/font/Vazirmatn[wght].woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

button, .btn {
  font-family: inherit;
}

.model-radio-btn.radio-selected {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff;
}

/* Icon inside buttons */
.btn-icon {
  width: 35px;
  height: 35px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
  margin-left: 2px;   /* RTL spacing between icon and any adjacent text */
}

/* Theme variables */
:root {
  --bg: #0b1020;
  --card: #0f162b;
  --muted: #94a3b8;
  --text: #e5e7eb;
  --border: #243045;
  --accent: #22c55e;
  --blue: #1f3a8a;
  --active-bg: #0e3a2b;
}

html[data-theme="light"] {
  --bg: #f8fafc;
  --card: #ffffff;
  --muted: #475569;
  --text: #0f172a;
  --border: #e2e8f0;
  --accent: #16a34a;
  --blue: #2563eb;
  --active-bg: #d1fae5;
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, IRANSans, Segoe UI, Roboto, Arial;
}
html {
  scrollbar-gutter: stable;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100svh;
  height: auto;
  display: flex;
  flex-direction: column;
}

.bar {
  position: relative;
  padding: 12px 10px 16px 3px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.hamburger {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}



.flow-icon-img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  margin-bottom: 12px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.stage-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-left: 6px;
  object-fit: contain;
}

.stage-head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
}

.stage-head-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}


#loginModal input,
#loginModal button {
  box-sizing: border-box;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn, .part, .hamburger {
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.06);
}

.part:hover:not(.active) {
  background: rgba(255,255,255,0.03);
}

html[data-theme="light"] .btn:hover:not(:disabled) {
  background: rgba(0,0,0,0.04);
}

html[data-theme="light"] .part:hover:not(.active) {
  background: rgba(0,0,0,0.02);
}

.thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 120px;
  background: var(--card);
  overflow: hidden;
}

.thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
}

.badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .85rem;
  color: var(--text);
}

.toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.toggle button {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  padding: 8px 12px;
}

.toggle .active {
  background: #193a88;
  color: #fff;
}

.part {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}

.part.active {
  background: var(--active-bg);
  border-color: var(--accent);
}

.viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  scroll-behavior: smooth;
}

.section {
  display: none;
  flex: 1;
  overflow: auto;
}

.section.active {
  display: flex;
  flex-direction: column;
}

.controls {
  margin: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.rightline {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.selectFrame {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

#sofaThumb, #baseFrame {
  height: 220px !important;
  width: 100%;
}

#navRow {
  margin: 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tagsHeader {
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: .95rem;
  color: var(--muted);
}

.info-note {
  font-size: 0.95em;
  color: var(--text);
  margin-top: 16px;
  padding: 12px 44px 12px 16px;   /* extra right padding for the dismiss button */
  line-height: 1.4;
  background: var(--card);
  border: 2px solid var(--accent);
  border-radius: 10px;
  text-align: right;
  position: relative;
}


.info-note-dismiss {
  background: var(--card);
  border: 1px solid var(--border);
  color: #ef4444;               /* red cross */
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s;
  position: absolute;
  right: 8px;
  top: 8px;
}

.info-note-dismiss:hover {
  background: rgba(255,255,255,0.08);
}

.tinyX {
  position: absolute;
  left: 8px;
  top: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.tinyX:hover {
  background: #17213d;
}

#toast-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100001;
  pointer-events: none;            /* container doesn't block clicks */
}

.toast-item {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: auto;            /* each toast is clickable */
  cursor: pointer;
  max-width: 90vw;
  word-break: break-word;
  position: relative;                 
  padding-right: 36px; 
}

.toast-item.show {
  opacity: 1;
}

.toast-dismiss {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
}

.toast-dismiss:hover {
  background: rgba(255, 255, 255, 0.08);
}






/* Base Images Album Modal */
#baseAlbumModal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#baseAlbumCard {
  width: min(900px, 92vw);
  max-height: 85vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid #3a4367;
  border-radius: 12px;
  padding: 16px;
}

#baseAlbumGrid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.baseAlbumThumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #3a4367;
  cursor: pointer;
  display: block;
  background: #0f172a;
}

.model-radio-input { display: none; }

.model-radio-input:checked + .model-radio-btn,
.model-radio-input:focus + .model-radio-btn,
.model-radio-input:active + .model-radio-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

label:active .model-radio-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* =====================
   Menu / navigation
   ===================== */

.menu {
  position: absolute;
  top: 48px;
  right: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 220px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  color: var(--text);
  padding: 6px 0;
}

.menu.show {
  display: flex;
}

/* All menu items (links and action buttons) */
.menu a,
.menu button.menu-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 12px;
  color: var(--text);
  text-decoration: none;
  border: 0;
  cursor: pointer;
  background: transparent;
  text-align: right;
  width: 100%;
  font-family: inherit;
  transition: background-color 0.15s;
}

.menu a:hover,
.menu button.menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

html[data-theme="light"] .menu a:hover,
html[data-theme="light"] .menu button.menu-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Current page */
.menu a.active {
  background: var(--active-bg);
  border-right: 3px solid var(--accent);
  color: var(--accent);
}

/* Icons */
.menu-icon {
  width: 40px;
  height: 40px;
  vertical-align: middle;
  margin-left: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Thick separator between groups */
.menu-divider {
  height: 6px;
  background: var(--border);
  margin: 8px 0;
  border-radius: 2px;
  opacity: 0.6;
}

/* Bottom action group */
.menu-actions {
  padding-top: 4px;
}

.menu-action {
  font-size: 0.95rem;
}

/* Advanced option checkbox */
.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  user-select: none;
}

.advanced-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.toast-action {
  margin-right: 8px;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  white-space: nowrap;
}

.toast-action:hover {
  opacity: 0.8;
}


/* ============================================================
   Provider panel — shared between manage and public views
   ============================================================ */

.provider-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

.provider-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.provider-header h1 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.provider-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.provider-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 8px 0 12px;
  color: var(--text);
}

.provider-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 8px 0 12px;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.provider-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.12s;
}

.provider-card:hover {
  border-color: var(--accent);
}

.provider-card-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.provider-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.provider-card-cover.no-image::after {
  content: "بدون تصویر";
  color: var(--muted);
  font-size: 0.8rem;
}

.provider-card-body {
  padding: 8px 10px;
}

.provider-card-name {
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.provider-card-actions {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 4px;
  z-index: 2;
}

.provider-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(15,22,43,0.85);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
  font-family: inherit;
}

.provider-icon-btn:hover {
  background: rgba(30,41,59,0.95);
}

html[data-theme="light"] .provider-icon-btn {
  background: rgba(255,255,255,0.92);
}

.provider-icon-btn.danger {
  color: #ef4444;
}

.provider-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

/* Modal */
.provider-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.provider-modal-backdrop.show {
  display: flex;
}

.provider-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(560px, 96vw);
  max-height: 90vh;
  overflow: auto;
  color: var(--text);
  padding: 16px;
}

.provider-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.provider-modal-title {
  font-weight: 700;
  font-size: 1rem;
}

.provider-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.provider-field label {
  font-size: 0.85rem;
  color: var(--muted);
}

.provider-field input,
.provider-field textarea,
.provider-field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.provider-field textarea {
  min-height: 80px;
  resize: vertical;
}

.provider-field .hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.provider-cover-preview {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f172a;
  object-fit: cover;
  display: block;
  margin-top: 6px;
}

.provider-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Setup wizard */
.provider-setup-card {
  max-width: 480px;
  margin: 40px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.provider-setup-card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.provider-subdomain-status {
  font-size: 0.8rem;
  margin-top: 4px;
}

.provider-subdomain-status.ok { color: var(--accent); }
.provider-subdomain-status.err { color: #ef4444; }

/* Copy button */
.provider-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}

.provider-copy-btn:hover {
  background: rgba(255,255,255,0.06);
}

html[data-theme="light"] .provider-copy-btn:hover {
  background: rgba(0,0,0,0.05);
}

/* Material detail modal */
.provider-material-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.provider-material-detail img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 10px;
  background: #0f172a;
}

.provider-material-detail-name {
  font-weight: 700;
  font-size: 1rem;
}

.provider-material-detail-desc {
  font-size: 0.88rem;
  color: var(--muted);
  white-space: pre-line;
  line-height: 1.7;
}

.provider-material-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   Album tabs (shown only on provider subdomains)
   ============================================================ */

.album-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.album-tab {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  transition: background-color 0.15s, color 0.15s;
  border-right: 1px solid var(--border);
}

.album-tab:last-child {
  border-right: none;
}

.album-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] .album-tab:hover:not(.active) {
  background: rgba(0, 0, 0, 0.04);
}

.album-tab.active {
  background: var(--active-bg);
  color: var(--accent);
  font-weight: 600;
}

/* Provider material cell in the album grid */
.provider-album-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  align-self: start;
}

.provider-album-item-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
}

/* ============================================================
   Provider album — category section headers
   ============================================================ */

.provider-album-category-header {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  padding: 10px 4px 2px;
  border-bottom: 1px solid var(--border);
  margin-top: 4px;
}

.provider-album-category-header:first-child {
  margin-top: 0;
  padding-top: 0;
}

/* ============================================================
   Provider album — category filter pills
   ============================================================ */

.provider-album-filters {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.provider-album-filter {
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

.provider-album-filter:hover:not(.active) {
  background: rgba(255,255,255,0.05);
}

html[data-theme="light"] .provider-album-filter:hover:not(.active) {
  background: rgba(0,0,0,0.05);
}

.provider-album-filter.active {
  background: var(--active-bg);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   Mobile: force a two-column grid for provider category and
   material cards. Without this, auto-fill needs ~334px of
   usable width for two columns, which most phones don't have.
   Desktop layout (auto-fill) is unaffected above 480px.
   ============================================================ */

@media (max-width: 480px) {
  .provider-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* ============================================================
   Deep-link arrival banner
   Shown on flow pages when the URL contains ?material=<publicId>.
   Injected by common.js into the top of #step-upload.
   ============================================================ */

.deeplink-banner {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  margin: 10px 10px 0 10px;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 12px;
}

.deeplink-banner-dismiss {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
}
.deeplink-banner-dismiss:hover {
  background: rgba(255, 255, 255, 0.06);
}
html[data-theme="light"] .deeplink-banner-dismiss:hover {
  background: rgba(0, 0, 0, 0.05);
}

.deeplink-banner-preview {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f172a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.deeplink-banner-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.deeplink-banner-preview.skeleton {
  background: linear-gradient(90deg, #1a2237 25%, #243045 50%, #1a2237 75%);
  background-size: 200% 100%;
  animation: deeplink-skeleton 1.4s ease-in-out infinite;
}
@keyframes deeplink-skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.deeplink-banner-body {
  flex: 1;
  min-width: 0;
  padding-left: 28px; /* physical left, clears the dismiss button */
}

.deeplink-banner-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deeplink-banner-store {
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deeplink-banner-instruction {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ============================================================
   Deep-link-arrived material 0 (locked slot)
   Applied when fabric 0 was loaded from ?material= in the URL
   and the flow page's advanced mode is off. The utilities (file,
   camera, album) and the delete button are hidden; the preview is
   enlarged; a store line appears below the preview. Toggling
   advanced mode on reveals everything as a normal editable slot.
   ============================================================ */

.selectFrame.deeplink-material-0 #removeFabBtn {
  display: none;
}

.selectFrame.deeplink-material-0 .deep-link-utilities-row {
  justify-content: center !important;
}

.selectFrame.deeplink-material-0 .deep-link-utilities-row .rightline {
  display: none;
}

.selectFrame.deeplink-material-0 #fabImg {
  width: 96px !important;
  height: 96px !important;
  border-radius: 14px !important;
}

.deeplink-store-line {
  display: none;
  text-align: center;
  font-size: 0.82rem;
  color: var(--accent);
  margin-top: 4px;
  margin-bottom: 8px;
  line-height: 1.5;
}