/* Design tokens — mirror the React app's palette */
:root {
  --background: #faf8f3;
  --foreground: #1a2419;
  --card: #ffffff;
  --muted: #f1ede2;
  --muted-foreground: #6b6557;
  --border: #e3dccb;
  --primary: #0a4d2e;          /* deep green */
  --primary-foreground: #fbf6e8;
  --accent: #c9a44a;            /* gold */
  --destructive: #b42318;
  --shadow-elegant: 0 10px 30px -12px rgba(10,77,46,0.25);
  --shadow-gold: 0 8px 24px -8px rgba(201,164,74,0.45);
  --gradient-hero: linear-gradient(135deg, #073d24 0%, #0a4d2e 50%, #0d6b3f 100%);
  --gradient-gold: linear-gradient(135deg, #b8902f 0%, #c9a44a 50%, #e0c07a 100%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'IBM Plex Sans Arabic', system-ui, -apple-system, Arial, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body { font-family: 'IBM Plex Sans Arabic', 'Inter', system-ui, Arial, sans-serif; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }

.muted { color: var(--muted-foreground); }
.small { font-size: 0.85rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250,248,243,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; }
@media (min-width: 640px) { .header-inner { padding: 0.75rem 1.5rem; } }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; }
.brand img { height: 40px; width: auto; }
@media (min-width: 640px) { .brand img { height: 48px; } }
.brand.small img { height: 32px; }
.brand-text { display: none; font-size: 0.9rem; font-weight: 600; }
@media (min-width: 640px) { .brand-text { display: inline; } }

/* Lang switch */
.lang-switch { display: inline-flex; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 4px; font-size: 0.8rem; }
.lang-switch button { padding: 0.35rem 0.75rem; border-radius: 999px; font-weight: 500; color: var(--muted-foreground); transition: all .15s; }
.lang-switch button.active { background: var(--muted); color: var(--foreground); }

/* Hero */
.hero { position: relative; overflow: hidden; color: var(--primary-foreground); background: var(--gradient-hero); }
.hero-bg { position: absolute; inset: 0; background: url('assets/hero-bg.jpg') center/cover; opacity: 0.25; pointer-events: none; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(7,61,36,0.3), rgba(7,61,36,0.1) 30%, rgba(7,61,36,0.7)); pointer-events: none; }
.hero-inner { position: relative; padding: 4rem 1rem; text-align: center; max-width: 880px; }
@media (min-width: 640px) { .hero-inner { padding: 6rem 1.5rem; } }

.badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  border: 1px solid rgba(251,246,232,0.4);
  background: rgba(251,246,232,0.15);
  color: var(--primary-foreground);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 1.5rem;
}
@media (min-width: 640px) { .badge { font-size: 1.875rem; } }
.badge .icon-lg { width: 28px; height: 28px; color: var(--accent); }
@media (min-width: 640px) { .badge .icon-lg { width: 32px; height: 32px; } }

