.s5-audio-canvas {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: auto;
    max-width: none;
    display: block;
    pointer-events: none;
    flex-shrink: 0;
}
.s5-audio-title {
    position: absolute;
    top: 2px;
    left: 6px;
    right: 6px;
    font-size: 9px;
    color: rgba(255,255,255,0.55);
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 11;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    max-width: calc(100% - 12px);
    line-height: 1.2;
}
.s5-audio-block.selected-clip .s5-audio-title {
    opacity: 1;
}
.s5-audio-trim-handle { position: absolute; top: 0; bottom: 0; width: 10px; z-index: 10; cursor: ew-resize; background: rgba(0,0,0,0); transition: 0.2s;}
.s5-audio-trim-handle:hover { background: rgba(0,0,0,0.4); }
.s5-audio-trim-handle.left { left: 0; }
.s5-audio-trim-handle.right { right: 0; }


/* ============= login =============== */
/* Modal Overlay */

.vision-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.vision-modal-header h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #a0a0a5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.vision-modal-header p {
    margin: 8px 0 0;
    font-size: 14px;
    color: #88888e;
}

/* انیمیشن باز و بسته شدن مودال */
.vision-modal-content {
  transform: translateY(30px) scale(0.95);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

.vision-modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  display: flex; justify-content: center; align-items: center;
  
  z-index: -1; /* 🟢 تغییر مهم: در حالت مخفی، میره زیر همه چی */
  opacity: 0; 
  visibility: hidden;
  pointer-events: none; 
  /* 🟢 تغییر مهم: اضافه کردن z-index به ترانزیشن با تاخیر 0.4 ثانیه تا انیمیشن بسته شدن خراب نشود */
  transition: opacity 0.4s ease, visibility 0.4s ease, z-index 0s 0.4s;
}

.vision-modal-overlay.show {
    z-index: 99999; /* 🟢 تغییر مهم: وقتی باز شد میاد روی همه چی */
    opacity: 1;
    visibility: visible;
    pointer-events: auto; 
    /* 🟢 تغییر مهم: z-index اینجا بدون تاخیر اعمال میشه */
    transition: opacity 0.4s ease, visibility 0.4s ease, z-index 0s 0s;
}

