/* =========================================================
   Touch Agency — RevenueX-style Dashboard UI
   Arabic RTL · Separate CSS file
   Font: ITF Qomra Arabic (local TTF files)
   Updated colors and font paths
   ========================================================= */

/* -------------------- Local Fonts -------------------- */
@font-face {
  font-family: 'Qomra Arabic';
  src: url('fonts/arfonts-itf-qomra-arabic-regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Qomra Arabic';
  src: url('fonts/arfonts-itf-qomra-arabic-medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Qomra Arabic';
  src: url('fonts/arfonts-itf-qomra-arabic-bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Qomra Arabic';
  src: url('fonts/arfonts-itf-qomra-arabic-black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* -------------------- Tokens (Updated Colors) -------------------- */
:root {
  --primary: #6b1f2a;
  --primary-dark: #260f14;
  --on-primary: #ffffff;
  --accent: #4a151e;
  --accent-light: #8a3b48;
  --accent-pale: #f0e0e3;
  --background: #f4f1ea;
  --surface: #ffffff;
  --foreground: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --shadow-soft: 0 24px 80px rgba(17, 24, 39, 0.06);
  --shadow-sm: 0 4px 14px rgba(17, 24, 39, 0.04);
  --font-base: 'Qomra Arabic', system-ui, sans-serif;
  --sidebar-width: 280px;
}

/* -------------------- Reset -------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  direction: rtl;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

/* WebKit custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.85;
  color: var(--foreground);
  background: var(--background);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent);
}

/* -------------------- App Shell -------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

/* -------------------- Sidebar -------------------- */
.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 28px 22px;
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
}

.brand-name {
  font-family: var(--font-base);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--foreground);
}

.side-nav ul,
.side-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.side-nav li {
  margin-bottom: 6px;
}

.side-nav a {
  display: block;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.side-nav a:hover,
.side-nav a:focus {
  background: var(--accent-pale);
  color: var(--primary);
}

.side-section {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.side-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.side-section a {
  display: block;
  padding: 8px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.side-section a:hover {
  color: var(--accent);
}

/* -------------------- Sidebar Close Button -------------------- */
.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--background);
  color: var(--primary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  margin-bottom: 18px;
  font-family: var(--font-base);
}

.sidebar-close:hover {
  background: var(--accent-pale);
  color: var(--accent);
}

/* -------------------- Mobile Header -------------------- */
.mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.menu-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-pale);
  color: var(--primary);
  font-size: 1.3rem;
  cursor: pointer;
  user-select: none;
  border: none;
  font-family: var(--font-base);
}

/* -------------------- Main Wrapper -------------------- */
.main-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* -------------------- Topbar -------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 56px;
}

.topbar-crumb {
  font-size: 0.9rem;
  color: var(--muted);
  background: transparent;
  padding: 0;
  margin: 0;
  border: none;
}

.topbar-crumb a {
  color: var(--muted);
  font-weight: 500;
}

.topbar-crumb a:hover {
  color: var(--accent);
}

/* -------------------- Dashboard Main -------------------- */
.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* -------------------- Hero Card (Updated Gradient) -------------------- */
.hero-card {
  position: relative;
  background: linear-gradient(135deg, #8a3b48 0%, #6b1f2a 100%);
  border-radius: var(--radius-xl);
  padding: 48px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  margin-bottom: 0;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 70%;
  height: 160%;
  background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 60%);
  pointer-events: none;
  animation: heroPulse 18s ease-in-out infinite;
}

@keyframes heroPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}

.hero-body {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.55);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 18px;
  backdrop-filter: blur(4px);
}

.hero-card h1 {
  font-family: var(--font-base);
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 900;
  line-height: 1.25;
  color: #ffffff;
  margin: 0 0 16px 0;
  border: none;
  padding: 0;
  background: none;
}

.hero-card p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  margin: 0;
}

/* -------------------- Content Cards -------------------- */
.content-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  min-width: 0;
}

.content-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 90px rgba(17, 24, 39, 0.08);
}

.content-card h2 {
  font-family: var(--font-base);
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  font-weight: 700;
  color: var(--foreground);
  margin: 0 0 18px 0;
  padding: 0;
  border: none;
  background: none;
}

.content-card h3 {
  font-family: var(--font-base);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}

.content-card p {
  color: var(--foreground);
  margin-bottom: 1.1em;
}

.content-card a {
  color: var(--accent);
  font-weight: 600;
}

.content-card a:hover {
  color: var(--primary-dark);
}

/* -------------------- TOC inside card -------------------- */
.toc-card .toc-box {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  margin: 0;
}

.toc-box h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--primary);
}

