/* ═══════════════════════════════════════════════════
   NOON CALLIGRAPHER — BASE STYLES
   Phase 1: Reset, Typography, RTL, Utilities
═══════════════════════════════════════════════════ */

/* ─── Modern CSS Reset ──────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-base);
  font-size: var(--text-base);
  color: var(--c-text);
  background: var(--c-white);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* RTL Body */
[dir="rtl"] body,
body[dir="rtl"] {
  font-family: var(--font-ar);
}

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

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

button, input, textarea, select {
  font: inherit;
  border: none;
  background: none;
  outline: none;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--c-dark);
}

p { line-height: 1.7; }

/* ─── Typography Utilities ──────────────────────── */
.text-xs    { font-size: var(--text-xs); }
.text-sm    { font-size: var(--text-sm); }
.text-base  { font-size: var(--text-base); }
.text-md    { font-size: var(--text-md); }
.text-lg    { font-size: var(--text-lg); }
.text-xl    { font-size: var(--text-xl); }
.text-2xl   { font-size: var(--text-2xl); }
.text-3xl   { font-size: var(--text-3xl); }
.text-4xl   { font-size: var(--text-4xl); }

.font-light  { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semi   { font-weight: 600; }
.font-bold   { font-weight: 700; }
.font-black  { font-weight: 800; }

.text-primary { color: var(--c-primary); }
.text-muted   { color: var(--c-text-muted); }
.text-dark    { color: var(--c-dark); }
.text-white   { color: var(--c-white); }
.text-gold    { color: var(--c-gold); }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

[dir="rtl"] .text-start { text-align: right; }
[dir="ltr"] .text-start { text-align: left; }

/* ─── Layout Utilities ──────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--sp-6);
}

.container-wide {
  max-width: var(--container-wide);
}

.section {
  padding-block: var(--sp-20);
}

.section-sm {
  padding-block: var(--sp-12);
}

/* Flexbox */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.items-end    { align-items: flex-end; }
.justify-center   { justify-content: center; }
.justify-between  { justify-content: space-between; }
.justify-end      { justify-content: flex-end; }
.gap-2   { gap: var(--sp-2); }
.gap-3   { gap: var(--sp-3); }
.gap-4   { gap: var(--sp-4); }
.gap-6   { gap: var(--sp-6); }
.gap-8   { gap: var(--sp-8); }

/* Grid */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Section Headers ───────────────────────────── */
.section-header {
  text-align: center;
  margin-bottom: var(--sp-12);
}

.section-eyebrow {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--sp-1) var(--sp-4);
  background: var(--c-primary-xlight);
  border-radius: var(--radius-full);
  margin-bottom: var(--sp-3);
}

.section-title {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--c-dark);
  margin-bottom: var(--sp-4);
  line-height: 1.2;
}

.section-subtitle {
  font-size: var(--text-md);
  color: var(--c-text-muted);
  max-width: 560px;
  margin-inline: auto;
  line-height: 1.7;
}

/* ─── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-base);
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-out);
  white-space: nowrap;
  min-height: 48px;
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--dur-fast);
}

.btn:hover::after {
  background: rgba(255,255,255,0.1);
}

.btn:active {
  transform: scale(0.97);
}

/* Primary Button */
.btn-primary {
  background: var(--c-primary);
  color: var(--c-white);
  box-shadow: var(--shadow-green-sm);
}

.btn-primary:hover {
  background: var(--c-primary-dark);
  box-shadow: var(--shadow-green);
  transform: translateY(-2px);
}

/* Secondary Button */
.btn-secondary {
  background: var(--c-white);
  color: var(--c-primary);
  border-color: var(--c-primary);
}

.btn-secondary:hover {
  background: var(--c-primary-xlight);
  transform: translateY(-2px);
}

/* Outline White (for dark backgrounds) */
.btn-outline-white {
  background: rgba(255,255,255,0.1);
  color: var(--c-white);
  border-color: rgba(255,255,255,0.5);
  backdrop-filter: blur(8px);
}

.btn-outline-white:hover {
  background: rgba(255,255,255,0.2);
  border-color: var(--c-white);
  transform: translateY(-2px);
}

/* Ghost / Text button */
.btn-ghost {
  background: transparent;
  color: var(--c-primary);
  padding-inline: var(--sp-4);
}

.btn-ghost:hover {
  background: var(--c-primary-xlight);
}

/* Danger button */
.btn-danger {
  background: var(--c-danger);
  color: var(--c-white);
}

.btn-danger:hover {
  background: #c53030;
  transform: translateY(-2px);
}

/* Size variants */
.btn-sm {
  padding: 0.5rem 1.25rem;
  font-size: var(--text-xs);
  min-height: 36px;
}

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: var(--text-base);
  min-height: 56px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  min-height: unset;
}

/* WhatsApp Button */
.btn-whatsapp {
  background: #25d366;
  color: var(--c-white);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp:hover {
  background: #1eaf55;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
}

/* Loading state */
.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn.loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-inline-end: var(--sp-2);
}