/* Modal Content Glassmorphism */
.vision-modal-content.glass-effect {
  background: linear-gradient(145deg, rgba(30,30,30,0.6) 0%, rgba(10,10,10,0.8) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
  border-radius: 28px; width: 100%; max-width: 420px;
  padding: 40px 30px; position: relative; color: #fff;
  font-family: system-ui, -apple-system, sans-serif;
  overflow: hidden; /* جلوگیری از بیرون زدن انیمیشن فرم‌ها */
}

.vision-modal-overlay.show .vision-modal-content { 
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Close Button */
.close-btn {
  position: absolute; top: 15px; right: 20px; background: none; border: none;
  color: rgba(255,255,255,0.5); font-size: 28px; cursor: pointer; transition: color 0.3s;
  z-index: 10;
}
.close-btn:hover { color: #fff; }

/* Tabs */
.auth-tabs { display: flex; gap: 10px; margin-bottom: 30px; background: rgba(0,0,0,0.3); padding: 5px; border-radius: 14px; position: relative; z-index: 2;}
.auth-tab {
  flex: 1; background: transparent; border: none; color: rgba(255,255,255,0.5);
  padding: 10px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600; transition: all 0.3s;
}
.auth-tab.active { background: rgba(255,255,255,0.1); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }

/* --- انیمیشن حرفه‌ای فرم‌ها --- */
.vision-form { 
  opacity: 0;
  transform: translateX(30px); /* شروع از راست */
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  position: absolute;
  top: 0; left: 0;
  visibility: hidden;
  width: 100%;
  pointer-events: none;
  display: flex; flex-direction: column; gap: 20px; 
}

.vision-form.slide-left {
  transform: translateX(-30px); /* رفتن به چپ برای فرم قبلی */
}

.vision-form.active-form {
  opacity: 1;
  transform: translateX(0);
  visibility: visible;
  position: relative;
  pointer-events: auto;
}

/* ... بقیه کدهای CSS (مانند input-wrapper, ai-glow-btn, authError و غیره) دست نخورده باقی بمانند ... */


.input-wrapper { position: relative; width: 100%; }
.input-wrapper input, .input-wrapper select {
  width: 100%; padding: 14px 16px; background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.05); border-radius: 12px;
  color: #fff; font-size: 15px; outline: none; transition: border-color 0.3s, box-shadow 0.3s;
}
.input-wrapper input:focus, .input-wrapper select:focus {
  border-color: rgba(94, 28, 230, 0.6); box-shadow: 0 0 0 4px rgba(94, 28, 230, 0.1); background: rgba(0,0,0,0.4);
}
.input-wrapper input:-webkit-autofill,
.input-wrapper input:-webkit-autofill:hover,
.input-wrapper input:-webkit-autofill:focus,
.input-wrapper input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.35) inset !important;
  box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.35) inset !important;
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff;
  transition: background-color 5000s ease-in-out 0s;
}
.input-wrapper input:-webkit-autofill ~ label {
  top: -8px; left: 12px; font-size: 12px; background: #1a1a1a; padding: 0 4px; color: #a1a1aa; border-radius: 4px;
}
.input-wrapper label {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,0.4); font-size: 15px; pointer-events: none; transition: all 0.3s ease;
}
.input-wrapper input:focus ~ label, .input-wrapper input:not(:placeholder-shown) ~ label {
  top: -8px; left: 12px; font-size: 12px; background: #1a1a1a; padding: 0 4px; color: #a1a1aa; border-radius: 4px;
}
.select-wrapper select { appearance: none; color: rgba(255,255,255,0.7); }
.select-wrapper select option { background: #1a1a1a; color: #fff; }

/* AI Glow Button */
.ai-glow-btn {
  margin-top: 10px; width: 100%; padding: 14px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, #5E1CE6, #0A84FF); color: white; font-weight: 600; font-size: 16px;
  cursor: pointer; position: relative; overflow: hidden; transition: transform 0.2s, box-shadow 0.3s;
  box-shadow: 0 8px 20px rgba(94, 28, 230, 0.3);
}
.ai-glow-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(10, 132, 255, 0.4); }

.google-auth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 2px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f4f4f8;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
  position: relative;
  z-index: 2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.google-auth-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.google-auth-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}
