/* ══════════════════════════════════════════════════════════════
   MINDSUP AI — image-studio.css
   Brand: Charcoal #1f271b, White #fbfffe, Purple #741054
   ══════════════════════════════════════════════════════════════ */
   :root {
    --black: #1f271b; 
    --black-hover: #2a332c; 
    --white: #fbfffe;
    
    --purple: #741054; 
    --purple-light: #9c1b74; 
    --purple-dark: #580c40;
    
    --bg: #151a12; 
    --gray-100: #f2f5f4;
    --gray-200: #e0e5e3;
    --gray-400: #a3aba8;
    --gray-600: #575e5a;
    
    --bdr: rgba(116, 16, 84, 0.15); 
    --bdr-mid: rgba(116, 16, 84, 0.3);
    
    --sh-sm: 0 2px 8px rgba(0,0,0,.05); 
    --sh-md: 0 8px 24px rgba(0,0,0,.08); 
    --sh-lg: 0 20px 40px rgba(0,0,0,.15);
    --sh-purple: 0 4px 16px rgba(116, 16, 84, 0.2);
    
    --font-body: 'Vazirmatn', sans-serif;
    
    --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px;
    --t: .2s cubic-bezier(.22,1,.36,1);
    --sidebar-w: 260px;
    --topbar-h: 70px;
  }
  
  *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
  body{
    font-family:var(--font-body); background:var(--gray-100); color:var(--black);
    direction:rtl; display:flex; min-height:100dvh; overflow-x:hidden;
  }
  a{text-decoration:none;color:inherit}
  button{cursor:pointer;font-family:inherit;border:none;background:none;outline:none}
  ul{list-style:none}
  ::-webkit-scrollbar{width:6px;height:6px;}
  ::-webkit-scrollbar-track{background:transparent}
  ::-webkit-scrollbar-thumb{background:var(--gray-200);border-radius:3px}
  ::-webkit-scrollbar-thumb:hover{background:var(--gray-400)}
  
  /* ─── SIDEBAR & BASE LAYOUT ─── */
  .ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.4; }
  .amb-1 { position: absolute; border-radius: 50%; filter: blur(100px); width: 50vw; height: 50vw; background: rgba(116,16,84,0.08); top: -20%; right: -10%; animation: ambDrift 15s ease-in-out infinite alternate; }
  
  .sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); height: 100dvh; background: var(--black); border-left: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column; z-index: 200; transition: transform var(--t); }
  .sidebar-head { height: 70px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); }
  .logo-link { display: flex; align-items: center; gap: 10px; }
  .logo-badge { background: var(--purple); color: var(--white); font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 4px; }
  .logo-name { font-weight: 800; font-size: 18px; color: var(--white); }
  .logo-tagline { display: block; font-size: 10px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 1px; }
  .sidebar-close-btn { color: var(--gray-400); display: none; }
  
  .main-nav { flex: 1; padding: 20px 16px; display: flex; flex-direction: column; gap: 4px; }
  .nav-label { font-size:11px; font-weight:700; color:var(--gray-400); margin: 16px 8px 8px; }
  .nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--gray-200); font-size: 14px; transition: var(--t); }
  .nav-item svg { color: var(--gray-400); transition: var(--t); }
  .nav-item:hover { background: var(--black-hover); color: var(--white); }
  .nav-item.active { background: rgba(116,16,84,0.2); color: var(--purple-light); font-weight: 700; }
  .nav-item.active svg { color: var(--purple-light); }
  
  .sidebar-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,0.05); }
  .sf-user { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); background: rgba(255,255,255,0.05); }
  .sf-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--purple); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--white); flex-shrink: 0; }
  .sf-info { flex: 1; min-width: 0; }
  .sf-name { display: block; font-size: 13px; font-weight: 700; color: var(--white); }
  .sf-plan { font-size: 11px; color: var(--gray-400); }
  .sf-plan-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--purple-light); margin-left: 4px; }
  
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 150; opacity: 0; transition: var(--t); }
  
  .dashboard-wrapper { flex: 1; display: flex; flex-direction: column; z-index: 1; height: 100dvh; overflow-y: auto; }
  
  /* ─── TOPBAR ─── */
  .topbar { height: 70px; min-height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; background: var(--white); border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 100; }
  .tb-left, .tb-right { display: flex; align-items: center; gap: 16px; }
  .tb-btn { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--gray-100); color: var(--gray-600); display: flex; align-items: center; justify-content: center; transition: var(--t); }
  .tb-btn:hover { background: rgba(116,16,84,0.1); color: var(--purple); }
  .page-title { font-size: 18px; font-weight: 800; color: var(--black); }
  
  .credit-badge { display: flex; align-items: center; gap: 8px; background: rgba(116, 16, 84, 0.1); padding: 8px 14px; border-radius: var(--r-full); color: var(--purple); font-size: 13px; }
  .credit-badge strong { font-weight: 800; }
  
  /* Buttons */
  .btn { padding: 10px 20px; border-radius: var(--r-sm); font-size: 14px; font-weight: 700; transition: var(--t); display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative;}
  .btn-primary { background: linear-gradient(135deg, var(--purple), var(--purple-dark)); border: 1px solid var(--purple-light); color: var(--white); }
  .btn-primary:hover:not(:disabled) { border-color: var(--purple-light); box-shadow: var(--sh-purple); transform: translateY(-1px); }
  .btn-outline { background: transparent; border: 1px solid var(--gray-200); color: var(--black); }
  .btn-outline:hover:not(:disabled) { background: var(--gray-100); border-color: var(--purple); color: var(--purple); }
  .btn-icon { color: var(--gray-400); transition: var(--t); display: flex; align-items: center; justify-content: center; }
  .btn-icon:hover { color: var(--black); }
  .btn:disabled { opacity: 0.7; cursor: not-allowed; }
  
  /* ─── BENTO GRID ─── */
  .bento-container { padding: 24px; display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; align-items: start;}
  .glass-panel { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r-xl); box-shadow: var(--sh-sm); overflow: hidden; transition: var(--t); }
  .glass-panel:hover { border-color: rgba(116, 16, 84, 0.3); box-shadow: var(--sh-md); }
  
  .span-12 { grid-column: span 12; }
  .span-8 { grid-column: span 8; }
  .span-4 { grid-column: span 4; }
  
  .card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
  .card-head h3 { font-size: 16px; font-weight: 800; color: var(--black); }
  .card-head p { font-size: 13px; color: var(--gray-600); margin-top: 4px; }
  
  /* ─── GENERATOR PANEL (Prompt) ─── */
  .generator-panel { padding: 24px; display: flex; flex-direction: column; }
  .prompt-box { background: var(--gray-100); border: 2px solid transparent; border-radius: var(--r-md); padding: 16px; transition: var(--t); margin-bottom: 16px;}
  .prompt-box:focus-within { border-color: var(--purple-light); background: var(--white); box-shadow: 0 0 0 4px rgba(116, 16, 84, 0.1); }
  .prompt-box textarea { width: 100%; background: transparent; border: none; outline: none; resize: vertical; min-height: 100px; font-size: 14px; line-height: 1.8; color: var(--black); font-family: var(--font-body); }
  .prompt-box textarea::placeholder { color: var(--gray-400); }
  
  .generator-actions { display: flex; justify-content: space-between; align-items: center; }
  .generate-btn { padding: 12px 24px; font-size: 15px; }
  
  /* ─── SETTINGS PANEL ─── */
  .settings-panel { padding: 24px; }
  .setting-group { margin-bottom: 24px; }
  .setting-group:last-child { margin-bottom: 0; }
  .setting-group label { display: block; font-size: 13px; font-weight: 700; color: var(--black); margin-bottom: 10px; }
  
  .custom-select { width: 100%; padding: 12px 16px; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: var(--r-sm); font-family: var(--font-body); font-size: 13px; color: var(--black); outline: none; cursor: pointer; transition: var(--t); }
  .custom-select:focus { border-color: var(--purple); background: var(--white); }
  
  /* Aspect Ratio Selector */
  .ratio-selector { display: flex; gap: 12px; }
  .ratio-option { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: var(--r-sm); cursor: pointer; transition: var(--t); }
  .ratio-option:hover { background: var(--white); border-color: var(--gray-400); }
  .ratio-option.active { background: rgba(116, 16, 84, 0.05); border-color: var(--purple); color: var(--purple); }
  .ratio-option span { font-size: 12px; font-weight: 600; font-family: var(--font-code); }
  
  /* اشکال هندسی برای نشان دادن نسبت تصویر */
  .ratio-box { border: 2px solid var(--gray-400); border-radius: 4px; transition: var(--t); }
  .ratio-option.active .ratio-box { border-color: var(--purple); background: var(--purple); opacity: 0.2; }
  .ratio-box.square { width: 24px; height: 24px; }
  .ratio-box.landscape { width: 28px; height: 16px; }
  .ratio-box.portrait { width: 16px; height: 28px; }
  
  /* ─── GALLERY PANEL ─── */
  .gallery-panel { padding: 24px; }
  .image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
  
  .image-card { position: relative; border-radius: var(--r-md); overflow: hidden; aspect-ratio: 1/1; background: var(--gray-100); box-shadow: var(--sh-sm); transition: var(--t); }
  .image-card:hover { transform: translateY(-4px); box-shadow: var(--sh-md); }
  .gen-img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .img-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
  
  /* Overlay actions */
  .img-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); opacity: 0; display: flex; align-items: flex-end; justify-content: center; gap: 12px; padding: 16px; transition: var(--t); }
  .image-card:hover .img-overlay { opacity: 1; }
  .img-action-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--white); color: var(--black); display: flex; align-items: center; justify-content: center; transition: var(--t); }
  .img-action-btn:hover { background: var(--purple); color: var(--white); transform: scale(1.1); }
  
  /* Skeleton Loading State */
  .skeleton { border: 2px dashed var(--gray-400); background: transparent; box-shadow: none; animation: pulseSkel 1.5s infinite alternate; display: flex; align-items: center; justify-content: center;}
  .skeleton.hidden { display: none !important; }
  .skel-img { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--purple); }
  .skel-img p { font-size: 13px; font-weight: 700; color: var(--gray-600); }
  @keyframes pulseSkel { 0% { opacity: 0.5; } 100% { opacity: 1; } }
  
  /* Button Spinner */
  .spinner { animation: rotate 2s linear infinite; width: 18px; height: 18px; display: inline-block; }
  .spinner.hidden { display: none; }
  .spinner .path { stroke: currentColor; stroke-linecap: round; animation: dash 1.5s ease-in-out infinite; }
  @keyframes rotate { 100% { transform: rotate(360deg); } }
  @keyframes dash { 0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; } 50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; } 100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; } }
  
  /* ─── TOASTS ─── */
  .toasts{ position:fixed; bottom:24px; left:50%; transform:translateX(-50%); display:flex; flex-direction:column; gap:8px; z-index:9999; pointer-events:none; }
  .toast{ padding:12px 24px; background:var(--black); color:var(--white); border-radius:var(--r-full); font-size:13px; box-shadow:var(--sh-md); white-space:nowrap; animation:toastIn .3s var(--ease); }
  @keyframes toastIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
  
  /* ─── RESPONSIVE ─── */
  @media (max-width: 1024px) {
    .span-8, .span-4 { grid-column: span 12; }
  }
  
  @media (max-width: 768px) {
    .sidebar { position: fixed; right: 0; top: 0; transform: translateX(100%); z-index: 300; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close-btn { display: block; }
    .sidebar-overlay.visible { display: block; opacity: 1; }
    
    .bento-container { padding: 16px; gap: 16px; }
    .topbar { padding: 0 16px; }
    
    .generator-actions { flex-direction: column; gap: 16px; align-items: stretch;}
    .magic-prompt { align-self: flex-start; }
    .image-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  }
  
  @media (min-width: 769px) {
    #sidebarToggle { display: none; }
  }