/* ============================================================
   DiBOT-WEB V1 - site.css
   DesignV5: warm paper, solid colour blocks, 2.5px ink borders,
   hard offset shadows, zero rounded corners, oversized display type.
   Colours come from the Website tab as CSS variables (index.php).
   ============================================================ */

:root {
  --primary: #1974D2; --accent: #FFC229; --red: #ED2939; --green: #05994A;
  --navy: #19213D; --ink: #12182B; --paper: #FBF7EF; --white: #FFFFFF;
  --line: 2.5px; --sh: 6px; --sh-sm: 4px;
  --display: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  --body: 'Lato', 'Inter', Arial, sans-serif;
  --arabic: 'Cairo', 'Lato', Tahoma, sans-serif;
  --nav-h: 66px;
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; border-radius: 0 !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.55;
  overflow-anchor: none; min-height: 100dvh; display: flex; flex-direction: column;
}
html[dir="rtl"] body, [dir="rtl"] { font-family: var(--arabic); }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: inherit; }
/* Visually hidden without pushing it off-screen: a -9999px offset makes an
   Arabic (right to left) page scroll sideways. */
.skip { position: absolute; top: 8px; inset-inline-start: 8px; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip:focus { width: auto; height: auto; clip: auto; clip-path: none; z-index: 50; background: var(--accent);
  padding: 8px 12px; border: var(--line) solid var(--ink); }

/* The backbone: a hard box. RTL mirrors the shadow. */
.hard    { border: var(--line) solid var(--ink); box-shadow: var(--sh) var(--sh) 0 var(--ink); }
.hard-sm { border: var(--line) solid var(--ink); box-shadow: var(--sh-sm) var(--sh-sm) 0 var(--ink); }
[dir="rtl"] .hard    { box-shadow: calc(var(--sh) * -1) var(--sh) 0 var(--ink); }
[dir="rtl"] .hard-sm { box-shadow: calc(var(--sh-sm) * -1) var(--sh-sm) 0 var(--ink); }

/* ---------------- NAV ---------------- */
.nav {
  display: flex; align-items: center; gap: 18px; padding: 10px 24px;
  background: var(--white); border-bottom: var(--line) solid var(--ink); min-height: var(--nav-h); flex-shrink: 0;
}
.nav-brand { display: flex; align-items: center; gap: 14px; text-decoration: none; min-width: 0; }
.nav-logo { height: 38px; width: auto; }
.nav-name { font-family: var(--display); font-size: 24px; letter-spacing: -0.5px; }
.nav-tag {
  font-size: 11px; font-weight: 900; letter-spacing: 2.4px; text-transform: uppercase;
  background: var(--accent); color: var(--ink); padding: 4px 8px; border: 2px solid var(--ink); white-space: nowrap;
}
[dir="rtl"] .nav-tag { letter-spacing: 0; font-size: 12px; }
.nav-links { display: flex; gap: 6px; margin-inline-start: auto; }
.nav-ask {
  background: none; border: var(--line) solid transparent; padding: 8px 12px; font-weight: 900; font-size: 14px;
  cursor: pointer; color: var(--ink); min-height: 44px;
}
.nav-ask:hover, .nav-ask:focus-visible { border-color: var(--ink); background: var(--accent); outline: none; }
.lang {
  background: var(--ink); color: var(--white); font-weight: 900; font-size: 14px; padding: 8px 14px; cursor: pointer;
  min-height: 44px; min-width: 64px; font-family: var(--arabic);
}
.nav-links:empty + .lang, .nav-brand + .lang { margin-inline-start: auto; }
.lang:hover { background: var(--primary); }

/* ---------------- HERO: a solid colour block ---------------- */
.hero {
  background: var(--primary); color: var(--white); border-bottom: var(--line) solid var(--ink);
  display: flex; align-items: stretch; gap: 0; flex-shrink: 0; overflow: hidden;
}
.hero-in { padding: 22px 28px 20px; flex: 1; min-width: 0; }
.hero-h {
  font-family: var(--display); font-weight: 400; font-size: clamp(30px, 3.4vw, 50px); line-height: 1.04;
  letter-spacing: -1px; margin: 0 0 10px; text-transform: none;
}
[dir="rtl"] .hero-h { font-family: var(--arabic); font-weight: 900; letter-spacing: 0; line-height: 1.25; }
.hero-h mark {
  background: var(--accent); color: var(--ink); padding: 0 .14em; border: var(--line) solid var(--ink);
  box-shadow: var(--sh-sm) var(--sh-sm) 0 var(--ink); display: inline-block; line-height: 1.1; margin: 0 .04em;
}
[dir="rtl"] .hero-h mark { box-shadow: calc(var(--sh-sm) * -1) var(--sh-sm) 0 var(--ink); }
.hero-p { margin: 0; font-size: 16px; max-width: 760px; font-weight: 700; opacity: .95; }
.tiles { display: grid; grid-template-columns: repeat(2, 64px); grid-auto-rows: 64px; flex-shrink: 0;
  border-inline-start: var(--line) solid var(--ink); }
.tile { display: block; overflow: hidden; border: 1px solid var(--ink); background: var(--accent); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile.ta { background: var(--accent); } .tile.tb { background: var(--red); }
.tile.tc { background: var(--green); } .tile.td { background: var(--navy); }
.tile.ta, .tile.td { background-image: linear-gradient(90deg, transparent 40%, rgba(255,255,255,.35) 40% 60%, transparent 60%); }
.tile.tb, .tile.tc { background-image: radial-gradient(circle at 0 100%, transparent 38%, rgba(255,255,255,.35) 38% 56%, transparent 56%); }

/* ---------------- GRID ---------------- */
.grid {
  display: grid; grid-template-columns: 280px minmax(0, 1fr) 280px; gap: 26px;
  padding: 24px 26px 30px; max-width: 1380px; width: 100%; margin: 0 auto; align-items: start;
}
.col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* ---------------- PANELS: colour-blocked header strip ---------------- */
.panel { background: var(--white); }
.ph {
  margin: 0; padding: 10px 14px; font-family: var(--display); font-weight: 400; font-size: 15px;
  letter-spacing: .4px; text-transform: uppercase; border-bottom: var(--line) solid var(--ink); color: var(--white);
}
[dir="rtl"] .ph { font-family: var(--arabic); font-weight: 900; text-transform: none; font-size: 16px; }
.c-primary .ph { background: var(--primary); }
.c-red .ph     { background: var(--red); }
.c-green .ph   { background: var(--green); }
.c-accent .ph  { background: var(--accent); color: var(--ink); }
.c-navy .ph    { background: var(--navy); }
.pb { padding: 14px; font-size: 14.5px; }
.pb p { margin: 0; }
.row { padding: 8px 0; border-bottom: 1.5px dashed rgba(18, 24, 43, .22); }
.row:last-child { border-bottom: none; padding-bottom: 0; }
.row:first-child { padding-top: 0; }
.row strong { display: block; font-size: 11.5px; letter-spacing: .8px; text-transform: uppercase; font-weight: 900; }
[dir="rtl"] .row strong { letter-spacing: 0; font-size: 13px; text-transform: none; }
.row a { color: var(--primary); font-weight: 700; text-decoration: none; }
.row a:hover { text-decoration: underline; }
.rot .rot-body { transition: opacity .4s ease; }
.rot .rot-body.out { opacity: 0; }
.rot .k { color: var(--primary); font-weight: 900; }
.dots { display: flex; gap: 5px; justify-content: center; padding: 0 14px 12px; }
.dots i { width: 9px; height: 9px; border: 2px solid var(--ink); background: var(--white); transition: background .25s, width .25s; }
.dots i.on { background: var(--ink); width: 22px; }
.social { display: flex; gap: 10px; flex-wrap: wrap; }
.social a {
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--accent);
  font-family: var(--display); font-size: 16px; text-decoration: none; color: var(--ink); transition: transform .12s, box-shadow .12s;
}
.social a:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

/* ---------------- CHAT ---------------- */
.chat { background: var(--white); display: flex; flex-direction: column; overflow: hidden; height: calc(100dvh - 250px); min-height: 440px; }
.chat-head {
  background: var(--ink); color: var(--white); display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-bottom: var(--line) solid var(--ink); flex-shrink: 0;
}
.avatar { width: 54px; height: 54px; background: var(--white); border: var(--line) solid var(--accent); overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 16%; }
.avatar.talk { animation: talk .6s ease-in-out infinite; border-color: var(--red); }
@keyframes talk { 50% { transform: translateY(-2px); } }
.chat-title { flex: 1; min-width: 0; }
.chat-logo { height: 24px; width: auto; }
.status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; margin-top: 4px; opacity: .9; }
.status i { width: 9px; height: 9px; background: #50C878; border: 2px solid var(--white); }
.voice {
  width: 46px; height: 46px; background: transparent; border: var(--line) solid var(--white); color: var(--white);
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.voice svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.voice svg path:first-child { fill: currentColor; }
.voice .w1, .voice .w2 { display: none; }
.voice[aria-pressed="true"] { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.voice[aria-pressed="true"] .w1, .voice[aria-pressed="true"] .w2 { display: block; }
.voice[aria-pressed="true"] .x { display: none; }

.msgs {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 20px 18px 36px;
  display: flex; flex-direction: column; gap: 16px; background: var(--paper);
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background-image: linear-gradient(rgba(18,24,43,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(18,24,43,.045) 1px, transparent 1px);
  background-size: 22px 22px;
}
/* Nothing in the conversation may shrink, or a card gets crushed. */
.msgs > * { flex-shrink: 0; }
.msgs::after { content: ""; display: block; height: 8px; flex-shrink: 0; }

.msg { max-width: 84%; padding: 12px 16px; font-size: 15.5px; line-height: 1.6; overflow-wrap: anywhere; animation: rise .28s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.bot { align-self: flex-start; background: var(--white); border: var(--line) solid var(--ink); box-shadow: var(--sh-sm) var(--sh-sm) 0 var(--ink); }
.msg.me  { align-self: flex-end; background: var(--primary); color: var(--white); border: var(--line) solid var(--ink); box-shadow: var(--sh-sm) var(--sh-sm) 0 var(--ink); }
.msg[dir="rtl"], .msg:dir(rtl) { font-family: var(--arabic); }
.msg.bot:dir(rtl), .msg.me:dir(rtl) { box-shadow: calc(var(--sh-sm) * -1) var(--sh-sm) 0 var(--ink); }
.msg strong { font-weight: 900; }
.msg a { color: var(--primary); font-weight: 700; }
.msg.me a { color: var(--white); }
.msg.err { background: #FFF1F2; border-color: var(--red); }
.typing { display: inline-flex; gap: 6px; padding: 3px 0; }
.typing i { width: 9px; height: 9px; background: var(--ink); animation: bob 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 60%, 100% { transform: none; opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Cards: stacked, full width. Never a sideways scroller in here. */
.cards { display: flex; flex-direction: column; gap: 12px; width: 100%; animation: rise .35s ease; }
.card {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--white); color: var(--ink);
  text-decoration: none; border: var(--line) solid var(--ink); box-shadow: var(--sh-sm) var(--sh-sm) 0 var(--ink);
  transition: transform .12s, box-shadow .12s; min-height: 84px;
}
[dir="rtl"] .card { box-shadow: calc(var(--sh-sm) * -1) var(--sh-sm) 0 var(--ink); }
a.card:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.card-art { width: 112px; height: 58px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.card-art img { max-height: 54px; max-width: 112px; width: auto; object-fit: contain; }
.card-mark { font-family: var(--display); font-size: 21px; letter-spacing: -.5px; white-space: nowrap; }
.card-mark b { color: var(--primary); font-weight: 400; }
.card-body { flex: 1; min-width: 0; }
.card-t { font-weight: 900; font-size: 15px; margin: 0 0 2px; }
.card-l { font-size: 13.5px; margin: 0; opacity: .8; line-height: 1.45; }
.card-go { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 900; background: var(--accent); border: 2px solid var(--ink); padding: 2px 8px; }
.card-badge { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 900; background: var(--red); color: var(--white); border: 2px solid var(--ink); padding: 2px 8px; }

.tiles2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; animation: rise .35s ease; }
.t2 {
  display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--white); border: var(--line) solid var(--ink);
  box-shadow: var(--sh-sm) var(--sh-sm) 0 var(--ink); cursor: pointer; text-align: start; font-weight: 900; font-size: 13.5px;
  color: var(--ink); min-height: 60px; transition: transform .12s, box-shadow .12s, background .12s;
}
[dir="rtl"] .t2 { box-shadow: calc(var(--sh-sm) * -1) var(--sh-sm) 0 var(--ink); }
.t2:hover { background: var(--accent); transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.t2 .sq { width: 30px; height: 30px; flex-shrink: 0; border: 2px solid var(--ink); background: var(--primary); }
.t2:nth-child(4n+2) .sq { background: var(--red); } .t2:nth-child(4n+3) .sq { background: var(--green); } .t2:nth-child(4n+4) .sq { background: var(--accent); }
.t2 img { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; }

.stat {
  width: 100%; background: var(--navy); color: var(--white); padding: 18px 20px; border: var(--line) solid var(--ink);
  box-shadow: var(--sh) var(--sh) 0 var(--accent); position: relative; animation: rise .35s ease;
}
[dir="rtl"] .stat { box-shadow: calc(var(--sh) * -1) var(--sh) 0 var(--accent); }
.stat-f { font-family: var(--display); font-size: 44px; line-height: 1; color: var(--accent); }
.stat-c { font-size: 14px; margin-top: 6px; opacity: .92; }
.stat-t { font-weight: 900; font-size: 15px; margin-top: 8px; text-transform: uppercase; letter-spacing: .5px; }
[dir="rtl"] .stat-t { text-transform: none; letter-spacing: 0; }

/* Suggestions: always 3 to 5, fixed minimum height so nothing jumps */
.chips {
  display: flex; flex-wrap: wrap; gap: 9px; padding: 12px 14px; min-height: 64px; align-content: center;
  border-top: var(--line) solid var(--ink); background: var(--white); flex-shrink: 0;
}
.chip {
  background: var(--white); border: 2px solid var(--ink); padding: 7px 13px; font-size: 13.5px; font-weight: 900;
  cursor: pointer; color: var(--ink); min-height: 40px; box-shadow: 3px 3px 0 var(--ink); transition: transform .1s, box-shadow .1s, background .1s;
  animation: rise .25s ease;
}
[dir="rtl"] .chip { box-shadow: -3px 3px 0 var(--ink); font-family: var(--arabic); }
.chip:hover, .chip:focus-visible { background: var(--accent); transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); outline: none; }

.composer { display: flex; gap: 10px; padding: 12px; border-top: var(--line) solid var(--ink); background: var(--white); flex-shrink: 0; }
.composer input {
  flex: 1; min-width: 0; border: var(--line) solid var(--ink); padding: 12px 16px; font-size: 16px; font-family: inherit;
  background: var(--paper); color: var(--ink); outline: none;
}
.composer input:focus { background: var(--white); box-shadow: inset 0 0 0 2px var(--accent); }
.send {
  width: 52px; height: 52px; background: var(--primary); border: var(--line) solid var(--ink); color: var(--white); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 3px 3px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.send:hover { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.send svg { width: 22px; height: 22px; fill: currentColor; }
[dir="rtl"] .send svg { transform: scaleX(-1); }
.send:disabled { opacity: .5; cursor: wait; }

/* ---------------- FOOTER ---------------- */
.foot { background: var(--ink); color: var(--white); text-align: center; padding: 28px 20px 22px; border-top: var(--line) solid var(--ink); flex-shrink: 0; margin-top: auto; }
.foot-logo { height: 36px; width: auto; margin: 0 auto 12px; }
.foot-name { font-family: var(--display); font-size: 26px; margin-bottom: 8px; }
.foot-line { margin: 0 0 6px; font-size: 13.5px; opacity: .85; }
.foot-line a { color: var(--accent); text-decoration: none; font-weight: 700; }
.foot-line a:hover { text-decoration: underline; }
.foot-copy { margin: 12px 0 0; font-size: 12px; opacity: .6; }
.powered { background: var(--accent); color: var(--ink); text-align: center; padding: 9px; font-size: 12.5px; font-weight: 700; border-top: var(--line) solid var(--ink); flex-shrink: 0; }
.powered a { text-decoration: none; font-weight: 900; }
.pw1 { color: var(--red); } .pw2 { color: var(--primary); }

/* ---------------- SHORT LAPTOP SCREENS ---------------- */
@media (min-width: 901px) and (max-height: 780px) {
  .hero-in { padding: 12px 24px; }
  .hero-h { font-size: clamp(24px, 2.4vw, 34px); margin-bottom: 4px; }
  .hero-p { font-size: 14px; }
  .tiles { grid-template-columns: repeat(2, 44px); grid-auto-rows: 44px; }
  .grid { padding-top: 16px; }
}

/* ---------------- MOBILE: the chat is the whole site ---------------- */
@media (max-width: 900px) {
  .col, .tiles, .nav-links, .nav-tag, .foot, .hero-h { display: none !important; }
  .nav { padding: 8px 12px; min-height: 58px; }
  .nav-logo { height: 32px; }
  .lang { margin-inline-start: auto; }
  .hero-in { padding: 9px 14px; }
  .hero-p { font-size: 13px; line-height: 1.4; }
  .grid { grid-template-columns: 1fr; padding: 10px 10px 14px; gap: 0; }
  .chat { min-height: 420px; }
  .msgs { padding: 16px 12px 30px; }
  .msg { max-width: 92%; }
  .card { padding: 11px 12px; gap: 11px; }
  .card-art { width: 86px; } .card-art img { max-width: 86px; max-height: 44px; }
  .tiles2 { grid-template-columns: 1fr; }
  .chat-head { padding: 10px 12px; }
  .avatar { width: 48px; height: 48px; }
}
@media (max-width: 380px) {
  .chip { font-size: 12.5px; padding: 6px 10px; }
  .card-art { width: 70px; } .card-art img { max-width: 70px; }
}

/* ---------------- OFFLINE PAGE ---------------- */
body.offline { align-items: center; justify-content: center; padding: 24px; }
.off-box { background: var(--white); padding: 34px; max-width: 520px; text-align: center; }
.off-logo { max-height: 70px; width: auto; margin: 0 auto 18px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