.auth-legal-note {
  margin: 12px 0 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.6;
}
.auth-legal-note a { color: #ffb800; }
.terms-accept {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 12px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  line-height: 1.6;
  direction: rtl;
  text-align: right;
}
.terms-accept input {
  margin-top: 4px;
  accent-color: #ff6a00;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.terms-accept a { color: #ffb800; text-decoration: underline; }
.google-auth-btn:disabled { opacity: 0.7; cursor: wait; }
.auth-form-stack {
  position: relative;
  overflow: hidden;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 18px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  position: relative;
  z-index: 2;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}
#visionAuthModal .vision-modal-content.glass-effect {
  overflow: hidden;
}

/* Success State */
.auth-success { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 250px;}
.auth-success.hidden-form { display: none; }
.success-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(52, 199, 89, 0.1); color: #34C759;
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
  position: relative;
}
.success-icon svg { width: 30px; height: 30px; }
.highlight-name { font-weight: 700; color: #0A84FF; }

.auth-success.welcome-play .success-icon {
  animation: authSuccessPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.auth-success.welcome-play .success-icon::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(52, 199, 89, 0.45);
  animation: authSuccessRing 0.7s ease-out 0.1s forwards;
  opacity: 0;
}
.auth-success.welcome-play h3 {
  animation: authWelcomeFadeUp 0.45s ease 0.12s both;
}
.auth-success.welcome-play p {
  animation: authWelcomeFadeUp 0.45s ease 0.28s both;
}
.auth-success.welcome-play .highlight-name {
  display: inline-block;
  animation: authNameGlow 0.8s ease 0.4s both;
}

@keyframes authSuccessPop {
  from { opacity: 0; transform: scale(0.35); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes authSuccessRing {
  from { opacity: 0.8; transform: scale(0.8); }
  to { opacity: 0; transform: scale(1.85); }
}
@keyframes authWelcomeFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes authNameGlow {
  from { opacity: 0; transform: translateY(6px); }
  40% { opacity: 1; text-shadow: 0 0 16px rgba(10, 132, 255, 0.75); }
  to { opacity: 1; transform: translateY(0); text-shadow: none; }
}



/* استایل کادر ارور (رفع مشکل رفتن روی فیلد ایمیل) */
#authError {
  display: none;
  color: #ff4d4d; 
  background: rgba(255, 77, 77, 0.1); 
  padding: 10px; 
  border-radius: 8px; 
  margin-bottom: 20px; /* فاصله مناسب از فرم پایین */
  text-align: center; 
  font-size: 14px; 
  border: 1px solid #ff4d4d;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}




/* Stage 3 Modal - Apple Vision Pro Theme - Refined */
:root {
  --glass-bg: rgba(20, 20, 22, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.15);
  --text-main: #f5f5f7;
  --text-muted: #86868b;
  --accent: #0a84ff;
  --accent-hover: #409cff;
}

.s3-modal {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.85); 
  backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
  z-index: 9999; display: none; align-items: center; justify-content: center;
}
.s3-modal.active { display: flex; }

.s3-modal-content.s3-vision-theme {
  background: transparent; border: none; box-shadow: none;
  width: 100vw; height: 100vh;
  display: flex; flex-direction: column; position: relative;
  overflow: hidden; box-sizing: border-box;
}

.s3-close {
  position: absolute; top: 20px; right: 25px; z-index: 9999;
  color: var(--text-muted); font-size: 32px; cursor: pointer; transition: 0.3s;
  background: none; border: none; line-height: 1; padding: 0;
}
.s3-close:hover { color: #fff; transform: scale(1.1); }

.vision-glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
}

.s3-layout-container {
  display: flex; gap: 20px; align-items: stretch; height: 100%; width: 100%;
  padding: 15px 15px 15px 0; 
  box-sizing: border-box;
}

/* اصلاح اول: حذف border-radius */
#s3-right-panel,
#s5g-left-panel {
  width: 340px; min-width: 340px; 
  display: flex; flex-direction: column;
  height: calc(100% + 30px); 
  margin-top: -15px; margin-bottom: -15px; 
  border-radius: 0; /* اصلاح شده */
  border-top: none; border-bottom: none; border-left: none;
}

.s3-center-area {
  flex-grow: 1; display: flex; flex-direction: column; gap: 15px; height: 100%; min-width: 0;
}

/* اصلاح سوم: جلوگیری از تداخل با دکمه خروج */
.s3-right-sidebar {
  width: 90px; min-width: 90px; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 65px; /* اصلاح شده */
}

/* اصلاح دوم: خاکستری شدن تولبار بالا */
.s3-top-toolbar {
  display: flex; justify-content: center; gap: 12px; padding: 5px;
  background: transparent; border: none; margin: 0 auto;
}
.toolbar-btn {
  background: transparent; border: none; color: var(--text-muted); 
  font-size: 1.3rem; cursor: pointer; padding: 8px; border-radius: 8px;
  transition: all 0.2s ease; display: flex; align-items: center; justify-content: center;
  filter: grayscale(100%) opacity(0.7); /* کاملا خاکستری */
}
.toolbar-btn:hover { 
  color: var(--text-main); transform: translateY(-2px); 
  filter: grayscale(0%) opacity(1); /* برگشت رنگ در حالت هاور */
  text-shadow: 0 0 10px rgba(255,255,255,0.3); 
}
.toolbar-btn.active-pen {
  color: var(--text-main);
  filter: grayscale(0%) opacity(1);
  background: rgba(10, 132, 255, 0.18);
}

/* اصلاح هشتم: پس زمینه شفاف برای جلوگیری از سیاهی دور عکس */
.image-preview-wrapper {
  flex-grow: 1; width: 100%; display: flex; align-items: center; justify-content: center;
  background: transparent; /* اصلاح شده */
  overflow: hidden; position: relative; border-radius: 24px;
}
.image-preview-wrapper img { width: 100%; height: 100%; object-fit: contain; transition: transform 0.2s; }
/* Pinch on iPad/phone zooms the media, then springs back when the fingers lift. */
#stage3-modal.active,
#s5-gallery-modal.active {
  touch-action: pan-x pan-y;
}
#s3-image-wrapper.is-pinch,
#s5g-media-stage.is-pinch,
#image-preview-modal.is-pinch,
#s3-image-wrapper.is-pinch-release,
#s5g-media-stage.is-pinch-release,
#image-preview-modal.is-pinch-release {
  transform-origin: center center;
  z-index: 30;
}
#s3-image-wrapper.is-pinch-release,
#s5g-media-stage.is-pinch-release,
#image-preview-modal.is-pinch-release {
  transition: transform 0.28s ease;
}
#s3-drawing-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; z-index: 5; pointer-events: none; }
#s3-generating-overlay { display: none; position: absolute; inset: 0; background: rgba(0,0,0,0.7); align-items: center; justify-content: center; color: var(--text-main); font-size: 1.2rem; z-index: 6; backdrop-filter: blur(8px); }