.toc-box ul {
  columns: 2;
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-box ul li {
  padding: 5px 0;
  font-size: 0.92rem;
}

.toc-box ul li a {
  color: var(--muted);
  font-weight: 500;
}

.toc-box ul li a:hover {
  color: var(--accent);
}

/* -------------------- Check-list -------------------- */
.check-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.check-list li {
  position: relative;
  background: var(--background);
  padding: 16px 44px 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--foreground);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.check-list li::before {
  content: "✓";
  position: absolute;
  right: 16px;
  top: 16px;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.check-list li:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* -------------------- CTA Box (Updated Background) -------------------- */
.cta-box {
  background: linear-gradient(135deg, #fcf5f6, #f0e0e3);
  border-right: 4px solid var(--accent);
  padding: 24px;
  margin: 28px 0 0 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.cta-box strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 12px;
}

.cta-box a {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 11px 26px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.cta-box a:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-2px);
}

/* -------------------- Tables -------------------- */
.seo-table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.seo-table-wrapper table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.95rem;
}

.seo-table-wrapper th {
  background: var(--primary);
  color: #fff;
  padding: 14px 16px;
  font-weight: 600;
  white-space: nowrap;
}

.seo-table-wrapper td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
  white-space: nowrap;
}

.seo-table-wrapper tr:nth-child(even) {
  background: var(--background);
}

.seo-table-wrapper tr:last-child td {
  border-bottom: none;
}

/* -------------------- Metric Badge -------------------- */
.metric-badge {
  display: inline-block;
  background: var(--accent-pale);
  color: var(--primary-dark);
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 6px;
}

/* -------------------- Highlight Quote -------------------- */
.highlight-quote {
  background: var(--accent-pale);
  border-right: 4px solid var(--accent);
  padding: 20px 24px;
  margin: 24px 0;
  border-radius: var(--radius-md);
  font-style: italic;
}

.highlight-quote p {
  margin: 0;
  color: var(--foreground);
}

/* -------------------- FAQ & How-To Sections -------------------- */
.faq-section,
.how-to-section {
  background: var(--background);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 24px 0;
}

.faq-section h3,
.how-to-section h3 {
  margin-top: 1.2em;
}

.faq-section h3:first-of-type,
.how-to-section h3:first-of-type {
  margin-top: 0;
}

.faq-item {
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 12px;
}

.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: '›';
  font-size: 1.4rem;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.2s ease;
  display: inline-block;
}

.faq-item[open] summary::before {
  transform: rotate(90deg);
}

.faq-item summary h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  display: inline;
}

.faq-item p {
  margin: 10px 32px 0 0;
  color: var(--foreground);
}

/* -------------------- Site Footer -------------------- */
.site-footer {
  color: var(--foreground);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px 24px;
  margin-top: 8px;
  box-shadow: var(--shadow-soft);
}

.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-col h4 {
  font-family: var(--font-base);
  font-size: 1rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 0 0 16px 0;
}

.footer-brand {
  font-family: var(--font-base);
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--foreground);
  margin-bottom: 12px;
}

.footer-col p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
  margin: 0;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: 8px;
}

.footer-col a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-copy {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

/* -------------------- WhatsApp Float (Updated) -------------------- */
.whatsapp-float {
  position: fixed;
  bottom: 28px;
  left: 28px;
  background: linear-gradient(135deg, #6b1f2a, #4a151e);
  color: #ffffff;
  border-radius: var(--radius-pill);
  padding: 14px 24px;
  box-shadow: 0 6px 22px rgba(107, 31, 42, 0.35);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 999;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  direction: ltr;
  letter-spacing: 0.3px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.whatsapp-float:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 30px rgba(107, 31, 42, 0.45);
  color: #ffffff;
  text-decoration: none;
}

.whatsapp-float svg {
  width: 24px;
  height: 24px;
  fill: #ffffff;
  flex-shrink: 0;
}

.whatsapp-float .wa-text {
  display: inline-block;
  line-height: 1.3;
}

/* -------------------- Responsive -------------------- */
@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(80vw, 300px);
    z-index: 1000;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    margin: 0;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.1);
  }

  /* Opened by JS; stays open until the page is refreshed */
  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-flex;
  }

  .mobile-header {
    display: flex;
  }

  .main-wrapper {
    gap: 16px;
  }

  .topbar {
    justify-content: flex-start;
    min-height: auto;
  }

  .hero-card {
    padding: 28px;
    border-radius: var(--radius-lg);
  }

  .content-card {
    padding: 22px;
    border-radius: var(--radius-md);
  }

  .toc-box ul {
    columns: 1;
  }

  .whatsapp-float {
    bottom: 18px;
    left: 18px;
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .whatsapp-float .wa-text {
    display: none;
  }

  .whatsapp-float {
    border-radius: 50%;
    padding: 14px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 15px;
  }

  .hero-card h1 {
    font-size: 1.45rem;
  }

  .check-list {
    grid-template-columns: 1fr;
  }

  .seo-table-wrapper {
    border-radius: var(--radius-sm);
  }
}

/* -------------------- Print -------------------- */
@media print {
  .sidebar,
  .mobile-header,
  .whatsapp-float {
    display: none !important;
  }

  .app {
    display: block;
    padding: 0;
  }

  .content-card,
  .hero-card {
    box-shadow: none;
    border: 1px solid var(--border);
    break-inside: avoid;
  }
}