

/* Base + Variables */
* { box-sizing: border-box; margin:0; padding:0; }
html, body { height: 100%; }
:root{
  --bg-gradient:
    radial-gradient(1200px 600px at 20% -10%, #dbeafe 0%, transparent 50%),
    radial-gradient(800px 400px at 120% 10%, #fce7f3 0%, transparent 50%),
    linear-gradient(130deg, #f8fafc 0%, #eef2ff 100%);
  --card: rgba(255,255,255,0.7);
  --text: #0f172a;
  --muted:#475569;
  --border: rgba(15,23,42,.08);
  --shadow: 0 10px 30px rgba(2,6,23,.08), 0 1px 0 rgba(2,6,23,.04) inset;
  --radius: 16px;
  --radius-lg: 20px;
  --blur: 10px;
  --accent: #6366f1;
  --accent2:#8b5cf6;
  --accent-weak: rgba(99,102,241,.12);
}

body.dark-mode{
  --bg-gradient:
    radial-gradient(1200px 600px at -10% -20%, #0b1220 0%, transparent 50%),
    radial-gradient(800px 400px at 110% -10%, #1b1830 0%, transparent 50%),
    linear-gradient(180deg,#0b1220 0%, #0b1220 100%);
  --card: rgba(15,23,42,0.7);
  --text:#e5e7eb;
  --muted:#94a3b8;
  --border: rgba(148,163,184,.16);
  --shadow: 0 10px 30px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.02) inset;
  --accent:#8b5cf6;
  --accent2:#22d3ee;
  --accent-weak: rgba(139,92,246,.14);
}

body{
  direction: rtl;
  font-family: 'Vazirmatn', sans-serif;
  color: var(--text);
  background: var(--bg-gradient) fixed;
  padding: 24px clamp(12px,4vw,48px);
  padding-bottom: 220px;
  line-height: 1.75;
}

/* Links */
a{ color: var(--accent); text-decoration: none; }
a:hover{ text-decoration: underline; }

/* Nice scrollbars (sidebar & response only) */
#sidebar, #response{
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
#sidebar::-webkit-scrollbar, #response::-webkit-scrollbar{ width:8px; height:8px; }
#sidebar::-webkit-scrollbar-thumb, #response::-webkit-scrollbar-thumb{
  background: var(--accent-weak);
  border-radius: 999px;
}

/* ---------- Header (if any image/title) ---------- */
header{ width:100%; text-align:center; margin-bottom: 32px; }
header img{ width:220px; height:auto; border-radius: 12px; box-shadow: var(--shadow); }
header h1{ font-size: clamp(20px, 2vw, 26px); font-weight: 800; color: var(--accent); }

/* ---------- State Widget (fixed small card) ---------- */
#stateFix{
  position: fixed; right: 16px; bottom: 16px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
  font-size: 12px; line-height: 1.9;
  padding: 10px 12px;
  backdrop-filter: blur(var(--blur));
  z-index: 10050650;
}
#stateFix .btn{
  background: linear-gradient(90deg,var(--accent),var(--accent2));
  color:#fff; border:none; border-radius:10px; padding:4px 8px; font-weight:700;
}
#stateFix .btn:hover{ filter: brightness(1.05); transform: translateY(-1px); }

/* ---------- Layout ---------- */
#main{
  width:100%; display:flex; gap: 18px; position: relative;
}
#main > a{
  font-size: 13px; position:absolute; left:0; top:-18px; z-index:2;
  padding: 2px 6px; border-left: 1px solid var(--border); color: var(--muted);
}
#main > a:hover{ background: var(--accent-weak); border-radius: 6px; color: var(--text); }

/* ---------- Sidebar (glass card) ---------- */
#sidebar{
  width: 26%;
  height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 16px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  position: sticky;
  top: 12px;
}
#sidebar > span{ display:none; }
#sidebar h3{
  font-size: 14px; color: var(--muted);
  letter-spacing:.2px; margin-bottom:8px;
}
#sidebar .recent-question,
.sidebar-content li{
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  transition: .2s ease;
  font-size: 13px;
  height:34px;
  overflow:hidden;
  list-style-type:none;
  display:flex;
  align-items:start;
}
#sidebar .recent-question:hover,
.sidebar-content li:hover{
  border-color: var(--border);
  background: var(--accent-weak);
  transform: translateY(-1px);
}