/* ─── Cards ─────────────────────────────────────── */
.card {
  background: var(--c-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-body {
  padding: var(--sp-6);
}

/* Glassmorphism Card */
.card-glass {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow-md);
}

/* ─── Badge / Chip ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
}

.badge-primary  { background: var(--c-primary-xlight); color: var(--c-primary-dark); }
.badge-success  { background: #f0fff4; color: var(--c-success); }
.badge-warning  { background: #fffaf0; color: var(--c-warning); }
.badge-danger   { background: #fff5f5; color: var(--c-danger); }
.badge-info     { background: #ebf8ff; color: var(--c-info); }
.badge-dark     { background: var(--c-dark); color: var(--c-white); }
.badge-gold     { background: var(--c-gold-light); color: #7b6020; }

/* ─── Form Elements ─────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-dark);
}

.form-label span.required {
  color: var(--c-danger);
  margin-inline-start: 2px;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-base);
  color: var(--c-text);
  background: var(--c-white);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  min-height: 48px;
}

.form-control:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-glass);
  outline: none;
}

.form-control::placeholder {
  color: var(--c-text-light);
}

.form-control[dir="rtl"],
[dir="rtl"] .form-control {
  text-align: right;
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

[dir="rtl"] select.form-control {
  background-position: left 1rem center;
  padding-right: 1rem;
  padding-left: 2.5rem;
}

/* Toggle Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.toggle {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--c-border);
  border-radius: var(--radius-full);
  transition: background var(--dur-base);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform var(--dur-base) var(--ease-spring);
  box-shadow: var(--shadow-xs);
}

.toggle input:checked + .toggle-slider {
  background: var(--c-primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

[dir="rtl"] .toggle input:checked + .toggle-slider::before {
  transform: translateX(-24px);
}

/* ─── Divider ───────────────────────────────────── */
.divider {
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-primary-light));
  border-radius: var(--radius-full);
  margin-block: var(--sp-4);
}

.divider-center { margin-inline: auto; }

/* ─── Alerts / Flash Messages ───────────────────── */
.alert {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  border: 1px solid transparent;
}

.alert-success { background: #f0fff4; border-color: #9ae6b4; color: #276749; }
.alert-danger  { background: #fff5f5; border-color: #feb2b2; color: #c53030; }
.alert-warning { background: #fffaf0; border-color: #fbd38d; color: #975a16; }
.alert-info    { background: #ebf8ff; border-color: #90cdf4; color: #2c5282; }

/* ─── Animations ────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}

@keyframes pendulumSwing {
  0% {
    opacity: 0;
    transform: rotate(-28deg);
    transform-origin: 50% -20%;
  }
  40% {
    transform: rotate(12deg);
  }
  70% {
    transform: rotate(-5deg);
  }
  90% {
    transform: rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: rotate(0deg);
    transform-origin: 50% -20%;
  }
}

@keyframes wiperSweep {
  0% {
    opacity: 0;
    transform: rotate(85deg);
    transform-origin: bottom center;
  }
  100% {
    opacity: 1;
    transform: rotate(0deg);
    transform-origin: bottom center;
  }
}

@keyframes wiperSet {
  0% {
    opacity: 1;
    transform: rotate(0deg);
    transform-origin: bottom center;
  }
  100% {
    opacity: 0;
    transform: rotate(-85deg);
    transform-origin: bottom center;
  }
}



@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.animate-fade-in { animation: fadeIn var(--dur-slow) var(--ease-out) both; }
.animate-fade-up { animation: fadeUp var(--dur-slow) var(--ease-out) both; }

/* Staggered animation delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ─── Loading Skeleton ──────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-md);
}


/* ─── Breadcrumb ────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--c-text-muted);
  flex-wrap: wrap;
}

.breadcrumb a { transition: color var(--dur-fast); }
.breadcrumb a:hover { color: var(--c-primary); }
.breadcrumb-sep { color: var(--c-border); }
.breadcrumb-current { color: var(--c-text); font-weight: 500; }

/* ─── Scrollbar Styling ─────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--c-primary-light); }

/* ─── Image Aspect Ratios ───────────────────────── */
.aspect-square  { aspect-ratio: 1; }
.aspect-video   { aspect-ratio: 16/9; }
.aspect-4-3     { aspect-ratio: 4/3; }
.aspect-3-2     { aspect-ratio: 3/2; }
.aspect-portrait { aspect-ratio: 3/4; }

.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ─── Visibility ────────────────────────────────── */
.show-mobile { display: none; }
.hide-mobile { display: block; }

@media (max-width: 767px) {
  .show-mobile { display: block; }
  .hide-mobile { display: none; }

  .section { padding-block: var(--sp-12); }
  .section-title { font-size: var(--text-2xl); }
  .container { padding-inline: var(--sp-4); }
}

/* ─── RTL Logical Properties ────────────────────── */
.ms-auto { margin-inline-start: auto; }
.me-auto { margin-inline-end: auto; }

[dir="rtl"] .rotate-icon { transform: scaleX(-1); }
