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

body {
  font-family: 'Inter', sans-serif;
  background: #f8f9fa;
  color: #1a1a1a;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  transition: background-color 0.5s ease, color 0.5s ease;
}

body.dark {
  background: #0d1b2a;
  color: #e0e1dd;
}

/* ====================
   Layout
   ==================== */
.app-wrapper {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.main-container {
  background: white;
  border-radius: 24px;
  padding: 2.6rem;
  box-shadow: 0 12px 40px rgba(26, 100, 50, 0.15);
  position: relative;
  border: 1px solid rgba(34, 150, 80, 0.1);
  transition: all 0.5s ease;
}

body.dark .main-container {
  background: #1b263b;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(80, 180, 100, 0.2);
  color: #e0e1dd;
}

/* ====================
   Components
   ==================== */

/* Dark Mode Toggle */
.btn-dark-mode {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #d4edda;
  color: #155724;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.4s ease;
}

body.dark .btn-dark-mode {
  background: #1b4332;
  color: #80c794;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-dark-mode:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Typography */
.title {
  font-family: 'Amiri', serif;
  font-size: 2.3rem;
  font-weight: 700;
  color: #1b4332;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

body.dark .title {
  color: #a8d8aa;
}

.subtitle {
  font-size: 1.15rem;
  color: #2d6a4f;
  text-align: center;
  max-width: 500px;
  margin: 0 auto 1.6rem;
  font-weight: 400;
}

body.dark .subtitle {
  color: #b7e4c7;
}

/* Input Group */
.input-group {
  margin: 1.8rem 0;
  text-align: center;
}

.label {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: #1b4332;
}

body.dark .label {
  color: #b7e4c7;
}

#dateInput {
  font-family: 'Inter', sans-serif;
  padding: 1rem 1.4rem;
  border: 2px solid #40916c;
  border-radius: 14px;
  font-size: 1.1rem;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  outline: none;
  background: white;
  color: #1a1a1a;
  transition: all 0.3s ease;
}

body.dark #dateInput {
  background: #131f33;
  color: #e0e1dd;
  border-color: #52b788;
}

#dateInput:focus {
  border-color: #2d6a4f;
  box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.2);
}

.btn-primary {
  margin-top: 1rem;
  padding: 0.95rem 1.6rem;
  background: linear-gradient(to right, #1b4332, #2d6a4f);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 14px rgba(27, 67, 50, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(27, 67, 50, 0.4);
  background: linear-gradient(to right, #183a2b, #2a5f47);
}

/* Cards */
.card {
  background: #f8fff9;
  border-radius: 18px;
  padding: 1.8rem;
  margin-top: 1.6rem;
  box-shadow: 0 6px 20px rgba(27, 67, 50, 0.1);
  transition: all 0.4s ease;
  border: 1px solid rgba(64, 145, 108, 0.12);
}

body.dark .card {
  background: #131f33;
  border-color: rgba(80, 180, 100, 0.2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.card-title {
  font-family: 'Amiri', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: #1b4332;
  margin-bottom: 1.2rem;
  text-align: center;
}

body.dark .card-title {
  color: #a8d8aa;
}

/* Age & Countdown Grids */
.age-grid,
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1rem;
  margin-top: 1.2rem;
}

.age-unit {
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  padding: 1rem;
  background: #e8f5e9;
  border-radius: 12px;
  color: #0a2b1d;
  font-weight: 700;
  border: 1px solid rgba(64, 145, 108, 0.2);
}

body.dark .age-unit {
  background: rgba(25, 60, 40, 0.5);
  color: #d8f3dc;
  border-color: rgba(80, 180, 100, 0.3);
}

.age-unit span {
  font-size: 1.9rem;
  color: #1b4332;
  display: block;
}

body.dark .age-unit span {
  color: #52b788;
}

/* Progress Bar */
.progress-track {
  width: 100%;
  height: 14px;
  background: #e8f5e9;
  border-radius: 7px;
  overflow: hidden;
  margin: 1.3rem 0;
  border: 1px solid rgba(64, 145, 108, 0.2);
}

body.dark .progress-track {
  background: rgba(25, 60, 40, 0.4);
  border-color: rgba(80, 180, 100, 0.3);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1b4332, #2d6a4f);
  border-radius: 7px;
  transition: width 1s ease-out;
  box-shadow: 0 1px 6px rgba(27, 67, 50, 0.4);
}

.text-sm {
  font-size: 0.95rem;
  color: #2d6a4f;
  text-align: center;
  margin-bottom: 0.8rem;
}

body.dark .text-sm {
  color: #b7e4c7;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #2d6a4f;
}

body.dark .progress-labels {
  color: #95c9a6;
}

.overflow-text {
  font-size: 0.95rem;
  color: #2d6a4f;
  text-align: center;
  margin-top: 0.6rem;
  font-style: italic;
}

body.dark .overflow-text {
  color: #b7e4c7;
}

/* Footer */
.footer {
  margin-top: 2.5rem;
  padding: 1.5rem;
  text-align: center;
  font-family: 'Amiri', serif;
  color: #2d6a4f;
  font-size: 0.95rem;
  opacity: 0.95;
}

body.dark .footer {
  color: #a8d8aa;
}

.footer blockquote {
  border-left: 4px solid #2d6a4f;
  padding-left: 1rem;
  margin: 0;
}

body.dark .footer blockquote {
  border-left: 4px solid #52b788;
}

.arabic {
  font-size: 1.4rem;
  line-height: 2;
  font-weight: 700;
  color: #1b4332;
  margin-bottom: 0.6rem;
  font-family: 'Amiri', serif;
}

body.dark .arabic {
  color: #b7e4c7;
}

.translation {
  font-size: 1rem;
  font-style: italic;
  color: #40916c;
  margin: 0.5rem 0;
  font-family: 'Inter', sans-serif;
}

body.dark .translation {
  color: #c5e8d0;
}

.source {
  font-size: 0.85rem;
  color: #52b788;
  margin: 0;
  font-family: 'Inter', sans-serif;
}

.source a {
  color: #52b788;
  text-decoration: none;
}

.source a:hover {
  text-decoration: underline;
}

/* ====================
   Responsive
   ==================== */
@media (max-width: 600px) {
  .main-container {
    padding: 1.8rem;
    border-radius: 18px;
  }

  .title {
    font-size: 1.9rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .age-grid,
  .countdown-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .age-unit span {
    font-size: 1.6rem;
  }

  .countdown-grid {
    font-size: 1.3rem;
  }

  .footer {
    padding: 1rem;
    font-size: 0.85rem;
  }

  .arabic {
    font-size: 1.2rem;
  }
}