/* ---------- Response Panel (glass canvas) ---------- */
#response{
    margin-bottom:100px;
  width: 74%;
  min-height: 68vh;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  position: relative;
  overflow: auto;
  background-image: url(parnian.png);
  background-repeat: no-repeat;
  background-position: top center;
  background-size: 220px;
}
#response > div{ padding: 14px; border-radius: 12px; }
#response > div:nth-of-type(even){
  background: rgba(99,102,241,.06);
  border: 1px dashed var(--border);
}
#response h1, #response h2, #response h3{ font-size: 16px; margin: 8px 0 6px; }
#response h1::before{ content: "💡 "; }
#response h2::before{ content: "📌 "; }
#response h3::before{ content: "📎 "; }
#response ul{ list-style:none; padding-right: 12px; }
#response ul li::before{ content:"✅ "; margin-left: 6px; }

/* ---------- Code Blocks ---------- */
.code-wrapper{
  background: #0b1020;
  border-radius: 12px; margin-top: 12px; overflow: hidden; border:1px solid #131a2e;
}
.code-label{
  background: #121a33; color:#cbd5e1; padding: 10px 14px; font-weight:700;cursor:pointer;
}
xmp{
  background:#0b1020; color:#e2e8f0; padding: 14px 16px;
  direction: ltr; text-align:left; font-family:"DM Mono",monospace;
  border-radius: 0 0 12px 12px; position:relative; 
}
xmp::before{
  content:'مدرسه فرانت اند پرنیان';
  position:absolute; left: 8px; top:-34px; font-size: 12px;
  background:#e2e8f0; color:#0b1020; padding:6px 10px; border-radius:10px 10px 0 0;
  font-family:'Vazirmatn', sans-serif;
}

/* ---------- Chat (fixed glass bar) ---------- */
.w-chat{
  position: fixed; left:0; bottom:0; width:100%;
  background: transparent; z-index: 100;
  padding: 12px 0;
}
.chat-box{
  width: min(980px, 92%);
  margin: auto; height: auto;
  display:flex; align-items:center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  border-radius: var(--radius-lg);
  padding: 10px 12px;
}
.chat-box textarea{
  width: 100%; height: 48px; resize:none; outline: none;
  border: 1px solid var(--border); border-radius: 12px;
  background: rgba(148,163,184,.12);
  color: var(--text); font-size: 15px; padding: 12px 14px;
  transition: border-color .2s ease, background .2s ease;
    font-family:'Vazirmatn', sans-serif;

}
.chat-box textarea:focus{
  border-color: var(--accent);
  background: rgba(99,102,241,.08);
  box-shadow: 0 0 0 4px var(--accent-weak);
}
.chat-box button#ask-btn{
  width: max(140px, 18%);
  height: 48px;
  border:none; border-radius: 12px; cursor:pointer; font-weight:800;
  color:#fff; letter-spacing:.2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: transform .15s ease, filter .2s ease;
}
.chat-box button#ask-btn:hover{ transform: translateY(-1px); filter: brightness(1.05); }
.chat-box button#ask-btn:disabled{ opacity:.6; cursor:not-allowed; }

#loading{
  width: 22%; height: 48px; min-width: 120px;
  background-image:url('load.gif'); background-size:cover; background-position:center;
  display:none; border-radius: 12px; border:1px solid var(--border);
}

/* ---------- Speak button (compact chip) ---------- */
#speak{
  position:absolute; left: 6px; top: 12px;
  height: 36px; display:flex; align-items:center; gap:8px;
  padding: 0 10px; cursor:pointer;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
}
#speak svg{ width: 20px; }

/* ---------- Welcome Modal ---------- */
#welcome-modal{
  position: fixed; inset:0; z-index: 9999; font-family:'Vazirmatn',sans-serif;
}
.welcome-backdrop{
  position:absolute; inset:0; background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
}
.welcome-content{
  position:absolute; left:50%; top:50%; transform: translate(-50%, -50%);
  width: min(520px, 92%); padding: 26px;
  background: var(--card); color:var(--text);
  border:1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
  backdrop-filter: blur(calc(var(--blur) + 2px));
  text-align: center;
}
.welcome-content h2{ margin-bottom: 8px; }
.welcome-content ul{ list-style:none; padding:0; text-align:right; }
.welcome-content li{ margin: 10px 0; font-size: 14px; color: var(--muted); }
#welcome-modal button, .btn{
  margin-top: 16px; padding: 10px 18px; border:none; cursor:pointer;
  border-radius: 12px; font-weight:800; color:#fff;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
#welcome-modal button:hover, .btn:hover{ filter: brightness(1.05); transform: translateY(-1px); }

/* ---------- Version Popup ---------- */
.popup{
  position: fixed; inset:0; display:none; z-index:10000;
  justify-content:center; align-items:center; background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}
