/* =========================================================
   CodeBridge Connect - Global Styles
   Mobile-first, premium SaaS aesthetic, RTL + LTR support
   ========================================================= */

:root {
  --cb-primary: #4f46e5;
  --cb-primary-dark: #4338ca;
  --cb-secondary: #0f172a;
  --cb-accent: #22d3ee;
  --cb-bg: #f7f8fc;
  --cb-surface: #ffffff;
  --cb-text: #1e2233;
  --cb-text-muted: #6b7280;
  --cb-border: #e7e9f3;
  --cb-radius: 18px;
  --cb-radius-sm: 12px;
  --cb-shadow: 0 8px 30px rgba(17, 24, 39, 0.08);
  --cb-shadow-lg: 0 20px 60px rgba(17, 24, 39, 0.14);
  --cb-font: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html[dir="rtl"] body { font-family: 'Cairo', 'Tahoma', sans-serif; }
html[dir="ltr"] body { font-family: 'Poppins', 'Segoe UI', sans-serif; }

body {
  background: var(--cb-bg);
  color: var(--cb-text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- Buttons ---------- */
.btn-cb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  font-size: 1rem;
}
.btn-cb-primary { background: linear-gradient(135deg, var(--cb-primary), var(--cb-primary-dark)); color: #fff; box-shadow: 0 10px 25px rgba(79,70,229,.35); }
.btn-cb-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(79,70,229,.45); }
.btn-cb-outline { background: #fff; color: var(--cb-primary); border: 2px solid var(--cb-primary); }
.btn-cb-outline:hover { background: var(--cb-primary); color: #fff; }
.btn-cb-whatsapp { background: #25D366; color: #fff; }
.btn-cb-whatsapp:hover { transform: translateY(-2px); }
.btn-cb-block { width: 100%; }

/* ---------- Cards / surfaces ---------- */
.cb-card {
  background: var(--cb-surface);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  border: 1px solid var(--cb-border);
  padding: 24px;
}

.cb-navbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cb-border);
}

/* 3-column header: brand | centered nav links | actions.
   Uses CSS grid so RTL/LTR mirroring is automatic via the html[dir] attribute
   (no separate RTL override rules needed, unlike a plain flex row). */
.cb-navbar-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 20px;
}
.cb-navbar-brand { grid-column: 1; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cb-navbar-links {
  grid-column: 2; justify-content: center;
  min-width: 0; /* critical: without this, flex items refuse to shrink below content size and bleed into neighboring grid columns */
  flex-wrap: wrap; row-gap: 8px;
}
.cb-navbar-links a { font-weight: 500; font-size: .92rem; color: var(--cb-text); transition: color .15s ease; white-space: nowrap; }
.cb-navbar-links a:hover { color: var(--cb-primary); }
.cb-navbar-actions { grid-column: 3; justify-self: end; white-space: nowrap; flex-shrink: 0; }

/* Mobile menu toggle: a real visible button, not a bare icon */
.cb-navbar-toggle {
  grid-column: 3;
  justify-self: end;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--cb-border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: var(--cb-secondary);
  transition: background .15s ease, transform .1s ease, border-color .15s ease;
}
.cb-navbar-toggle:hover { border-color: var(--cb-primary); color: var(--cb-primary); }
.cb-navbar-toggle:active { transform: scale(.93); background: var(--cb-bg); }

.offcanvas-body a {
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
  transition: background .15s ease;
}
.offcanvas-body a:not(.btn-cb):hover { background: var(--cb-bg); }

/* ---------- Custom mobile nav drawer (landing page) ----------
   Replaces Bootstrap's Offcanvas component entirely: fully opaque,
   deterministic positioning, no dependency on the dual RTL/LTR
   stylesheet toggle which caused rendering issues with Offcanvas's
   own JS-driven show/hide classes. */
.cb-mobile-nav-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  z-index: 1040; opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.cb-mobile-nav-backdrop.show { opacity: 1; visibility: visible; }

.cb-mobile-nav {
  position: fixed; top: 0; bottom: 0; right: 0;
  width: 300px; max-width: 85vw;
  background: #fff; z-index: 1045;
  box-shadow: -10px 0 40px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s ease;
}
.cb-mobile-nav.show { transform: translateX(0); }

.cb-mobile-nav-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--cb-border); flex-shrink: 0;
}
.cb-mobile-nav-body {
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
}
.cb-mobile-nav-body a {
  padding: 13px 14px; border-radius: 12px; font-weight: 600; color: var(--cb-text);
  transition: background .15s ease;
}
.cb-mobile-nav-body a:not(.btn-cb):hover { background: var(--cb-bg); }

.cb-hero {
  padding: 70px 20px 60px;
  text-align: center;
  background: radial-gradient(circle at top, rgba(79,70,229,.08), transparent 60%);
}
.cb-hero h1 { font-size: 2rem; font-weight: 800; line-height: 1.3; margin-bottom: 16px; }
.cb-hero p { color: var(--cb-text-muted); font-size: 1.05rem; max-width: 600px; margin: 0 auto 28px; }
@media (min-width: 768px) {
  .cb-hero h1 { font-size: 3rem; }
}

.cb-section { padding: 60px 0; }
.cb-section-title { font-weight: 800; font-size: 1.7rem; text-align: center; margin-bottom: 40px; }

.cb-feature-card { text-align: center; padding: 30px 20px; border-radius: var(--cb-radius); background: #fff; box-shadow: var(--cb-shadow); height: 100%; }
.cb-feature-icon { font-size: 2rem; width: 64px; height: 64px; border-radius: 20px; display:flex; align-items:center; justify-content:center; background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(34,211,238,.12)); color: var(--cb-primary); margin: 0 auto 18px; }

/* Small QR badge "sticker" on the phone mockup + step icons in the 3-step explainer */
.cb-demo-qr-badge {
  position: absolute; top: -14px; inset-inline-start: -14px; z-index: 5;
  width: 56px; height: 56px; border-radius: 16px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--cb-primary);
  box-shadow: 0 8px 20px rgba(79,70,229,.25);
  transform: rotate(-8deg);
}
.cb-demo-step-icon {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(34,211,238,.12));
  color: var(--cb-primary); display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}

