/* =========================================================
   Zamzam Takaful — Blue & White Theme + Dark Mode Toggle
   Structure/content kept as requested. Pure HTML/CSS/JS.
   ========================================================= */

/* ---- Reset ---- */
*{ box-sizing:border-box; }
html,body{ height:100%; background: var(--bg); color: var(--text); }
body{ margin:0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji"; line-height:1.5; }

/* ---- Theme Tokens (CSS variables) ---- */
:root{
  --bg: #f6f9ff;
  --surface: #ffffff;
  --surface-2: #f1f6ff;
  --text: #0a1a33;
  --muted: #4b5b73;
  --border: rgba(10,26,51,0.12);
  --shadow: 0 10px 30px rgba(12, 44, 90, 0.10);
  --shadow-2: 0 16px 40px rgba(12, 44, 90, 0.14);

  --brand: #1458ff;
  --brand-2: #0b2e9a;
  --brand-soft: rgba(20, 88, 255, 0.12);

  --link: #1458ff;
  --focus: rgba(20,88,255,0.35);

  --header-bg: rgba(255,255,255,0.85);
  --header-border: rgba(10,26,51,0.10);

  --success: #1f8a3b;
  --warn: #b65a00;
  --danger: #b00020;
}

[data-theme="dark"]{
  --bg: #071427;
  --surface: rgba(255,255,255,0.06);
  --surface-2: rgba(255,255,255,0.09);
  --text: #f2f6ff;
  --muted: rgba(242,246,255,0.72);
  --border: rgba(242,246,255,0.14);
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --shadow-2: 0 18px 48px rgba(0,0,0,0.42);

  --brand: #5aa3ff;
  --brand-2: #9fd0ff;
  --brand-soft: rgba(90,163,255,0.16);

  --link: #9fd0ff;
  --focus: rgba(159,208,255,0.35);

  --header-bg: rgba(7,20,39,0.70);
  --header-border: rgba(242,246,255,0.12);
}

/* ---- Layout helpers ---- */
.container{ width:min(1160px, calc(100% - 40px)); margin:0 auto; }
.section{ padding: 44px 0; }
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.card.pad{ padding: 22px; }
h1,h2,h3{ margin: 0 0 12px 0; color: var(--text); letter-spacing:-0.2px; }
p{ margin: 0 0 12px 0; color: var(--muted); }
a{ color: var(--link); text-decoration:none; }
a:hover{ text-decoration:underline; }
hr.soft{ border:none; border-top:1px solid var(--border); margin:18px 0; }

/* ---- Header + Nav ---- */
.site-header{
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--header-border);
}
.header-row{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 0;
  gap: 14px;
}
.brand{
  display:flex; align-items:center; gap: 12px; min-width: 220px;
}
.brand .logo{
  width: 40px; height: 40px; border-radius: 12px;
  background: radial-gradient(circle at 30% 20%, var(--brand-2), var(--brand));
  box-shadow: 0 10px 24px rgba(20,88,255,0.25);
  display:grid; place-items:center;
}
.brand .logo svg{ width: 26px; height: 26px; }
.brand .title{
  display:flex; flex-direction:column; line-height:1.15;
}
.brand .title b{ font-size: 14px; color: var(--text); }
.brand .title span{ font-size: 12px; color: var(--muted); }

.nav{
  display:flex; align-items:center; gap: 10px; flex-wrap:wrap; justify-content:flex-end;
}
.nav > ul{
  list-style:none; margin:0; padding:0;
  display:flex; align-items:center; gap: 6px; flex-wrap:wrap;
}
.nav li{ position:relative; }
.nav a.nav-link{
  display:inline-flex; align-items:center; gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  border: 1px solid transparent;
}
.nav a.nav-link:hover{
  background: var(--brand-soft);
  border-color: rgba(20,88,255,0.18);
  text-decoration:none;
}
.nav a.nav-link[aria-current="page"]{
  background: var(--brand-soft);
  border-color: rgba(20,88,255,0.26);
}

