/* ============================================
   DaysTillAi – main.css
   Shared stylesheet for EN (/index.html)
   and AR (/ar/index.html)
   ============================================ */

/* === CSS VARIABLES === */
:root {
  --gold: #C9A84C;
  --gold-light: #E8C97A;
  --gold-dark: #8B6914;
  --ink: #0F0D0A;
  --parchment: #F7F2E8;
  --parchment-dark: #EDE5D0;
  --sand: #D4C4A0;
  --white: #FDFAF4;
  --text: #2C2416;
  --text-muted: #7A6A4A;
  --card-bg: rgba(255, 255, 255, 0.72);
  --shadow: 0 8px 40px rgba(15, 13, 10, 0.10);
  --radius: 18px;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--parchment);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body:not([dir="rtl"]) { font-family: 'DM Sans', sans-serif; }
body[dir="rtl"] { font-family: 'Cairo', sans-serif; direction: rtl; }

/* === BACKGROUND PATTERN === */
.bg-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 10%, rgba(201,168,76,0.13) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 90%, rgba(139,105,20,0.10) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C9A84C' fill-opacity='0.04'%3E%3Cpath d='M30 0l30 30-30 30L0 30z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  background-color: var(--parchment);
  pointer-events: none;
}

body[dir="rtl"] .bg-pattern {
  background:
    radial-gradient(ellipse 80% 60% at 85% 10%, rgba(201,168,76,0.13) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 15% 90%, rgba(139,105,20,0.10) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C9A84C' fill-opacity='0.04'%3E%3Cpath d='M30 0l30 30-30 30L0 30z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  background-color: var(--parchment);
}

/* === HEADER === */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 60px);
  height: 70px;
  background: rgba(247,242,232,0.90);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(201,168,76,0.18);
}

.logo { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.55rem; }
body:not([dir="rtl"]) .logo { font-family: 'Cormorant Garamond', serif; letter-spacing: -0.02em; }
body[dir="rtl"] .logo { font-family: 'Amiri', serif; }
.logo span { color: var(--gold); }

nav { display: flex; align-items: center; gap: 28px; }
nav a { font-size: 0.875rem; font-weight: 500; color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
nav a:hover { color: var(--gold-dark); }

/* ============================================
   NAV DROPDOWN
   ============================================ */
.nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-dropdown-trigger {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 0;
}
body[dir="rtl"] .nav-dropdown-trigger { font-family: 'Cairo', sans-serif; font-size: 0.9rem; }
.nav-dropdown-trigger:hover { color: var(--gold-dark); }

.nav-chevron {
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform 0.22s;
  line-height: 1;
  display: inline-block;
}
.nav-dropdown.open .nav-chevron { transform: rotate(180deg); }

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 14px);
  background: var(--white);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 13px;
  box-shadow: 0 12px 40px rgba(15,13,10,0.11);
  overflow: hidden;
  min-width: 210px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 150;
}

/* LTR: opens left-aligned; RTL: opens right-aligned */
body:not([dir="rtl"]) .nav-dropdown-menu { left: 0; }
body[dir="rtl"]       .nav-dropdown-menu { right: 0; }

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 18px;
  font-size: 0.855rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(201,168,76,0.09);
  white-space: nowrap;
}
body[dir="rtl"] .nav-dropdown-menu a { font-family: 'Cairo', sans-serif; font-size: 0.88rem; }
.nav-dropdown-menu a:last-child { border-bottom: none; }
.nav-dropdown-menu a:hover { background: rgba(201,168,76,0.08); color: var(--gold-dark); }
.nav-dropdown-menu a.active { background: rgba(201,168,76,0.13); color: var(--gold-dark); font-weight: 600; }

.nav-icon { font-size: 1rem; line-height: 1; flex-shrink: 0; }

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */
.lang-switcher { position: relative; display: flex; align-items: center; gap: 8px; }

.lang-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1.5px solid rgba(201,168,76,0.35);
  border-radius: 50px;
  background: rgba(201,168,76,0.07);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  transition: all 0.2s;
  user-select: none;
}
body:not([dir="rtl"]) .lang-btn { font-family: 'DM Sans', sans-serif; }
body[dir="rtl"] .lang-btn { font-family: 'Cairo', sans-serif; }
.lang-btn:hover { border-color: var(--gold); background: rgba(201,168,76,0.13); }
.lang-btn .flag { font-size: 1.1rem; line-height: 1; }
.lang-btn .chevron { font-size: 0.65rem; color: var(--text-muted); transition: transform 0.2s; }
.lang-btn.open .chevron { transform: rotate(180deg); }

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  background: var(--white);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15,13,10,0.12);
  overflow: hidden;
  min-width: 150px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: all 0.2s;
  z-index: 200;
}
body:not([dir="rtl"]) .lang-dropdown { right: 0; }
body[dir="rtl"] .lang-dropdown { left: 0; }
.lang-dropdown.open { opacity: 1; pointer-events: all; transform: translateY(0); }

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s;
}
.lang-option:hover { background: rgba(201,168,76,0.08); }
.lang-option.active { background: rgba(201,168,76,0.12); color: var(--gold-dark); }
.lang-option .flag { font-size: 1.2rem; }