/* ---------- NFC card showcase ---------- */
.cb-nfc-virtual-card {
  width: 100%; max-width: 320px; aspect-ratio: 1.6 / 1; border-radius: 20px;
  background: linear-gradient(135deg, #1e1b4b, #4f46e5 60%, #22d3ee);
  color: #fff; padding: 24px; position: relative; overflow: hidden;
  box-shadow: 0 20px 50px rgba(30,27,75,.35);
  display: flex; flex-direction: column; justify-content: space-between;
}
.cb-nfc-card-wave { position: absolute; top: 20px; inset-inline-end: 20px; font-size: 1.6rem; opacity: .85; animation: cbNfcPulse 1.8s ease-in-out infinite; }
@keyframes cbNfcPulse { 0%, 100% { opacity: .5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.15); } }
.cb-nfc-card-chip { width: 42px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #fde68a, #f59e0b); }
.cb-nfc-card-name { font-weight: 800; font-size: 1.1rem; letter-spacing: .5px; }
.cb-nfc-card-tap { font-size: .78rem; opacity: .9; display: flex; align-items: center; gap: 6px; }

.cb-nfc-offer-card {
  background: #fff; border-radius: var(--cb-radius); box-shadow: var(--cb-shadow);
  padding: 20px; height: 100%; text-align: center; border: 1px solid var(--cb-border);
}
.cb-nfc-offer-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 14px; margin-bottom: 12px; }
.cb-nfc-offer-icon {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 10px;
  background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(34,211,238,.12));
  color: var(--cb-primary); display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}

