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

:root {
  --primary: #0d7377;
  --primary-dark: #0a5558;
  --primary-light: #14a098;
  --accent: #f4a261;
  --accent-dark: #e76f51;
  --bg: #fafaf7;
  --bg-alt: #ffffff;
  --text: #1a2e2f;
  --text-light: #5a6e70;
  --text-muted: #8a9a9c;
  --border: #e5e9ea;
  --success: #06a77d;
  --error: #e63946;
  --shadow-sm: 0 2px 8px rgba(13, 115, 119, 0.06);
  --shadow-md: 0 8px 24px rgba(13, 115, 119, 0.1);
  --shadow-lg: 0 20px 60px rgba(13, 115, 119, 0.15);
  --radius: 14px;
  --radius-lg: 20px;
}

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

body {
  font-family: 'Tajawal', -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-narrow {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5 {
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin-bottom: 0.8rem; }
h3 { font-size: 1.3rem; margin-bottom: 0.6rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; color: var(--text-light); }

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

ul, ol { padding-right: 24px; margin-bottom: 1rem; }
li { margin-bottom: 8px; color: var(--text-light); }

/* ===== Header ===== */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.3rem;
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav a {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
}

.nav a:hover { color: var(--primary); }
.nav a.active { color: var(--primary); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--primary);
  padding: 4px 8px;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #0d7377 0%, #14a098 100%);
  color: white;
  padding: 70px 0 60px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(244, 162, 97, 0.15) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  color: white;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  margin-bottom: 1rem;
}

.hero p {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.1rem;
  max-width: 620px;
  margin: 0 auto 2rem;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 30px;
  font-size: 0.85rem;
  color: white;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

/* ===== Converter Card ===== */
.converter-card {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 34px;
  box-shadow: var(--shadow-lg);
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.converter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 26px;
  background: var(--bg);
  padding: 6px;
  border-radius: 12px;
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.25s;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 12px;
}

.two-dates {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.date-block {
  background: var(--bg);
  padding: 16px;
  border-radius: 12px;
}

.date-block h4 { margin-bottom: 10px; color: var(--primary); }

.form-input, .form-select {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.98rem;
  background: var(--bg-alt);
  color: var(--text);
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 115, 119, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 30px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  width: 100%;
}

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

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-sm {
  padding: 10px 18px;
  font-size: 0.9rem;
  width: auto;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

/* ===== Result Box ===== */
.result-box {
  margin-top: 24px;
  padding: 24px;
  background: linear-gradient(135deg, #f0f9f9 0%, #e0f4f3 100%);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius);
  display: none;
}

.result-box.show {
  display: block;
  animation: slideIn 0.4s ease-out;
}

.result-box.error {
  background: #fff5f5;
  border-color: var(--error);
}

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

.result-label {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-bottom: 4px;
  font-weight: 600;
}

.result-main {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 10px;
  line-height: 1.3;
}

.result-day {
  display: inline-block;
  padding: 6px 14px;
  background: var(--primary);
  color: white;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.result-item {
  background: white;
  padding: 14px;
  border-radius: 10px;
  text-align: center;
}

.result-item-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.result-item-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ===== Today Widget ===== */
.today-widget {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 720px;
  margin: 40px auto 0;
}

.today-item {
  text-align: center;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
}

.today-item-label {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 6px;
}

.today-item-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.4;
}

.today-item-day {
  font-size: 0.9rem;
  color: var(--accent-dark);
  margin-top: 4px;
  font-weight: 700;
}

/* ===== Sections ===== */
.section { padding: 70px 0; }
.section-alt { background: var(--bg-alt); }

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 50px;
}

.section-header h2 { margin-bottom: 12px; }
.section-header p { font-size: 1.08rem; }

.section-tag {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(13, 115, 119, 0.1);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ===== Tools Grid ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.tool-card {
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all 0.3s;
  display: block;
  color: var(--text);
  text-decoration: none;
}

.tool-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  color: var(--text);
}

.tool-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.6rem;
  margin-bottom: 16px;
}

.tool-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.tool-card p {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.tool-link {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ===== Features ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.feature-card {
  text-align: center;
  padding: 32px 24px;
}

.feature-icon {
  width: 70px;
  height: 70px;
  background: rgba(13, 115, 119, 0.1);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 1.8rem;
}

.feature-card h3 { margin-bottom: 8px; }

/* ===== Content ===== */
.content-section {
  max-width: 820px;
  margin: 0 auto;
}

.content-section h2 { margin-top: 40px; }
.content-section h2:first-child { margin-top: 0; }
.content-section h3 { margin-top: 28px; }

.content-section p {
  font-size: 1.05rem;
  margin-bottom: 16px;
  color: var(--text);
}

.content-section ul, .content-section ol {
  margin-bottom: 16px;
}

.content-section li {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 1.02rem;
}

/* ===== FAQ ===== */
.faq-list {
  max-width: 820px;
  margin: 0 auto;
}

.faq-item {
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.25s;
}

.faq-item:hover { border-color: var(--primary-light); }

.faq-question {
  padding: 20px 24px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  user-select: none;
}

.faq-toggle {
  font-size: 1.5rem;
  color: var(--primary);
  transition: transform 0.25s;
  font-weight: 400;
}

.faq-item.active .faq-toggle { transform: rotate(45deg); }

.faq-answer {
  padding: 0 24px;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s;
}

.faq-item.active .faq-answer {
  padding: 0 24px 20px;
  max-height: 800px;
}

.faq-answer p { color: var(--text-light); margin: 0; }

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  padding: 16px 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.breadcrumbs a { color: var(--text-light); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { margin: 0 8px; color: var(--text-muted); }

/* ===== Footer ===== */
.footer {
  background: #0d1f21;
  color: #cbd5d6;
  padding: 60px 0 30px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand { max-width: 320px; }

.footer-brand .logo { color: white; margin-bottom: 16px; }

.footer-brand p {
  color: #94a3a5;
  font-size: 0.95rem;
  line-height: 1.7;
}

.footer-col h4 {
  color: white;
  font-size: 1rem;
  margin-bottom: 18px;
}

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

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

.footer-col a {
  color: #94a3a5;
  font-size: 0.92rem;
  transition: color 0.2s;
}

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

.footer-bottom {
  padding-top: 30px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  color: #94a3a5;
  font-size: 0.88rem;
}

.footer-bottom p { color: #94a3a5; margin-bottom: 4px; }

/* ===== Ad Slots ===== */
.ad-slot {
  margin: 40px auto;
  padding: 20px;
  background: #f5f5f3;
  border: 1px dashed #d0d5d6;
  border-radius: 8px;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
  max-width: 728px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Cookie Banner ===== */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  left: 20px;
  max-width: 500px;
  margin: 0 auto;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
}

.cookie-banner.show { display: block; }

.cookie-banner p {
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.cookie-buttons {
  display: flex;
  gap: 10px;
}

.cookie-buttons button {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-accept { background: var(--primary); color: white; }
.btn-decline { background: var(--bg); color: var(--text); }

/* ===== Back to Top ===== */
.back-top {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  font-size: 1.3rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 99;
}

.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:hover { background: var(--primary-dark); transform: translateY(-3px); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 100px;
  right: 50%;
  transform: translateX(50%);
  background: var(--success);
  color: white;
  padding: 14px 24px;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 2000;
}

.toast.show { opacity: 1; top: 90px; }

/* ===== Tables ===== */
.data-table {
  width: 100%;
  background: var(--bg-alt);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin: 20px 0;
  border-collapse: collapse;
}

.data-table th {
  background: var(--primary);
  color: white;
  padding: 14px;
  text-align: right;
  font-weight: 700;
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: var(--bg-alt);
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    box-shadow: var(--shadow-md);
    border-top: 1px solid var(--border);
    display: none;
  }
  .nav.open { display: flex; }
  .menu-toggle { display: block; }
  
  .converter-card { padding: 24px; }
  .today-widget { grid-template-columns: 1fr; padding: 20px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
  .footer-brand { grid-column: 1 / -1; }
  .date-inputs { grid-template-columns: 1fr; }
  .section { padding: 50px 0; }
  .hero { padding: 50px 0 40px; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.7rem; }
  .converter-card { padding: 20px; }
  .back-top { bottom: 20px; left: 20px; width: 42px; height: 42px; }
}

/* ===== Print ===== */
@media print {
  .header, .footer, .ad-slot, .cookie-banner, .back-top { display: none; }
}