/* === HERO === */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: clamp(50px,8vw,90px) clamp(20px,5vw,60px) clamp(30px,5vw,50px);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  background: rgba(201,168,76,0.12);
  border: 1px solid rgba(201,168,76,0.30);
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold-dark);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 22px;
  animation: fadeUp 0.6s ease both;
}
body[dir="rtl"] .hero-badge { letter-spacing: 0.02em; font-size: 0.82rem; }

h1 {
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 16px;
  animation: fadeUp 0.6s 0.1s ease both;
  font-size: clamp(2.4rem,6vw,4.2rem);
}
body:not([dir="rtl"]) h1 { font-family: 'Cormorant Garamond', serif; letter-spacing: -0.02em; line-height: 1.08; }
body[dir="rtl"] h1 { font-family: 'Amiri', serif; font-size: clamp(2.2rem,6vw,4rem); line-height: 1.2; }
h1 em { font-style: normal; color: var(--gold); }

.hero-sub {
  font-size: clamp(0.95rem,2vw,1.1rem);
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 40px;
  line-height: 1.65;
  font-weight: 300;
  animation: fadeUp 0.6s 0.2s ease both;
}
body[dir="rtl"] .hero-sub { line-height: 1.8; }

/* === CONVERTER CARD === */
.converter-wrap {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 clamp(16px,4vw,40px);
  animation: fadeUp 0.7s 0.3s ease both;
}

.converter-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(201,168,76,0.22);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 1px 0 rgba(255,255,255,0.8) inset;
  overflow: hidden;
}

.tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid rgba(201,168,76,0.18);
}

.tab-btn {
  padding: 18px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.01em;
  position: relative;
}
body:not([dir="rtl"]) .tab-btn { font-family: 'DM Sans', sans-serif; }
body[dir="rtl"] .tab-btn { font-family: 'Cairo', sans-serif; font-size: 0.92rem; }
.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 20%; right: 20%;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform 0.25s;
}
.tab-btn.active { color: var(--ink); font-weight: 600; }
body[dir="rtl"] .tab-btn.active { font-weight: 700; }
.tab-btn.active::after { transform: scaleX(1); }
.tab-btn:hover { background: rgba(201,168,76,0.05); }

.converter-body { padding: clamp(24px,4vw,40px); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 560px) { .input-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 380px) { .input-grid { grid-template-columns: 1fr; } }

.field-group { display: flex; flex-direction: column; gap: 7px; }

.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
body[dir="rtl"] .field-label { letter-spacing: 0.05em; }

.field-select,
.field-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid rgba(201,168,76,0.25);
  border-radius: 11px;
  background: rgba(247,242,232,0.60);
  font-size: 0.95rem;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
body:not([dir="rtl"]) .field-select,
body:not([dir="rtl"]) .field-input { font-family: 'DM Sans', sans-serif; }
body[dir="rtl"] .field-select,
body[dir="rtl"] .field-input { font-family: 'Cairo', sans-serif; text-align: right; }

body:not([dir="rtl"]) .field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A6A4A' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
body[dir="rtl"] .field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A6A4A' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 36px;
  cursor: pointer;
}
.field-select:focus,
.field-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
  background: rgba(255,255,255,0.85);
}

.convert-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 60%, var(--gold-light) 100%);
  color: var(--ink);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(201,168,76,0.35);
  position: relative;
  overflow: hidden;
}
body:not([dir="rtl"]) .convert-btn { font-family: 'DM Sans', sans-serif; }
body[dir="rtl"] .convert-btn { font-family: 'Cairo', sans-serif; font-weight: 700; }
.convert-btn::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0); transition: background 0.2s; }
.convert-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(201,168,76,0.45); }
.convert-btn:hover::before { background: rgba(255,255,255,0.08); }
.convert-btn:active { transform: translateY(0); }

.result-box {
  margin-top: 22px;
  padding: 22px 24px;
  background: linear-gradient(135deg, rgba(201,168,76,0.08) 0%, rgba(247,242,232,0.5) 100%);
  border: 1.5px solid rgba(201,168,76,0.25);
  border-radius: 13px;
  display: none;
}
.result-box.show { display: block; animation: fadeUp 0.35s ease; }

.result-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--gold-dark);
  margin-bottom: 8px;
}
body[dir="rtl"] .result-label { letter-spacing: 0.06em; }