#s3-chatBar { width: 100%; max-width: 800px; margin: 0 auto; background: transparent; padding: 0; }
.s3-chat-input-wrapper { display: flex; flex-direction: column; gap: 10px; border-radius: 24px; padding: 15px 20px; }
.s3-chat-input-box,
textarea.s3-chat-input-box,
textarea.s3-chat-input-box:focus {
  width: 100%;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text-main);
  outline: none;
  min-height: 40px;
  max-height: 120px;
  font-family: inherit;
  font-size: 1.05rem;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.s3-chat-input-box::placeholder { color: var(--text-muted); }

.chat-controls-row { display: flex; justify-content: space-between; align-items: center; }
.chat-left-controls { display: flex; align-items: center; gap: 12px; }

.s3-chat-file-btn { cursor: pointer; font-size: 1.4rem; color: var(--text-muted); transition: 0.3s; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: transparent; }
.s3-chat-file-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.1); }

.ai-text-btn { background: transparent; border: none; color: var(--text-muted); padding: 4px 8px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: 0.2s; white-space: nowrap; }
.ai-text-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.1); }

.ai-dropdown-menu { background: rgba(18, 18, 22, 0.95); border: 1px solid var(--glass-border); border-radius: 12px; padding: 6px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); backdrop-filter: blur(10px); min-width: 120px; }
.ai-dropdown-option { padding: 8px 12px; font-size: 0.85rem; color: var(--text-main); cursor: pointer; border-radius: 8px; transition: 0.2s; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.ai-dropdown-option:hover { background: rgba(10, 132, 255, 0.2); }
.ai-dropdown-option small { margin-left: auto; color: var(--text-muted); font-size: 0.72rem; }
.ai-model-logo { width: 16px; height: 16px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.s5-control-dropdown-item .ai-model-logo { width: 14px; height: 14px; vertical-align: middle; margin-right: 6px; }
.pill-native-select { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.s3-chat-submit { background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border); color: var(--text-main); cursor: pointer; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.3s; }
.s3-chat-submit:hover { background: var(--text-main); color: #000; transform: scale(1.05); }

.inner-scroll { overflow-y: auto; overflow-x: hidden; padding: 25px 15px; flex-grow: 1; }
.inner-scroll::-webkit-scrollbar { width: 5px; }
.inner-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

details.panel-section { margin-bottom: 5px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 5px; }
details.panel-section > summary {
  font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; 
  padding: 10px 0; display: flex; justify-content: space-between; align-items: center; 
  font-weight: 600; cursor: pointer; list-style: none; user-select: none; transition: color 0.2s;
}
details.panel-section > summary::-webkit-details-marker { display: none; }
details.panel-section > summary:hover { color: var(--text-main); }
details.panel-section > summary::after { content: '›'; font-size: 1.2rem; transition: transform 0.3s; }
details[open].panel-section > summary::after { transform: rotate(90deg); }
.accordion-content { padding: 10px 0 15px 0; }

#s3-prop-name, .s5g-title { background: transparent; color: var(--text-main); border: none; outline: none; width: 100%; font-size: 1.3rem; font-weight: bold; margin-bottom: 15px; text-align: center; }

.prompt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.copy-icon-btn { background: transparent; border: none; color: var(--text-muted); width: 28px; height: 28px; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; padding: 0; overflow: visible; }
.copy-icon-btn svg { width: 24px; height: 24px; flex-shrink: 0; }
.copy-icon-btn:hover { color: var(--text-main); }
.copy-prompt-wrap { display: flex; align-items: center; gap: 8px; flex-direction: row-reverse; }
.s3-copy-toast { font-size: 0.72rem; color: #86efac; opacity: 0; transition: opacity 0.25s ease; white-space: nowrap; pointer-events: none; }
.s3-copy-toast.show { opacity: 1; }
#s3-prop-desc, #s5g-prompt { background: rgba(0,0,0,0.4); border: none; color: var(--text-main); padding: 12px 4px; border-radius: 12px; resize: none; font-size: 0.85rem; line-height: 1.5; outline: none; width: 100%; box-sizing: border-box; max-height: 200px; overflow-y: auto; min-height: 2.5em; }
.image-preview-wrapper:fullscreen { background: #000; display: flex; align-items: center; justify-content: center; }
.image-preview-wrapper:fullscreen img { max-width: 100vw; max-height: 100vh; }
/* اصلاح چهارم: چپ چین کردن اسم مدل دقیقاً جلوی آن */
.model-info { color: var(--text-muted); font-size: 0.85rem; display: flex; gap: 8px; align-items: center;}
.model-info span { color: var(--text-main); font-weight: bold; }
.s3-model-info,
.s5g-model-info {
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}
.s3-meta-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main, #f5f5f7);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
}
.s3-meta-chip[data-kind="model"] {
  max-width: 11.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s3-meta-chip[hidden] {
  display: none !important;
}

.vision-glass-btn { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--glass-border); color: var(--text-main); border-radius: 12px; padding: 10px 15px; cursor: pointer; transition: all 0.3s ease; width: 100%; text-align: left; font-size: 0.9rem; }
.vision-glass-btn:hover { background: rgba(255, 255, 255, 0.15); }
.btn-center { text-align: center; }

.camera-controls-wrapper { background: transparent; border-radius: 12px; padding: 5px 0; transition: 0.3s; margin-top: 10px; }
.camera-controls-wrapper.disabled { opacity: 0.4; pointer-events: none; }
.cam-angle-viewport {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
  margin-bottom: 14px;
  cursor: grab;
  touch-action: none;
}
.cam-angle-viewport:active { cursor: grabbing; }
.cam-slider-row {
  display: grid;
  grid-template-columns: 55px 1fr 30px 24px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--text-main);
}
.cam-reset-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; font-size: 1rem; padding: 0; }
.cam-reset-btn:hover { color: var(--text-main); transform: rotate(-45deg); }
.cam-slider-label { color: rgba(255,255,255,0.85); }
.cam-slider-value { text-align: right; color: rgba(255,255,255,0.65); font-variant-numeric: tabular-nums; }
.cam-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 2px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
}
.cam-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 3px;
  height: 16px;
  background: #0a84ff;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(10,132,255,0.6);
}
.cam-slider::-moz-range-thumb {
  width: 3px;
  height: 16px;
  background: #0a84ff;
  border: none;
  border-radius: 2px;
  cursor: pointer;
}
.cam-generate-btn {
  margin-top: 6px;
  width: 100%;
  background: #0a84ff !important;
  border: none !important;
  font-weight: 600;
  padding: 12px !important;
}