.hero h1 { margin: 1.5rem 0 0; font-size: 1.875rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
@media (min-width: 640px) { .hero h1 { font-size: 3rem; } }
@media (min-width: 1024px) { .hero h1 { font-size: 3.5rem; } }
.hero-sub { margin: 1.25rem auto 0; max-width: 720px; font-size: 1rem; color: rgba(251,246,232,0.85); }
@media (min-width: 640px) { .hero-sub { font-size: 1.125rem; } }

.hero-actions { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.count-pill { margin-top: 2rem; display: inline-flex; align-items: center; gap: 0.5rem; background: rgba(251,246,232,0.1); padding: 0.5rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; }
.count-pill .icon { width: 16px; height: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; height: 3rem; padding: 0 1.75rem; font-size: 1rem; font-weight: 600; border-radius: 0.5rem; transition: all .2s; }
.btn-gold { background: var(--gradient-gold); color: #2a1f0a; box-shadow: var(--shadow-gold); }
.btn-gold:hover { opacity: 0.95; }
.btn-outline { border: 1px solid rgba(251,246,232,0.3); color: var(--primary-foreground); background: transparent; }
.btn-outline:hover { background: rgba(251,246,232,0.1); }
.btn-sm { height: 2.25rem; padding: 0 0.75rem; font-size: 0.85rem; }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }
.icon { width: 18px; height: 18px; }

/* Signing section */
.signing { background: rgba(241,237,226,0.4); padding: 4rem 0; }
.grid { display: grid; gap: 2.5rem; }
@media (min-width: 1024px) { .grid { grid-template-columns: 3fr 2fr; } }
.form-col h2 { font-size: 1.5rem; font-weight: 700; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
@media (min-width: 640px) { .form-col h2 { font-size: 1.875rem; } }

/* Card */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 1rem; padding: 1.5rem; box-shadow: var(--shadow-elegant); }
.aside-card { position: sticky; top: 6rem; }
.aside-head { display: flex; align-items: center; justify-content: space-between; }
.aside-head h3 { margin: 0; font-size: 1.125rem; font-weight: 600; }
.pill { background: rgba(10,77,46,0.1); color: var(--primary); padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.recent-list { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.recent-item { padding: 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--background); }
.recent-item .name { font-weight: 600; }
.recent-item .meta { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 2px; }

/* Form */
.sig-form { background: var(--card); border: 1px solid var(--border); border-radius: 1rem; padding: 1.5rem; box-shadow: var(--shadow-elegant); display: flex; flex-direction: column; gap: 1.25rem; }
@media (min-width: 640px) { .sig-form { padding: 2rem; } }
.form-note { border-left: 4px solid var(--primary); background: rgba(10,77,46,0.05); padding: 0.85rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 0.875rem; font-weight: 500; }
.field label .req { color: var(--primary); }
.field input { height: 2.75rem; padding: 0 0.85rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--background); font: inherit; color: inherit; }
.field input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.field .err { font-size: 0.75rem; color: var(--destructive); }
.field .warn { font-size: 0.75rem; color: #b45309; display: flex; align-items: flex-start; gap: 4px; }
.server-error { display: flex; gap: 0.5rem; padding: 0.75rem; background: rgba(180,35,24,0.08); border: 1px solid rgba(180,35,24,0.4); color: var(--destructive); border-radius: 0.5rem; font-size: 0.875rem; }
.submit-btn { width: 100%; }
.success-card { text-align: center; padding: 2rem; background: var(--card); border: 1px solid var(--border); border-radius: 1rem; box-shadow: var(--shadow-elegant); }
.success-circle { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 999px; background: rgba(201,164,74,0.15); display: flex; align-items: center; justify-content: center; color: var(--accent); }
.success-card h3 { margin: 0; font-size: 1.5rem; }
.success-card p { margin: 0.5rem 0 0; color: var(--muted-foreground); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--background); padding: 2rem 0; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; justify-content: space-between; }
@media (min-width: 640px) { .footer-inner { flex-direction: row; } }

/* Dialog */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.dialog-backdrop[hidden] { display: none; }
.dialog { background: var(--card); border-radius: 0.75rem; max-width: 768px; width: 100%; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); }
.dialog-head h3 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.dialog-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.dialog-body h2 { margin: 0; font-size: 1.5rem; font-weight: 700; }
@media (min-width: 640px) { .dialog-body h2 { font-size: 1.875rem; } }
.dialog-body .intro-box { margin-top: 1.5rem; border-left: 4px solid var(--primary); background: rgba(10,77,46,0.05); padding: 1rem; border-radius: 0.5rem; line-height: 1.7; }
.dialog-body .paragraphs { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }
.dialog-body .paragraphs p { margin: 0; line-height: 1.8; text-align: justify; }
.dialog-body .cta-box { margin-top: 2.5rem; padding: 1.5rem; text-align: center; border: 1px solid var(--border); border-radius: 1rem; background: linear-gradient(135deg, rgba(10,77,46,0.08), rgba(201,164,74,0.08)); }
.dialog-body .cta-box h3 { margin: 0; font-size: 1.125rem; font-weight: 600; }
.dialog-foot { padding: 0.75rem 1.5rem; border-top: 1px solid var(--border); background: rgba(241,237,226,0.3); display: flex; justify-content: flex-end; }

html[dir="rtl"] .dialog-body .intro-box,
html[dir="rtl"] .form-note { border-left: 0; border-right: 4px solid var(--primary); }