/* ---------- Footer ---------- */
.cb-footer { background: linear-gradient(160deg, #0f172a, #1e1b4b); }
.cb-footer-social-icon {
  width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.08);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: background .15s ease, transform .15s ease;
}
.cb-footer-social-icon:hover { background: var(--cb-primary); color: #fff; transform: translateY(-2px); }

.cb-pricing-card { border-radius: var(--cb-radius); background:#fff; box-shadow: var(--cb-shadow); padding: 30px 24px; text-align:center; border: 2px solid transparent; transition: transform .2s ease; }
.cb-pricing-card:hover { transform: translateY(-6px); border-color: var(--cb-primary); }
.cb-price { font-size: 2.2rem; font-weight: 800; color: var(--cb-primary); }

.cb-testimonial { background:#fff; border-radius: var(--cb-radius); box-shadow: var(--cb-shadow); padding: 24px; height: 100%; }

/* ---------- Auth pages ---------- */
.cb-auth-wrap { min-height: 100vh; display:flex; align-items:center; justify-content:center; padding: 24px; background: linear-gradient(135deg, #eef0fd, #f7f8fc); }
.cb-auth-card { width: 100%; max-width: 440px; background:#fff; border-radius: var(--cb-radius); box-shadow: var(--cb-shadow-lg); padding: 36px 28px; }
.cb-form-control { width:100%; padding: 12px 16px; border-radius: var(--cb-radius-sm); border: 1.5px solid var(--cb-border); margin-bottom: 14px; font-size: .98rem; }
.cb-form-control:focus { outline: none; border-color: var(--cb-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.cb-form-label { font-weight: 600; font-size: .9rem; margin-bottom: 6px; display:block; }
.cb-plan-choice {
  border: 1.5px solid var(--cb-border); border-radius: var(--cb-radius-sm);
  padding: 10px 14px; cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.cb-plan-choice:has(input:checked) { border-color: var(--cb-primary); background: rgba(79,70,229,.05); }

/* ---------- Dashboard shell ---------- */
.cb-dash-shell { display:flex; min-height: 100vh; }
.cb-sidebar { width: 260px; background: var(--cb-secondary); color:#fff; flex-shrink:0; position:fixed; top:0; bottom:0; overflow-y:auto; z-index:40; transition: transform .25s ease; }
.cb-sidebar a { display:flex; align-items:center; gap:12px; padding: 13px 22px; color: rgba(255,255,255,.75); font-weight:500; border-radius: 10px; margin: 2px 12px; }
.cb-sidebar a.active, .cb-sidebar a:hover { background: rgba(255,255,255,.08); color:#fff; }
.cb-main { margin-inline-start: 260px; flex:1; padding: 26px 20px 80px; width: 100%; }
@media (max-width: 991px) {
  .cb-sidebar { transform: translateX(-100%); }
  html[dir="rtl"] .cb-sidebar { transform: translateX(100%); }
  .cb-sidebar.open,
  html[dir="rtl"] .cb-sidebar.open { transform: translateX(0); }
  .cb-main { margin-inline-start: 0; }
}
.cb-topbar { display:flex; align-items:center; justify-content:space-between; margin-bottom: 24px; }
.cb-stat-card { background:#fff; border-radius: var(--cb-radius); box-shadow: var(--cb-shadow); padding: 20px; }
.cb-stat-value { font-size: 1.8rem; font-weight: 800; }
.cb-badge { padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.cb-badge-pending { background:#fef3c7; color:#92400e; }
.cb-badge-active { background:#d1fae5; color:#065f46; }
.cb-badge-suspended { background:#fee2e2; color:#991b1b; }
.cb-badge-rejected { background:#e5e7eb; color:#374151; }
.cb-countdown-yellow { background:#fef9c3; color:#854d0e; }
.cb-countdown-orange { background:#ffedd5; color:#9a3412; }

/* ---------- Link builder ---------- */
.cb-link-row { display:flex; align-items:center; gap:10px; background:#fff; border:1px solid var(--cb-border); border-radius: var(--cb-radius-sm); padding: 12px 14px; margin-bottom: 10px; cursor: grab; }
.cb-link-row .handle { color:#c1c4d6; cursor:grab; }
.cb-color-swatch { width:44px; height:44px; border-radius:50%; border:3px solid #fff; box-shadow:0 0 0 1px var(--cb-border); cursor:pointer; }

/* ---------- Public Digital Business Page (mobile-first, app-like) ---------- */
.cb-public-page { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--page-background, #fff); box-shadow: var(--cb-shadow-lg); }
.cb-public-cover { width:100%; height: 200px; object-fit: cover; background: linear-gradient(135deg, var(--cb-primary), var(--cb-accent)); }
.cb-powered { text-align:center; padding: 22px 0 10px; color: var(--cb-text-muted); font-size:.82rem; }
.cb-powered a { font-weight:700; color: var(--cb-primary); }

/* Custom "orange" alert level for the 10-day subscription renewal reminder
   (Bootstrap only ships yellow/red by default) */
.alert-cb-orange { background:#ffedd5; color:#9a3412; border:1px solid #fdba74; }

/* Preview iframe container used inside client dashboard */
.cb-live-preview-frame { border: 10px solid #111827; border-radius: 40px; width: 320px; height: 640px; overflow:hidden; margin: 0 auto; box-shadow: var(--cb-shadow-lg); }
.cb-live-preview-frame iframe { width:100%; height:100%; border:none; }

/* ---------- Public page v2: matches the reference mockup ----------
   Circular centered logo, centered name/description, full-width solid
   pill buttons colored per-service (WhatsApp green, phone blue, etc.)
   instead of the previous white-card + colored-icon-box style. */
.cb-public-logo {
  width: 108px; height: 108px; border-radius: 50%; border: 5px solid #fff;
  object-fit: cover; margin: -54px auto 0; box-shadow: 0 8px 24px rgba(0,0,0,.15); background:#fff;
  display:block;
}
.cb-public-body { padding: 16px 22px 44px; text-align: center; }
.cb-public-name { text-align:center; font-size: 1.45rem; font-weight: 800; margin: 16px 0 6px; }
.cb-public-desc { text-align:center; color: var(--cb-text-muted); font-size: .95rem; margin-bottom: 22px; line-height: 1.6; }

.cb-public-btn-solid {
  display:flex; align-items:center; justify-content:center; gap:10px;
  width:100%; padding:16px 18px; border-radius:16px; margin-bottom:12px;
  font-weight:700; font-size:.98rem; color:#fff; border:none;
  box-shadow: 0 4px 14px rgba(17,24,39,.14); transition: transform .15s ease, box-shadow .15s ease;
  animation: cbButtonEnter .4s ease backwards;
}
.cb-public-btn-solid:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(17,24,39,.2); color:#fff; }
.cb-public-btn-solid:active { transform: scale(.97); }
.cb-public-btn-solid i { font-size: 1.15rem; }
/* Stagger each button's entrance slightly for a subtle, premium feel */
.cb-public-btn-solid:nth-of-type(1) { animation-delay: .05s; }
.cb-public-btn-solid:nth-of-type(2) { animation-delay: .1s; }
.cb-public-btn-solid:nth-of-type(3) { animation-delay: .15s; }
.cb-public-btn-solid:nth-of-type(4) { animation-delay: .2s; }
.cb-public-btn-solid:nth-of-type(5) { animation-delay: .25s; }
.cb-public-btn-solid:nth-of-type(n+6) { animation-delay: .3s; }
@keyframes cbButtonEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.cb-btn-whatsapp { background: #25D366; }
.cb-btn-phone { background: #3b82f6; }
.cb-btn-instagram { background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045); }
.cb-btn-facebook { background: #1877f2; }
.cb-btn-linkedin { background: #0a66c2; }
.cb-btn-tiktok { background: #010101; }
.cb-btn-snapchat { background: #FFFC00; color:#111; }
.cb-btn-telegram { background: #26A5E4; }
.cb-btn-youtube { background: #FF0000; }
.cb-btn-maps { background: #ef4444; }
.cb-btn-website { background: #0f172a; }
.cb-btn-email { background: #6b7280; }
.cb-btn-custom { background: var(--page-primary, #4f46e5); }

/* Share / Save-contact utility buttons: tinted with the client's brand
   color, visually distinct (secondary) from the solid per-service buttons */
.cb-public-utility-row { display:flex; gap:10px; margin-bottom:20px; }
.cb-public-utility-btn {
  flex:1; display:flex; flex-direction:column; align-items:center; gap:6px;
  padding:14px 8px; border-radius:16px; border:1.5px solid var(--page-primary, #4f46e5);
  background: color-mix(in srgb, var(--page-primary, #4f46e5) 8%, white);
  color: var(--page-primary, #4f46e5); font-weight:700; font-size:.82rem;
  text-decoration:none; cursor:pointer; transition: transform .12s ease, background .15s ease;
}
.cb-public-utility-btn:active { transform: scale(.96); }
.cb-public-utility-icon {
  width:38px; height:38px; border-radius:50%; background: var(--page-primary, #4f46e5);
  color:#fff; display:flex; align-items:center; justify-content:center; font-size:1.05rem;
}