#panel-s3-assets > summary { margin-bottom: 2px; }
#panel-s3-assets .accordion-content { padding-top: 2px; }
#panel-s3-assets .asset-title:first-of-type { margin-top: 2px; }
.s3-reference-block { margin-top: 12px; }
.s3-reference-label { font-size: 0.7rem; color: var(--text-muted); font-weight: bold; letter-spacing: 0.04em; display: block; margin-bottom: 6px; }
.s3-reference-block:not(:has(.mini-thumb)) .s3-reference-label { display: none; }
.s3-reference-display .mini-thumb { cursor: pointer; pointer-events: auto; }
.s3-reference-display .mini-thumb:hover { transform: scale(1.05); border-color: rgba(255,255,255,0.5); }

.s3-attach-anchor { position: relative; display: inline-flex; align-items: center; }
.s3-attach-picker {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(450px, 92vw);
  padding: 0;
  border-radius: 16px;
  background: rgba(18, 18, 22, 0.96);
  border: 1px solid var(--glass-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
  z-index: 10050;
  overflow: hidden;
}
.s3-attach-picker-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.2);
}
.s3-attach-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}
.s3-attach-tab.active {
  color: var(--text-main);
  background: rgba(255,255,255,0.05);
  border-bottom: 2px solid var(--accent);
}
.s3-attach-tab:hover:not(.active) { color: var(--text-main); background: rgba(255,255,255,0.03); }
.s3-attach-tab-content { padding: 15px; display: none; }
.s3-attach-tab-content.active { display: block; }
.s3-attach-picker-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
.s3-attach-picker-col { min-width: 0; }
.s3-attach-picker.s3-attach-picker-assets-only .s3-attach-picker-tabs,
.s3-attach-picker.s3-attach-picker-assets-only .s3-open-file-manager-btn,
.s3-attach-picker.s3-attach-picker-assets-only #s3-attach-tab-shots {
  display: none !important;
}
.s3-attach-picker.s3-attach-picker-assets-only #s3-attach-tab-assets {
  display: block !important;
}

