/* =====================================================
   CALENDAR.CSS — PART 1
   Clean Layout (Theme.css Compatible)
   Header + Navigation + Weekdays
===================================================== */


/* ================= BASE LAYOUT ================= */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Remove duplicated reset — theme.css already handles it */


/* ================= HEADER ================= */

.header {
  position: sticky;
  top: 0;
  z-index: 40;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0.9rem max(1.25rem, env(safe-area-inset-right)) 0.9rem max(1.25rem, env(safe-area-inset-left));

  backdrop-filter: blur(10px);
  background: inherit;

  border-bottom: 1px solid rgba(191, 167, 66, 0.35);

  transition: background .3s ease;
}

body.dim .header {
  background: rgba(31, 41, 55, 0.85);
}

body.dark .header {
  background: rgba(2, 6, 23, 0.85);
}

.header a {
  font-size: 1.4rem;
  font-weight: 700;
  text-decoration: none;
  color: #bfa742;
  transition: opacity .2s ease, transform .15s ease;
}

.header a:hover {
  opacity: .8;
  transform: translateY(-2px);
}

.header .titles {
  text-align: center;
  flex: 1;
}

.header .gregorian {
  font-size: 1.1rem;
  font-weight: 600;
}

.header .hijri {
  font-size: .85rem;
  margin-top: .15rem;
  opacity: .75;
}


/* ================= NAVIGATION BUTTONS ================= */

.nav-buttons {
  position: sticky;
  top: 64px;
  z-index: 30;

  display: flex;
  gap: .6rem;

  padding: .8rem max(1.25rem, env(safe-area-inset-right)) .6rem max(1.25rem, env(safe-area-inset-left));
  background: inherit;
}

body.dim .nav-buttons {
  background: rgba(31, 41, 55, 0.55);
}

body.dark .nav-buttons {
  background: rgba(2, 6, 23, 0.55);
}

.nav-buttons button {
  flex: 1;
  min-height: 42px;

  font-size: .9rem;
  font-weight: 600;

  border-radius: 0.75rem;
  border: 1px solid rgba(191, 167, 66, 0.4);

  background: transparent;
  color: inherit;

  cursor: pointer;
  transition:
    background .25s ease,
    transform .15s ease,
    box-shadow .2s ease;
}

.nav-buttons button:hover {
  background: rgba(191, 167, 66, 0.15);
  transform: translateY(-2px);
}

.nav-buttons button:active {
  transform: scale(.97);
}

.nav-buttons button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(191, 167, 66, 0.45);
}


/* ================= WEEKDAY ROW ================= */

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .35rem;

  padding: 0 max(1rem, env(safe-area-inset-right)) .5rem max(1rem, env(safe-area-inset-left));
}

