/**
 * Legal Pages Styles (Privacy Policy & Terms of Service)
 * Replaces Tailwind CDN with minimal production CSS
 */

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  line-height: 1.6;
  overflow-x: hidden;
  font-size: 16px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== Typography ===== */
html[dir="rtl"] {
  font-family: 'Tajawal', system-ui, sans-serif;
}

html[dir="ltr"] {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== Color Variables ===== */
:root {
  --primary-50: #FFF7ED;
  --primary-100: #FFEDD5;
  --primary-500: #F97316;
  --primary-600: #EA580C;
  --primary-700: #C2410C;

  --dark-50: #f8fafc;
  --dark-100: #f1f5f9;
  --dark-200: #e2e8f0;
  --dark-300: #cbd5e1;
  --dark-400: #94a3b8;
  --dark-500: #64748b;
  --dark-600: #475569;
  --dark-700: #334155;
  --dark-800: #1e293b;
  --dark-900: #0f172a;
  --dark-950: #020617;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --white: #ffffff;
}

/* ===== Utility Classes ===== */
.bg-gray-50 { background-color: var(--gray-50); }
.bg-white { background-color: var(--white); }
.bg-dark-950 { background-color: var(--dark-950); }
.bg-primary-50 { background-color: var(--primary-50); }

.text-dark-400 { color: var(--dark-400); }
.text-dark-500 { color: var(--dark-500); }
.text-dark-600 { color: var(--dark-600); }
.text-dark-700 { color: var(--dark-700); }
.text-dark-800 { color: var(--dark-800); }
.text-dark-900 { color: var(--dark-900); }
.text-primary-500 { color: var(--primary-500); }
.text-primary-600 { color: var(--primary-600); }

/* ===== Layout ===== */
.max-w-4xl {
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
}

.max-w-7xl {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
}

.mx-auto { margin-left: auto; margin-right: auto; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.hidden { display: none; }
.block { display: block; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.flex-wrap { flex-wrap: wrap; }
.gap-1\.5 { gap: 0.375rem; }

/* Grid */
@media (min-width: 640px) {
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:text-4xl { font-size: 2.25rem; }
}

@media (min-width: 1024px) {
  .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
  .lg\:py-12 { padding-top: 3rem; padding-bottom: 3rem; }
  .lg\:grid { display: grid; }
  .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .lg\:col-span-3 { grid-column: span 3 / span 3; }
  .lg\:col-span-9 { grid-column: span 9 / span 9; }
  .lg\:gap-8 { gap: 2rem; }
  .lg\:block { display: block; }
}

/* Neutral colors used in terms */
.text-neutral-400 { color: #a3a3a3; }
.text-neutral-500 { color: #737373; }
.text-neutral-600 { color: #525252; }
.text-neutral-900 { color: #171717; }
.border-neutral-200 { border-color: #e5e5e5; }
.bg-neutral-50 { background-color: #fafafa; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-12 { margin-bottom: 3rem; }
.pt-8 { padding-top: 2rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* ===== Flexbox ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

/* ===== Header ===== */
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-50 { z-index: 50; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }

header {
  background-color: var(--white);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 50;
}

header .flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  max-width: 56rem;
  margin: 0 auto;
}

header img.h-10, .h-10 {
  height: 2.5rem;
  width: auto;
}

header img.h-9, .h-9 {
  height: 2.25rem;
  width: auto;
}

header img.h-8, .h-8 {
  height: 2rem;
  width: auto;
}

.w-auto { width: auto; }

/* ===== Buttons ===== */
button,
.btn {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

#langToggle {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dark-600);
  background: transparent;
  border: 1px solid var(--dark-200);
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

#langToggle:hover {
  color: var(--primary-500);
  border-color: var(--primary-500);
}

/* ===== Typography ===== */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.leading-relaxed { line-height: 1.625; }

/* Responsive text */
@media (min-width: 768px) {
  .md\:text-4xl { font-size: 2.25rem; }
  .md\:p-12 { padding: 3rem; }
}

/* ===== Card Styles ===== */
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-lg { border-radius: 0.5rem; }

/* ===== Policy Sections ===== */
.policy-section {
  margin-bottom: 2rem;
}

.policy-section h2 {
  color: var(--primary-500);
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 1.25rem;
}

.policy-section h3 {
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.policy-section p {
  margin-bottom: 1rem;
  color: var(--dark-700);
}

.policy-section ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  color: var(--dark-700);
}

html[dir="rtl"] .policy-section ul {
  padding-left: 0;
  padding-right: 1.5rem;
}

.policy-section ul li {
  margin-bottom: 0.5rem;
}

.policy-section ol {
  list-style-type: decimal;
  padding-left: 1.5rem;
  color: var(--dark-700);
}

html[dir="rtl"] .policy-section ol {
  padding-left: 0;
  padding-right: 1.5rem;
}

.policy-section ol li {
  margin-bottom: 0.5rem;
}

.policy-section strong {
  font-weight: 600;
  color: var(--dark-800);
}

/* ===== Language Toggle ===== */
.lang-en { display: block; }
.lang-ar { display: none; }

html[dir="rtl"] .lang-en { display: none; }
html[dir="rtl"] .lang-ar { display: block; }

span.lang-en,
span.lang-ar { display: inline; }

html[dir="rtl"] span.lang-en { display: none; }
html[dir="ltr"] span.lang-ar { display: none; }

/* ===== Links ===== */
a.text-primary-500 {
  color: var(--primary-500);
}

a.text-primary-500:hover,
a:hover.text-primary-500 {
  text-decoration: underline;
}

.hover\:text-primary-500:hover {
  color: var(--primary-500);
}

.hover\:text-primary-600:hover {
  color: var(--primary-600);
}

.hover\:underline:hover {
  text-decoration: underline;
}

/* ===== Contact Box ===== */
.bg-primary-50.rounded-xl {
  background-color: var(--primary-50);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-top: 1rem;
}

/* ===== Border ===== */
.border-t {
  border-top: 1px solid var(--dark-200);
}

.border {
  border: 1px solid var(--dark-200);
}

/* ===== Footer ===== */
footer {
  background-color: var(--dark-950);
  color: var(--dark-400);
  padding: 2rem 0;
  margin-top: 3rem;
}

footer .text-center {
  text-align: center;
}

footer img {
  height: 2rem;
  margin: 0 auto 1rem;
}

/* ===== Inline Elements ===== */
.inline-flex {
  display: inline-flex;
  align-items: center;
}

/* ===== Transitions ===== */
.transition-colors {
  transition: color 0.2s ease;
}

.transition-all {
  transition: all 0.2s ease;
}

/* ===== SVG Icons ===== */
svg {
  display: inline-block;
  vertical-align: middle;
}

.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.flex-shrink-0 { flex-shrink: 0; }

/* ===== TOC Styles (Terms page) ===== */
.toc-link {
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  padding: 0.5rem 1rem;
  display: block;
  font-size: 0.875rem;
  color: var(--dark-600);
}

html[dir="rtl"] .toc-link {
  border-left: none;
  border-right: 2px solid transparent;
}

.toc-link:hover,
.toc-link.active {
  border-color: var(--primary-500);
  color: var(--primary-500);
  background-color: var(--primary-50);
}

/* ===== Desktop TOC Sidebar ===== */
.toc-sidebar {
  position: sticky;
  top: 5rem;
}

@media (min-width: 1024px) {
  .lg\:sticky { position: sticky; }
  .lg\:top-24 { top: 6rem; }
  .lg\:flex-row { flex-direction: row; }
  .lg\:w-64 { width: 16rem; }
}

/* ===== Mobile Only ===== */
@media (max-width: 1023px) {
  .lg\:hidden, .hidden.lg\:block { display: none; }
}

/* ===== Additional utilities ===== */
.text-xs { font-size: 0.75rem; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.no-print { }
.rounded-xl { border-radius: 0.75rem; }
.p-5 { padding: 1.25rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-5 { margin-top: 1.25rem; }
.pt-5 { padding-top: 1.25rem; }

/* ===== Scroll to Top Button ===== */
#scrollTop {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--primary-500);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 40;
}

html[dir="rtl"] #scrollTop {
  right: auto;
  left: 2rem;
}

#scrollTop.visible {
  opacity: 1;
  pointer-events: auto;
}

#scrollTop:hover {
  background-color: var(--primary-600);
  transform: translateY(-2px);
}

/* ===== Print Styles ===== */
@media print {
  header,
  footer,
  #langToggle,
  #scrollTop,
  .nav-actions {
    display: none !important;
  }

  body {
    font-size: 12pt;
  }

  .policy-section {
    page-break-inside: avoid;
  }
}