.s3-open-file-manager-btn,
.s3-file-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: calc(100% - 30px);
  min-height: 64px;
  margin: 0 15px 15px 15px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.s3-file-dropzone-title {
  line-height: 1.2;
}
.s3-file-dropzone-hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}
.s3-open-file-manager-btn:hover,
.s3-file-dropzone.is-dragover {
  background: rgba(10, 132, 255, 0.16);
  border-color: rgba(10, 132, 255, 0.55);
  border-style: dashed;
  color: var(--text-main);
}
.s3-file-dropzone.is-dragover .s3-file-dropzone-hint {
  color: var(--text-main);
}
.s3-chat-container.s3-chat-drag-over {
  outline: 2px dashed rgba(10, 132, 255, 0.65);
  outline-offset: 4px;
  border-radius: 24px;
}
.asset-title { font-size: 0.7rem; color: var(--text-muted); margin: 6px 0 4px 0; font-weight: bold; }
.mini-thumb-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; }
.mini-thumb-row.large-thumbs .mini-thumb { width: 60px; height: 60px; min-width: 60px; border-radius: 12px; }
.mini-thumb-row::-webkit-scrollbar { height: 4px; }
.mini-thumb-row::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 4px; }
.mini-thumb { position: relative; width: 45px; height: 45px; min-width: 45px; border-radius: 10px; background: rgba(255,255,255,0.1); border: 2px solid transparent; cursor: pointer; object-fit: cover; transition: 0.2s; }
.mini-thumb:hover { border-color: rgba(255,255,255,0.5); transform: scale(1.05); }
.mini-thumb.selected { border-color: var(--accent); box-shadow: 0 0 10px rgba(10, 132, 255, 0.4); }
.mini-thumb-badge { position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,0.7); color: white; font-size: 0.6rem; padding: 2px 4px; border-radius: 4px; font-weight: bold; pointer-events: none; }