.popup-content{
  position: relative; width:min(520px,92%); padding: 22px;
  background: var(--card); color: var(--text);
  border:1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  animation: fadeIn .25s ease;
}
.close-btn{
  position:absolute; top: 12px; right: 14px; font-size: 22px; color: var(--muted);
  cursor:pointer; transition: .2s ease;
}
.close-btn:hover{ color: var(--text); transform: scale(1.05); }
@keyframes fadeIn{ from{opacity:0; transform: translateY(4px);} to{opacity:1; transform:translateY(0);} }

/* ---------- Dark Mode Toggle (fab) ---------- */
#dark-mode-toggle{
  position: fixed; top: 14px; right: 14px; z-index: 1000;
  width: 44px; height: 44px; border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  border: 1px solid var(--border);
  color:#fff; background:
    radial-gradient(120px 120px at 30% 30%, var(--accent2), transparent 60%),
    radial-gradient(140px 140px at 70% 70%, var(--accent), transparent 60%),
    #0b1020;
  box-shadow: var(--shadow);
  transition: transform .15s ease, filter .2s ease, background .3s ease;
}
#dark-mode-toggle:hover{ transform: translateY(-1px); filter: brightness(1.06); }
#dark-mode-toggle svg{ width: 22px; }

/* ---------- Buttons (generic) ---------- */
button{ font-family:'Vazirmatn',sans-serif; }
button:disabled{ opacity:.6; cursor:not-allowed; }

/* ---------- Search input (if enabled) ---------- */
#searchInput{
  width: 28%; height: 42px; border-radius: 12px;
  border:1px solid var(--border); padding: 0 12px; color: var(--text);
  background: rgba(148,163,184,.12);
}
#searchInput::placeholder{ font-family:'Vazirmatn',sans-serif; }

/* ---------- Typography cleanups ---------- */
p:empty{ display:none; }

/* ---------- Mobile / Responsive ---------- */
.menu-icon{
  display:none; font-size: 26px; background:none; border:none; cursor:pointer; margin:10px;
  color: var(--text);
}
@media (max-width: 992px){
  #response{ width:100%; }
  #sidebar{ display:none; }
}
@media (max-width: 768px){
  .menu-icon{ display:inline-block; }
  #sidebar{
    display:block; position: fixed; top:0; right:-420px; width: 75% !important; height:100%;
    border-left:1px solid var(--border); border-radius: 0;
    transition: right .28s ease; z-index:1000;
  }
  #sidebar.open{ right:0; }
  #sidebar > span{
    display:block !important; position:absolute; left:14px; top:14px; cursor:pointer;
    background: var(--card); border:1px solid var(--border); border-radius: 10px; padding: 2px 8px;
  }
  #stateFix{ display:none; }
  #response{ background-size: 85% !important; }
  .chat-box{ width: 95% !important; }
  #loading{ display:none !important; } /* جا برای دکمه بیشتر */
}

/* ---------- Misc (fixes) ---------- */
#retry-btn{
  display:inline-block; margin-top:14px; padding:10px 16px; border:none; border-radius: 10px;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); color:#fff; font-weight:800; cursor:pointer;
}
#response span>br:only-of-type{ display:none; }

/* Keep your original “motto” if used */
#motto{
  margin-top:-10px; background: var(--card); color:var(--text);
  padding: 16px; border-radius: 12px; border:1px solid var(--border);
  box-shadow: var(--shadow); position: relative; z-index: 2;
}



/*darkkkkkkkkk////////////*/

popup-content,
#welcome-modal .welcome-content,
.chat-box,
#sidebar {
    color: #212529;
    transition: background 0.3s, color 0.3s;
}

/* حالت دارک */
body.dark-mode {
    background: #121212;
    color: #e4e4e4;
}

body.dark-mode .popup-content,
body.dark-mode #welcome-modal .welcome-content,
body.dark-mode .chat-box,
body.dark-mode #sidebar {
    background: #1e1e1e;
    color: #e4e4e4;
}

body.dark-mode a {
    color: #4dabf7;
}

body.dark-mode button {
    background: #333;
    color: #fff;
}

/* دکمه سوییچ دارک/لایت */
#dark-mode-toggle {
    width:40px;
    height:40px;
    position: fixed;
    display:flex;
    justify-content:center;
    align-items:center;
    top: 10px;
    right: 10px;
    background: #00195a;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    z-index: 1000;
    transition: background 0.3s;
}
svg{
    width:30px;
}
#mic-btn svg{
    color:black;
}