.result-date { font-weight: 700; color: var(--ink); font-size: clamp(1.5rem,4vw,2.2rem); }
body:not([dir="rtl"]) .result-date { font-family: 'Cormorant Garamond', serif; letter-spacing: -0.01em; }
body[dir="rtl"] .result-date { font-family: 'Amiri', serif; }

.result-meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; font-weight: 300; }
body[dir="rtl"] .result-meta { font-weight: 400; font-size: 0.85rem; }

.today-btn {
  font-size: 0.78rem;
  color: var(--gold-dark);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-top: 4px;
  transition: color 0.2s;
}
body:not([dir="rtl"]) .today-btn { font-family: 'DM Sans', sans-serif; }
body[dir="rtl"] .today-btn { font-family: 'Cairo', sans-serif; font-size: 0.82rem; font-weight: 600; }
.today-btn:hover { color: var(--gold); }

.umm-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
}
body[dir="rtl"] .umm-note { font-size: 0.8rem; }
.umm-note span { color: var(--gold-dark); font-weight: 600; }
body[dir="rtl"] .umm-note span { font-weight: 700; }

/* === SECTIONS === */
.section {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(50px,7vw,80px) clamp(20px,5vw,40px);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 12px;
}
body[dir="rtl"] .section-label { font-size: 0.75rem; letter-spacing: 0.08em; }

.section-title { font-weight: 700; color: var(--ink); line-height: 1.1; margin-bottom: 14px; font-size: clamp(1.8rem,4vw,2.8rem); }
body:not([dir="rtl"]) .section-title { font-family: 'Cormorant Garamond', serif; letter-spacing: -0.02em; }
body[dir="rtl"] .section-title { font-family: 'Amiri', serif; line-height: 1.2; }

.section-desc { font-size: 0.95rem; color: var(--text-muted); line-height: 1.7; max-width: 500px; font-weight: 300; margin-bottom: 40px; }
body[dir="rtl"] .section-desc { line-height: 1.8; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 18px; }

.feature-card {
  background: var(--card-bg);
  border: 1px solid rgba(201,168,76,0.18);
  border-radius: 15px;
  padding: 28px 26px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(15,13,10,0.09); }

.feature-icon {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, rgba(201,168,76,0.15), rgba(201,168,76,0.05));
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.feature-title { font-weight: 700; color: var(--ink); margin-bottom: 8px; font-size: 1.15rem; }
body:not([dir="rtl"]) .feature-title { font-family: 'Cormorant Garamond', serif; }
body[dir="rtl"] .feature-title { font-family: 'Amiri', serif; font-size: 1.2rem; }

.feature-desc { font-size: 0.845rem; color: var(--text-muted); line-height: 1.6; font-weight: 300; }
body[dir="rtl"] .feature-desc { font-size: 0.875rem; line-height: 1.7; }

/* === INFO SECTION === */
.info-section {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 clamp(20px,5vw,40px) clamp(50px,7vw,80px);
}

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 640px) { .info-grid { grid-template-columns: 1fr; } }

.info-card {
  background: var(--card-bg);
  border: 1px solid rgba(201,168,76,0.18);
  border-radius: 15px;
  padding: 28px;
}

.info-card h3 { font-weight: 700; color: var(--ink); margin-bottom: 14px; font-size: 1.25rem; }
body:not([dir="rtl"]) .info-card h3 { font-family: 'Cormorant Garamond', serif; }
body[dir="rtl"] .info-card h3 { font-family: 'Amiri', serif; font-size: 1.3rem; }

.info-card p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; font-weight: 300; }
body[dir="rtl"] .info-card p { font-size: 0.9rem; line-height: 1.85; }

/* === FOOTER === */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(201,168,76,0.18);
  padding: 30px clamp(20px,5vw,60px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-logo { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.2rem; }
body:not([dir="rtl"]) .footer-logo { font-family: 'Cormorant Garamond', serif; }
body[dir="rtl"] .footer-logo { font-family: 'Amiri', serif; }
.footer-logo span { color: var(--gold); }

.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { font-size: 0.8rem; color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
body[dir="rtl"] .footer-links a { font-size: 0.82rem; }
.footer-links a:hover { color: var(--gold-dark); }

.footer-copy { font-size: 0.78rem; color: var(--text-muted); }
body[dir="rtl"] .footer-copy { font-size: 0.8rem; }

/* === ORNAMENT === */
.ornament { text-align: center; color: var(--gold); font-size: 1.2rem; letter-spacing: 0.3em; opacity: 0.5; margin: 0 auto 40px; }

/* === MOBILE NAV === */
.nav-links { display: flex; align-items: center; gap: 24px; }
@media (max-width: 600px) { .nav-links { display: none; } }

/* === ANIMATIONS === */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}