.adj-group { margin-bottom: 15px; }
.adj-label-wrapper { display: flex; justify-content: space-between; align-items: center; color: var(--text-main); font-size: 0.85rem; margin-bottom: 6px; }
.adj-value-wrapper { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.adj-reset-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; transition: 0.2s; }
.adj-reset-btn:hover { color: var(--text-main); transform: rotate(-45deg); }
input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--text-main); cursor: pointer; transition: 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

#s3-layers-container { background: rgba(0,0,0,0.3); border-radius: 12px; padding: 10px; min-height: 50px; margin-top: 10px; }
.s3-layer-item { padding: 8px 12px; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; font-size: 0.85rem; border-radius: 8px; background: rgba(255,255,255,0.05); color: var(--text-main); }
.drag-handle { color: var(--text-muted); cursor: grab; }

#s3-thumbnails,
#s5g-thumbnails { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; width: 100%; align-items: center; padding-right: 5px; flex: 1; min-height: 0; }
.thumb-add { width: 64px !important; height: 64px !important; border: 1px dashed var(--text-muted); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--text-muted); border-radius: 16px; cursor: pointer; transition: 0.3s; background: transparent; }
.thumb-add:hover { color: var(--text-main); border-color: var(--text-main); background: rgba(255,255,255,0.05); }
.thumb-image-item { width: 64px !important; height: 64px !important; object-fit: cover; border-radius: 16px; cursor: pointer; border: 2px solid transparent; transition: 0.3s; flex-shrink: 0; }
.thumb-image-item:hover { border-color: var(--accent); }
#s3-thumbnails .thumb-wrapper,
#s5g-thumbnails .thumb-wrapper { cursor: pointer; }

/* Switch for Camera */
.switch-wrapper { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--text-main); font-size: 0.85rem;}
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.2); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(14px); }
/* کانتینر اصلی تامنیل‌ها */
#s3-upload-previews {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* استایل تامنیل (مربع کوچک) */
.s3-upload-thumb {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    /* افکت شیشه‌ای برای زمانی که هنوز عکس لود نشده */
    background-color: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.s3-upload-thumb:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.4);
}

/* دکمه حذف (X) */
.s3-upload-thumb button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: rgba(255, 50, 50, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0; /* در حالت عادی مخفی است */
    transition: opacity 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(2px);
    z-index: 10;
}

/* نمایش دکمه حذف هنگام هاور */
.s3-upload-thumb:hover button {
    opacity: 1;
    transform: scale(1.1);
}

.s3-upload-thumb button:hover {
    background: rgb(255, 20, 20);
}

/* اورلی (Overlay) تاریک هنگام آپلود */
.s3-upload-thumb.uploading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 7px; /* کمی کمتر از border-radius اصلی که از حاشیه بیرون نزند */
    z-index: 1;
}

/* انیمیشن دایره پیشرفت (Filling Progress) */
.progress-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    /* استفاده از گرادیانت برای شبیه‌سازی پر شدن */
    background: conic-gradient(
        rgba(255, 255, 255, 0.9) var(--progress, 0%), 
        rgba(255, 255, 255, 0.1) 0
    );
    z-index: 2;
    /* انیمیشن چرخشی ملایم برای جذابیت بیشتر */
    animation: pulse-spin 2s linear infinite;
}

/* حفره وسط دایره پیشرفت (برای تبدیل دایره توپر به حلقه) */
.progress-circle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    background: rgba(40, 40, 40, 0.9); /* رنگ پس‌زمینه مودال شما */
    border-radius: 50%;
}

@keyframes pulse-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}


/* استایل باکس منوی کشویی */
.ai-model-menu {
    background-color: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1); /* تغییر جهت سایه به سمت بالا */
    padding: 8px 0;
    min-width: 160px;
    margin-bottom: 8px; /* جایگزین margin-top شد */
}


/* استایل هر گزینه در منو */
.ai-model-option {
    padding: 8px 16px;
    font-size: 14px;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* هاور (Hover) روی گزینه‌ها */
.ai-model-option:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}