.weekday {
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;

  padding: .35rem 0;

  opacity: .65;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

body.dim .weekday,
body.dark .weekday {
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.weekday.friday {
  color: #bfa742;
  font-weight: 700;
}


/* ================= CONTAINER SPACING ================= */

.calendar-container {
  flex: 1;
  padding-bottom: 1rem;
}



/* =====================================================
   CALENDAR.CSS — PART 2
   Day Cards + States + Modal + Legend
===================================================== */


/* ================= CALENDAR GRID ================= */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: clamp(0.25rem, 1.5vw, 0.4rem);
  padding: 0 max(1rem, env(safe-area-inset-right)) 1.25rem max(1rem, env(safe-area-inset-left));
}


/* ================= DAY CARD ================= */

.day-card {
  position: relative;

  min-height: clamp(58px, 12vw, 70px);
  padding: .55rem .35rem;

  border-radius: .75rem;

  background: rgba(0,0,0,.03);
  cursor: pointer;

  text-align: center;
  font-weight: 500;

  transition:
    transform .15s ease,
    box-shadow .2s ease,
    background .2s ease;
}

body.dim .day-card {
  background: #1f2937;
}

body.dark .day-card {
  background: #020617;
}

.day-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.day-card:active {
  transform: scale(.96);
}


/* ================= HIJRI TEXT ================= */

.day-card .hijri {
  display: block;
  margin-top: .2rem;

  font-size: .65rem;
  opacity: .6;
}


/* ================= EMPTY CELL ================= */

.day-card.empty {
  background: transparent;
  box-shadow: none;
  cursor: default;
}


/* ================= SELECTED ================= */

.day-card.selected {
  outline: 2px solid #bfa742;
  outline-offset: -2px;
}


/* ================= TODAY ================= */

.day-card.today {
  border: 1px solid #bfa742;
  font-weight: 600;
}

.day-card.today::before {
  content: "";
  position: absolute;

  top: 8px;
  right: 8px;

  width: 6px;
  height: 6px;
  border-radius: 50%;

  background: #bfa742;
}


/* ================= EVENT DOT ================= */

.day-card.event::after {
  content: "";

  position: absolute;
  bottom: 8px;
  right: 8px;

  width: 6px;
  height: 6px;
  border-radius: 50%;

  background: #f59e0b;
}


/* ================= LEGEND ================= */

.legend {
  margin: 1rem 0 1.5rem;

  display: flex;
  justify-content: center;
  gap: 2rem;

  font-size: .85rem;
  align-items: center;
}

.legend div {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.legend span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend .today {
  background: #bfa742;
}

.legend .event {
  background: #f59e0b;
}


/* ================= MODAL (CLEAN CHAT STYLE) ================= */

.modal {
  display: none;
  position: fixed;
  inset: 0;

  background: rgba(0,0,0,.6);

  justify-content: center;
  align-items: center;

  z-index: 100;
}

.modal-content {
  width: min(92%, 400px);
  max-width: calc(100vw - 2rem);
  margin: 0 1rem;

  padding: 1.4rem;

  border-radius: 1rem;

  background: #ffffff;
  color: #1f2937;

  position: relative;

  animation: modalFade .25s ease;
}

body.dim .modal-content {
  background: #1f2937;
  color: #e5e7eb;
}

body.dark .modal-content {
  background: #020617;
  color: #f8fafc;
}

.modal-content h3 {
  margin-top: 0;
  color: #bfa742;
}

.modal-close {
  position: absolute;
  top: .6rem;
  right: .9rem;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: .7;
  transition: opacity .2s ease;
}

.modal-close:hover {
  opacity: 1;
}

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


/* ================= HIJRI SETTINGS BUTTON ================= */

.hijri-settings-btn {
  position: absolute;
  right: 1rem;

  height: 32px;
  padding: 0 10px;

  border-radius: 10px;
  border: 1px solid rgba(191, 167, 66, 0.4);

  background: transparent;
  color: inherit;

  font-size: 12px;
  font-weight: 600;

  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}

.hijri-settings-btn:active {
  transform: scale(.96);
}

.hijri-settings-btn:hover {
  background: rgba(191, 167, 66, 0.15);
}


/* ================= HIJRI POPUP (Moon Sighting) ================= */

.hijri-popup {
  position: absolute;
  top: 52px;
  right: 0;

  width: 260px;
  padding: 1rem 1.1rem;

  border-radius: 14px;
  border: 1px solid rgba(191, 167, 66, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);

  backdrop-filter: blur(14px);

  background: rgba(255, 255, 255, 0.96);

  display: none;
  flex-direction: column;
  gap: 0.75rem;

  z-index: 120;
}

body.dim .hijri-popup {
  background: rgba(31, 41, 55, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

body.dark .hijri-popup {
  background: rgba(2, 6, 23, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.hijri-popup-title {
  font-size: 1rem;
  font-weight: 700;
  color: #bfa742;
  margin: 0 0 0.15rem 0;
}

.hijri-popup-desc {
  font-size: 0.72rem;
  line-height: 1.4;
  color: inherit;
  opacity: 0.75;
  margin: 0;
}

.hijri-popup-hint {
  font-size: 0.65rem;
  opacity: 0.55;
  margin: 0;
}

.hijri-popup .hijri-adjust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hijri-popup .hijri-adjust button {
  flex: 1;
  min-width: 42px;

  padding: 0.5rem 0.4rem;

  border-radius: 8px;
  border: 1px solid rgba(191, 167, 66, 0.4);

  background: transparent;
  color: inherit;
  font-size: 0.85rem;
  font-weight: 600;

  cursor: pointer;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
}

.hijri-popup .hijri-adjust button:hover {
  background: rgba(191, 167, 66, 0.12);
  border-color: rgba(191, 167, 66, 0.6);
}

.hijri-popup .hijri-adjust button.active {
  background: #bfa742;
  color: #111;
  border-color: #bfa742;
}

