:root{
  --bg:#111111; --panel:#1a1a1a; --panel2:#222; --accent:#3ba7ff; --txt:#e5e7eb; --muted:#a3a3a3; --electric:#5cfaff;
}
*{box-sizing:border-box}
html, body { height:100% }
body{
  margin:0; background: var(--bg); color: var(--txt);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, 'Noto Kufi Arabic', Tahoma, Arial, sans-serif;
  overflow:hidden;
}

/* WebGL & FX */
#webgl,#fx{ position:fixed; inset:0; width:100vw; height:100vh; display:block; outline:0 }
#webgl{ background:transparent; z-index:0; -webkit-tap-highlight-color:transparent; touch-action:none }
#fx{ pointer-events:none; z-index:2 }

/* Top bar */
.top-bar{
  position: fixed; top:0; inset-inline:0;
  height: 64px; background: rgba(26,26,26,.9); backdrop-filter: blur(6px);
  display:flex; align-items:center; justify-content:space-between;
  gap: 10px; padding: 8px 12px; z-index: 3; border-bottom:1px solid #2a2a2a;
}
.dropdown{ position: relative }
.btn{
  background: #2a2a2a; border:1px solid #3a3a3a; color:var(--txt);
  padding:12px 24px; border-radius:12px; cursor:pointer; font-weight:700; font-size:16px;
  min-width: 180px; white-space: nowrap; text-align: center;
}
.btn:hover{ background:#323232; border-color:#4a4a4a }
.btn.accent{ background: var(--accent); border-color: transparent; color:#02121f }
.btn.accent:hover{ filter:brightness(1.05) }

/* Dropdown menu */
.dropdown-menu{
  position:absolute; top:56px; inset-inline-end:0;
  background:#1f1f1f; border:1px solid #2b2b2b; border-radius:12px; padding:8px;
  display:none; flex-direction:column; gap:6px; min-width:200px; z-index:4;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.dropdown.show .dropdown-menu{ display:flex }
.dropdown-menu .btn{ width:100%; text-align:center; padding:10px 12px; font-size:15px }

/* Brand chip */
.brand-chip{
  position: relative; display:inline-flex; align-items:center; justify-content:center;
  padding:8px 16px; border-radius:12px; overflow:hidden; isolation:isolate; color:#fff;
  font-weight:900; letter-spacing:1px; min-width:140px; text-align:center;
  background: linear-gradient(90deg, #37b5ff, #934cff, #ff4fb3, #37b5ff);
  background-size:300% 100%; animation: chipGradient 6s linear infinite;
  box-shadow: 0 0 18px rgba(147,76,255,.25);
}
.brand-chip span{ position:relative; z-index:1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.brand-chip canvas{ position:absolute; inset:0; width:100%; height:100%; z-index:0; pointer-events:none; mix-blend-mode: screen; }
@keyframes chipGradient{ 0%{ background-position:0 0 } 50%{ background-position:100% 0 } 100%{ background-position:0 0 } }

/* Chat box */
.chatgpt-box{
  position: fixed; inset-inline:0; bottom: 64px;
  margin-inline:auto; width:min(92vw, 700px); min-height: 120px;
  background: rgba(26,26,26,.28);
  border:1px solid rgba(255,255,255,.12); border-radius:14px;
  backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%);
  z-index:2; padding:12px 14px; overflow:auto;
  box-shadow: 0 10px 30px rgba(0,0,0,.25), inset 0 0 20px rgba(255,255,255,.05);
}
.chatgpt-title{ font-weight:800; color:var(--accent); margin-bottom:6px }
.chatgpt-hint{ color:#c3c9d1; font-size:13px }

/* About button */
.about-btn{ position: fixed; bottom:14px; inset-inline-end:14px; z-index:2 }

/* Modal */
.modal{ position: fixed; inset:0; display:none; align-items:center; justify-content:center; z-index:5; background: rgba(0,0,0,.6) }
.modal.show{ display:flex }
.modal-card{
  background:#1f1f1f; border:1px solid #2b2b2b; border-radius:14px; padding:18px 20px; width:min(90vw, 360px);
  text-align:center; max-height:90vh;
}
.modal-card .title{ font-weight:800; margin:0 0 6px }
.modal-card .muted{ color:var(--muted); font-size:14px }
.modal-card .actions{ margin-top:12px }

/* Chat modal entrance animation (unified, no duplicates) */
#chatModal { align-items: flex-start; justify-content: center; padding-top: 40px; }
.modal-card.chat-window {
  transform: translateY(100px) scale(0.9);
  opacity: 0;
  transition: transform 1.5s ease, opacity 1.5s ease;
}
.modal.show .modal-card.chat-window { transform:none; opacity:1 }

/* Talk button (center bottom) */
#talkBtn{ position:fixed; bottom:140px; left:50%; transform:translateX(-50%); z-index:3 }

/* Responsive tweaks for chat */
#chatModal .chat-area{display:flex;flex-direction:column;min-height:420px}
#chatModal #chatRoot{height:100%}
#chatModal #messages{border-radius:clamp(8px,1.5vw,12px);padding:clamp(6px,1.2vw,12px)}
#chatModal #heading{font-size:clamp(14px,2.8vw,18px)}
#chatModal #selectorRow select{font-size:clamp(12px,2.6vw,14px);padding:clamp(6px,1.2vw,10px) clamp(10px,2vw,14px);min-width:unset}
#chatModal #composer input{font-size:clamp(12px,2.8vw,14px);padding:clamp(8px,1.8vw,12px) clamp(10px,2vw,14px)}
#chatModal #composer button{font-size:clamp(12px,2.8vw,14px);min-width:clamp(64px,14vw,92px);padding:0 clamp(12px,3vw,16px)}
#chatModal #composer{gap:clamp(6px,1.6vw,10px)}

@media (max-width: 420px){
  #chatModal .modal-card{padding:12px}
  #chatModal #selectorRow{justify-content:stretch}
  #chatModal #selectorRow select{width:100%}
  #chatModal .chat-area{min-height:72vh}
}
@media (min-width: 421px) and (max-width: 768px){
  #chatModal .chat-area{min-height:60vh}
}
@media (min-width: 769px){
  #chatModal .chat-area{min-height:420px}
}


.typing-dots {
    direction: ltr;
    text-align: left;
    padding: 5px;
    font-size: 16px;
    color: #999;
    display: flex;
    gap: 4px;
    letter-spacing: 2px;
}

.typing-dots .dot {
    opacity: 0.3;
    animation: bounce 1s infinite ease-in-out;
    font-weight: bold;
}

.typing-dots .dot1 { animation-delay: 0s; }
.typing-dots .dot2 { animation-delay: 0.2s; }
.typing-dots .dot3 { animation-delay: 0.4s; }

@keyframes bounce {
    0%   { opacity: 0.3; transform: translateY(0); }
    40%  { opacity: 1;   transform: translateY(-4px); }
    80%  { opacity: 0.3; transform: translateY(0); }
    100% { opacity: 0.3; }
}

.code-block {
    position: relative;
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 8px 0;
}

.code-block pre {
    margin: 0;
    overflow-x: auto;
}

.code-block code {
    font-family: "Courier New", monospace;
    font-size: 13px;
    color: #e4e4e4;
    white-space: pre;
}

.copy-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    background: #2563eb;
    color: white;
    cursor: pointer;
}

.copy-btn:hover {
    background: #1d4ed8;
}

.chat-link {
    color: #4fa3ff;
    text-decoration: underline;
    word-break: break-all;
}



.contact-btn{
  position: fixed;
  bottom:14px;
  inset-inline-start:14px;
  z-index:2;
}



.btn{
  padding: 8px 16px !important;
  font-size: 14px !important;
  border-radius: 8px !important;
}



.about-btn,
.contact-btn{
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  min-width: unset !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
  white-space: nowrap !important;
}
#talkBtn{
  padding: 24px 30px;    
  font-size: 25px;      
  border-radius: 22px;
  min-width: 200px;
  text-align: center;

  /* ✅ وميض ثابت وناعم */
  box-shadow: 0 0 18px rgba(59,167,255,0.65);
}


/* ==============================
   Chat iframe modal (AI platform)
   ============================== */
.modal-card.chat-iframe-card,
.modal-card.contact-iframe-card{
  width: min(96vw, 980px);
  padding: 0;
  overflow: hidden;
  /* اجعل النافذة Flex حتى يأخذ الـ iframe المساحة المتبقية بدون تغطية المحتوى */
  display: flex;
  flex-direction: column;
  /* حدّ أقصى طبيعي على جميع الأجهزة */
  max-height: calc(100dvh - 32px);
  /* على الديسكتوب نحتاج ارتفاع مُعرّف حتى يشتغل flex:1 داخل iframe بشكل صحيح */
  height: min(88vh, 760px);
}
.chat-iframe-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 12px 14px;
  border-bottom: 1px solid #2b2b2b;
  background: #1f1f1f;
}
.chat-iframe-title{
  font-weight: 900;
  letter-spacing: .8px;
  font-size: clamp(14px, 3.2vw, 18px);
  text-transform: uppercase;

  /* Neon gradient: blue → red → purple (animated) */
  background: linear-gradient(90deg, #00c6ff 0%, #ff2a6d 45%, #7a00ff 100%);
  background-size: 220% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;

  /* Keep "DEV" crisp on glow */
  -webkit-text-stroke: .6px rgba(255,255,255,.10);

  /* Animated glow */
  filter:
    drop-shadow(0 0 6px rgba(0, 198, 255, .55))
    drop-shadow(0 0 10px rgba(255, 42, 109, .35))
    drop-shadow(0 0 14px rgba(122, 0, 255, .35));
  /* حركة اللون ذهاباً وإياباً (يمين↔يسار) */
  animation: itaiNeonShift 3.2s ease-in-out infinite, itaiNeonPulse 1.8s ease-in-out infinite;
}

@keyframes itaiNeonShift{
  0%   { background-position: 0% 50%; }
  50%  { background-position: 200% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes itaiNeonPulse{
  0%, 100%{
    filter:
      drop-shadow(0 0 6px rgba(0, 198, 255, .50))
      drop-shadow(0 0 10px rgba(255, 42, 109, .32))
      drop-shadow(0 0 14px rgba(122, 0, 255, .30));
  }
  50%{
    filter:
      drop-shadow(0 0 9px rgba(0, 198, 255, .75))
      drop-shadow(0 0 14px rgba(255, 42, 109, .48))
      drop-shadow(0 0 18px rgba(122, 0, 255, .46));
  }
}

/* Prettier X button */
.chat-iframe-close{
  appearance:none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  box-shadow:
    0 0 0 rgba(0,0,0,0),
    0 0 14px rgba(0, 198, 255, .10);
}
.chat-iframe-close .x-icon{
  width: 20px;
  height: 20px;
}
.chat-iframe-close .x-icon path{
  stroke: rgba(255,255,255,.92);
  stroke-width: 2.4;
  stroke-linecap: round;
}
.chat-iframe-close:hover{
  transform: scale(1.05);
  background: rgba(0,0,0,.32);
  border-color: rgba(255,255,255,.26);
  box-shadow:
    0 0 18px rgba(0, 198, 255, .20),
    0 0 22px rgba(122, 0, 255, .14);
}
.chat-iframe-close:active{ transform: scale(.96); }
.chat-iframe-close:focus{
  outline: 2px solid rgba(0, 198, 255, .35);
  outline-offset: 2px;
}

/* keep iframe rules below */
#chatModal iframe#chatFrame,
#contactModal iframe#contactFrame{
  width:100%;
  /* املأ المساحة المتبقية تحت الهيدر بدون قيم ثابتة */
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  border:0;
  display:block;
  background:#0e0e0e;
}
@media (max-width: 520px){
  /* نافذة ملائمة للجوال بدون نزول طويل */
  #chatModal,
  #contactModal{
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    align-items: stretch;
  }
  .chat-iframe-card,
  .contact-iframe-card{
    width: 98vw;
    border-radius: 12px;
    /* اترك فراغ بسيط أسفل الشاشة + safe-area */
    max-height: calc(100dvh - 28px - env(safe-area-inset-bottom));
    height: calc(100dvh - 28px - env(safe-area-inset-bottom));
  }
  .chat-iframe-head{ padding: 10px 12px; }
  .chat-iframe-close{ width: 36px; height: 36px; font-size: 20px; }
  /* الـ iframe صار Flex فلا نحتاج حسابات ارتفاع */
  #chatModal iframe#chatFrame,
  #contactModal iframe#contactFrame{ height: auto; }
}

/* Desktop / Laptop: keep the window centered and full enough height */
@media (min-width: 521px){
  #chatModal,
  #contactModal{
    align-items: center;
    justify-content: center;
    padding-top: 0;
  }
  .modal-card.chat-iframe-card,
  .modal-card.contact-iframe-card{
    height: min(88vh, 760px);
    max-height: calc(100vh - 32px);
  }
}

@media (max-width: 380px){
  #chatModal iframe#chatFrame,
  #contactModal iframe#contactFrame{ height: auto; }
}


