/* ===========================
   CIT-CHAT-BOT · style.css
   هوية بصرية برتقالية رسمية
   =========================== */

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
  /* ── ألوان هوية الكلية ── */
  --orange:       #e87820;
  --orange-dark:  #c45f0a;
  --orange-light: #fef0e4;
  --orange-mid:   #f59640;
  --orange-glow:  rgba(232,120,32,0.18);

  /* ── محايدة ── */
  --dark:         #1a1208;
  --dark-2:       #2d1f0e;
  --surface:      #ffffff;
  --bg:           #fdf8f3;
  --border:       #eedcc8;
  --text:         #1a1208;
  --text-muted:   #8a6a4a;

  /* ── فقاعات ── */
  --bot-bg:       #fff7f0;
  --bot-border:   #f0c898;
  --user-bg:      linear-gradient(135deg, #e87820, #c45f0a);

  --radius:    20px;
  --shadow-sm: 0 2px 8px rgba(232,120,32,0.12);
  --shadow-md: 0 8px 32px rgba(232,120,32,0.16);
  --shadow-lg: 0 20px 60px rgba(200,90,10,0.18);
}

html, body {
  height: 100%;
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ════════════════════════════
   خلفية هندسية
════════════════════════════ */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.geo {
  position: absolute;
  border-radius: 50%;
  opacity: 0.06;
  animation: geoFloat 22s ease-in-out infinite alternate;
}
.g1 {
  width: 600px; height: 600px;
  background: var(--orange);
  top: -180px; right: -140px;
  animation-duration: 24s;
}
.g2 {
  width: 420px; height: 420px;
  background: var(--orange-dark);
  bottom: -120px; left: -100px;
  animation-duration: 30s;
  animation-delay: -10s;
}
.g3 {
  width: 280px; height: 280px;
  background: var(--orange-mid);
  top: 38%; left: 28%;
  animation-duration: 18s;
  animation-delay: -5s;
}

@keyframes geoFloat {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(40px,25px) scale(1.06); }
}

/* خطوط شبكة خلفية خفيفة */
.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(232,120,32,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,120,32,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ════════════════════════════
   Shell الرئيسي
════════════════════════════ */
.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

/* ════════════════════════════
   Header
════════════════════════════ */
.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--dark);
  border-bottom: 2px solid var(--orange);
  flex-shrink: 0;
  gap: 12px;
}

.hdr-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(232,120,32,0.5));
}

.logo-mark svg { width: 100%; height: 100%; }

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.5px;
  line-height: 1;
}

.brand-dash { color: var(--orange); }

.brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 3px;
  font-weight: 400;
}

.hdr-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.online-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}

.online-pill .dot {
  width: 7px; height: 7px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:0.6; transform:scale(1.3); }
}