.dropdown{
  display:none;
  position:absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  padding: 8px;
  z-index: 9999; /* keep above other elements */
}
.dropdown a{
  display:block;
  padding: 10px 10px;
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.dropdown a:hover{
  background: var(--brand-soft);
  text-decoration:none;
}
.nav li:hover > .dropdown{ display:block; }

/* ---- Theme toggle ---- */
.header-actions{ display:flex; align-items:center; gap: 10px; }
.toggle{
  display:inline-flex; align-items:center; gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor:pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.toggle:hover{ box-shadow: var(--shadow); }
.toggle .dot{
  width: 34px; height: 20px; border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position:relative;
}
.toggle .dot::after{
  content:"";
  position:absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, var(--brand-2), var(--brand));
  transition: transform 180ms ease;
}
[data-theme="dark"] .toggle .dot::after{ transform: translateX(14px); }

/* ---- Hero slideshow ---- */
.hero{
  padding: 22px 0 0 0;
}
.slider{
  position:relative;
  border-radius: 22px;
  overflow:hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  background: linear-gradient(135deg, var(--brand-soft), transparent 55%);
}
.slides{
  display:flex;
  transition: transform 420ms ease;
  will-change: transform;
}
.slide{
  min-width: 100%;
  padding: 26px;
  display:grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items:center;
}
.slide h2{ font-size: 28px; margin-bottom: 10px; }
.kicker{
  display:inline-flex; align-items:center; gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: fit-content;
  font-weight: 700;
  font-size: 12px;
}
.slide .art{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  display:grid;
  place-items:center;
}
.slide .art img{ width: 100%; height: 210px; object-fit: contain; }

.slider-controls{
  position:absolute;
  left: 12px; right: 12px; bottom: 12px;
  display:flex; align-items:center; justify-content:space-between; gap: 10px;
}
.pills{ display:flex; gap: 8px; align-items:center; }
.pill{
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(10,26,51,0.22);
  border: 1px solid var(--border);
  cursor:pointer;
}
.pill.active{ background: var(--brand); }
.slider-btn{
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor:pointer;
}
.slider-btn:hover{ background: var(--surface-2); }

/* ---- Welcome / Why Choose ---- */
.welcome-grid{
  display:grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}
.highlight{
  background: linear-gradient(135deg, var(--brand-soft), transparent 60%);
}
.bullets{ display:grid; gap: 12px; margin-top: 10px; }
.bullet{
  display:flex; gap: 10px; align-items:flex-start;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.bullet .ic{
  width: 36px; height: 36px; border-radius: 14px;
  background: var(--brand-soft);
  border: 1px solid rgba(20,88,255,0.22);
  display:grid; place-items:center;
}
.bullet .ic svg{ width: 18px; height: 18px; }

/* ---- Products ---- */
.products-head{ display:flex; align-items:flex-end; justify-content:space-between; gap: 16px; flex-wrap:wrap; }
.badge{
  display:inline-flex; align-items:center; gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}
.product-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
  overflow: visible; /* IMPORTANT: allow popovers to show */
}
.product-card{
  position:relative;
  border-radius: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: visible; /* IMPORTANT */
}
.product-card h3{ font-size: 16px; margin-bottom: 8px; }
.product-card .meta{ color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.learn-more{
  display:inline-flex; align-items:center; gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(20,88,255,0.25);
  background: var(--brand-soft);
  color: var(--text);
  font-weight: 800;
  font-size: 12px;
  cursor: default;
  user-select:none;
  text-decoration:none;
}
.learn-more:hover{ background: rgba(20,88,255,0.16); text-decoration:none; }
.popover{
  position:absolute;
  left: 18px;
  right: 18px;
  top: calc(100% - 6px);
  margin-top: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  display:none;
  z-index: 9999; /* FIX: above next cards */
}
.popover::before{
  content:"";
  position:absolute;
  top: -8px;
  left: 26px;
  width: 14px; height: 14px;
  transform: rotate(45deg);
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.product-card:hover .popover{ display:block; }
.popover b{ color: var(--text); }
.popover ul{ margin: 10px 0 0 18px; padding:0; color: var(--muted); }
.popover li{ margin: 6px 0; }

/* ---- CTA ---- */
.cta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  flex-wrap:wrap;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(20,88,255,0.22);
  background: linear-gradient(135deg, rgba(20,88,255,0.15), rgba(255,255,255,0.0) 55%);
}
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  cursor:pointer;
  text-decoration:none;
}
.btn.primary{
  background: radial-gradient(circle at 30% 20%, var(--brand-2), var(--brand));
  color: white;
  border-color: rgba(255,255,255,0.18);
}
.btn:hover{ box-shadow: var(--shadow); text-decoration:none; }

/* ---- Footer ---- */
.site-footer{
  margin-top: 30px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(20,88,255,0.06));
}
.footer-grid{
  display:grid;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  gap: 16px;
  padding: 34px 0;
}
.footer-grid h3{ font-size: 14px; margin-bottom: 10px; }
.footer-grid p, .footer-grid a{ font-size: 13px; }
.social{
  display:flex; gap: 10px; flex-wrap:wrap;
}
.icon-btn{
  width: 42px; height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  display:grid; place-items:center;
  box-shadow: 0 10px 22px rgba(0,0,0,0.08);
}
.icon-btn:hover{ background: var(--surface-2); }
.icon-btn svg{ width: 20px; height: 20px; }
.footer-bottom{
  padding: 14px 0 26px 0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  flex-wrap:wrap;
  color: var(--muted);
  font-size: 12px;
}

/* ---- Floating WhatsApp ---- */
.fab{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
}
.fab a{
  display:inline-flex; align-items:center; gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  border: 1px solid rgba(20,88,255,0.24);
  background: radial-gradient(circle at 30% 20%, var(--brand-2), var(--brand));
  color: #fff;
  font-weight: 900;
  text-decoration:none;
}
.fab a:hover{ filter: brightness(1.02); }

/* ---- Accessibility ---- */
:focus-visible{ outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 12px; }

/* ---- Responsive ---- */
@media (max-width: 980px){
  .slide{ grid-template-columns: 1fr; }
  .slide .art img{ height: 180px; }
  .welcome-grid{ grid-template-columns: 1fr; }
  .product-grid{ grid-template-columns: 1fr; }
  .footer-grid{ grid-template-columns: 1fr; }
  .brand{ min-width: auto; }
}

/* ---- RTL support for Arabic pages ---- */
[dir="rtl"] body{ direction: rtl; }
[dir="rtl"] .header-row{ flex-direction: row-reverse; }
[dir="rtl"] .brand{ flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .nav > ul{ flex-direction: row-reverse; justify-content: flex-start; }
[dir="rtl"] .nav li:hover > .dropdown{ right: auto; left: 0; }
[dir="rtl"] .dropdown{ right: auto; left: 0; text-align: right; }
[dir="rtl"] .products-head{ flex-direction: row-reverse; }
[dir="rtl"] .cta{ flex-direction: row-reverse; }
[dir="rtl"] .footer-bottom{ flex-direction: row-reverse; }
[dir="rtl"] .fab{ right: auto; left: 18px; }