.site-btn {
  font-size: 12px;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  color: var(--orange);
  border: 1.5px solid var(--orange);
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.site-btn:hover {
  background: var(--orange);
  color: white;
  box-shadow: 0 0 16px rgba(232,120,32,0.4);
}

/* ════════════════════════════
   Chat Box
════════════════════════════ */
.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.chat-box::-webkit-scrollbar { width: 4px; }
.chat-box::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

/* ════════════════════════════
   أسئلة سريعة
════════════════════════════ */
.quick-wrap {
  margin-bottom: 4px;
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.6s;
  opacity: 0;
}

.quick-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 10px;
  padding-right: 4px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.q-chip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 8px 16px;
  font-size: 13px;
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  color: var(--dark-2);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.q-chip:hover {
  background: var(--orange-light);
  border-color: var(--orange);
  color: var(--orange-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ════════════════════════════
   Messages
════════════════════════════ */
.msg {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  animation: fadeUp 0.3s ease both;
}

.msg.user-msg  { flex-direction: row-reverse; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* أيقونة البوت */
.bot-icon {
  width: 36px; height: 36px;
  flex-shrink: 0;
  background: var(--dark);
  border: 2px solid var(--orange);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: var(--orange);
  box-shadow: 0 0 10px rgba(232,120,32,0.25);
}

/* فقاعات */
.bubble {
  max-width: 70%;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.85;
  word-wrap: break-word;
}

.bot-msg .bubble {
  background: var(--bot-bg);
  border: 1.5px solid var(--bot-border);
  border-radius: 4px 18px 18px 18px;
  color: var(--text);
}

.user-msg .bubble {
  background: var(--user-bg);
  color: white;
  border-radius: 18px 4px 18px 18px;
  box-shadow: 0 4px 14px rgba(232,120,32,0.35);
}

.bubble strong { font-weight: 700; color: var(--orange-dark); }
.user-msg .bubble strong { color: #ffe4c4; }

.bubble ul { list-style: none; margin: 6px 0; padding: 0; }
.bubble ul li { padding: 2px 0; }
.bubble ul li::before { content: '◈ '; color: var(--orange); font-size: 11px; }
.user-msg .bubble ul li::before { color: rgba(255,255,255,0.7); }

.bubble a { color: var(--orange-dark); text-decoration: underline; word-break: break-all; }
.user-msg .bubble a { color: #ffd4a8; }

.bubble br { line-height: 2.2; }

/* ── Loading dots ── */
.loading-bbl {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 16px 20px !important;
}
.loading-bbl span {
  width: 9px; height: 9px;
  background: var(--orange);
  border-radius: 50%;
  animation: dotBounce 1.1s infinite ease-in-out;
  opacity: 0.7;
}
.loading-bbl span:nth-child(2) { animation-delay: 0.18s; }
.loading-bbl span:nth-child(3) { animation-delay: 0.36s; }

@keyframes dotBounce {
  0%,80%,100% { transform: scale(0.65); opacity: 0.4; }
  40%          { transform: scale(1.15); opacity: 1; }
}

/* spin icon */
.spin { animation: spinR 1s linear infinite; }
@keyframes spinR { to { transform: rotate(360deg); } }

/* ════════════════════════════
   Footer / Input
════════════════════════════ */
.ftr {
  padding: 12px 18px 16px;
  border-top: 1.5px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 9px 9px 9px 16px;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.input-row:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-glow);
}

#user-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
  max-height: 130px;
  overflow-y: auto;
  text-align: right;
}

#user-input::placeholder { color: var(--text-muted); }

#send-btn {
  width: 44px; height: 44px;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 3px 10px rgba(232,120,32,0.4);
}

#send-btn:hover:not(:disabled) {
  background: var(--orange-dark);
  box-shadow: 0 4px 16px rgba(196,95,10,0.5);
}

#send-btn:active:not(:disabled) { transform: scale(0.92); }
#send-btn:disabled { opacity: 0.6; cursor: default; }
#send-btn svg { width: 18px; height: 18px; }

.ftr-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}
.ftr-note a {
  color: var(--orange);
  text-decoration: none;
  font-weight: 600;
}
.ftr-note a:hover { text-decoration: underline; }

/* ════════════════════════════
   Responsive
════════════════════════════ */
@media (max-width: 600px) {
  .shell { border-radius: 0; max-width: 100%; }
  .hdr { padding: 12px 16px; }
  .brand-name { font-size: 18px; }
  .site-btn { display: none; }
  .online-pill span:last-child { display: none; }
  .bubble { max-width: 84%; font-size: 13.5px; }
  .chips { gap: 6px; }
  .q-chip { font-size: 12px; padding: 7px 12px; }
}

/* ══════════════════════════════════
   CIT-CHAT-BOT v2 — إضافات
══════════════════════════════════ */

/* زر مسح المحادثة */
.clear-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  transition: all .2s;
}
.clear-btn svg { width: 16px; height: 16px; }
.clear-btn:hover { border-color: #e87820; color: #e87820; }

/* شارة مصدر الرد */
.src-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 8px;
  margin-right: 4px;
  opacity: .8;
}
.src-local { background: rgba(63,185,80,.15); color: #3fb950; }
.src-ai    { background: rgba(88,166,255,.15); color: #58a6ff; }

/* شارة مرفوض */
.src-blocked {
  background: rgba(248,81,73,.15);
  color: #f85149;
}
