:root{
  --brand: #037edb;
  --brand-dark: #025fa3;
  --brand-darker: #024a80;
  --brand-tint: #eaf5ff;
  --brand-tint-2: #d6ecfe;
  --friday-tint: #fff4e0;
  --friday-text: #a15c00;
  --ink: #14202b;
  --ink-soft: #52697a;
  --ink-faint: #8fa3b3;
  --line: #dfe9f0;
  --bg: #f4f8fb;
  --card: #ffffff;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px -12px rgba(3, 126, 219, 0.18);
  --font-en: 'Poppins', sans-serif;
  --font-bn: 'Noto Serif Bengali', serif;
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-en);
  -webkit-font-smoothing: antialiased;
}

.bn{ font-family: var(--font-bn); }

.app{
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.brand{
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark{
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(155deg, var(--brand), var(--brand-darker));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 16px -4px rgba(3, 126, 219, 0.5);
}

.brand-mark i{ width: 22px; height: 22px; }

.brand-text h1{
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand-sub{
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.icon-btn{
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-en);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.icon-btn i{ width: 16px; height: 16px; }

.icon-btn:hover{
  background: var(--brand-tint);
  border-color: var(--brand-tint-2);
}

.icon-btn:active{ transform: scale(0.97); }

.icon-btn:focus-visible{
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Month switcher ---------- */
.month-switcher{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.nav-btn{
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}

.nav-btn:hover{ background: var(--brand-tint); }
.nav-btn:active{ transform: scale(0.94); }
.nav-btn:focus-visible{ outline: 2px solid var(--brand); outline-offset: 2px; }
.nav-btn i{ width: 20px; height: 20px; }

.month-title{
  text-align: center;
  flex: 1;
  min-width: 0;
}

.month-title h2{
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brand-darker);
  letter-spacing: -0.01em;
}

.month-title .bn{
  margin: 2px 0 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.month-title .range{
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Calendar card ---------- */
.calendar-card{
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 16px;
}

.weekday-row{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: linear-gradient(155deg, var(--brand), var(--brand-dark));
}

.weekday-row div{
  text-align: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 12px 4px;
}

.days-grid{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.day-cell{
  position: relative;
  padding: 10px 6px 12px;
  min-height: 78px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
}

.days-grid .day-cell:nth-child(7n){ border-right: none; }

.day-cell.empty{ background: #fbfdfe; }

.day-cell.friday{ background: var(--friday-tint); }

.hijri-num{
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  margin-top: 4px;
}

.day-cell.friday .hijri-num{ color: var(--friday-text); }

.greg-date{
  font-size: 0.68rem;
  color: var(--ink-faint);
  font-weight: 500;
}

.day-badge{
  position: absolute;
  top: 6px;
  right: 6px;
  width: 14px;
  height: 14px;
  color: var(--brand);
}

.day-badge i{ width: 100%; height: 100%; }

.day-cell.is-today{
  background: var(--brand);
}

.day-cell.is-today .hijri-num,
.day-cell.is-today .greg-date{
  color: #fff;
}

.day-cell.is-today.friday{
  background: var(--brand-darker);
}

.today-tag{
  position: absolute;
  bottom: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
}

/* ---------- Legend ---------- */
.legend{
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.legend-item{
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.dot{
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.dot-today{ background: var(--brand); }
.dot-friday{ background: var(--friday-tint); border: 1.5px solid var(--friday-text); }

/* ---------- Footer ---------- */
.page-footer{
  display: flex;
  justify-content: center;
}

.fb-link{
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--brand-dark);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.fb-link:hover{
  background: var(--brand-tint);
  border-color: var(--brand-tint-2);
}

.fb-link i{ width: 16px; height: 16px; flex-shrink: 0; }
.fb-link .ext-icon{ width: 12px; height: 12px; opacity: 0.6; }

/* ---------- Overlay & Dialog ---------- */
.overlay{
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 40, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.overlay.show{
  opacity: 1;
  pointer-events: auto;
}

.dialog{
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%);
  width: min(420px, calc(100vw - 32px));
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px -20px rgba(2, 40, 70, 0.35);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dialog.show{
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.dialog-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h3{
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.close-btn{
  padding: 7px;
  border-radius: 50%;
}

.close-btn i{ width: 18px; height: 18px; }

.dialog-body{
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog-hint{
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.field select,
.field input{
  font-family: var(--font-en);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  color: var(--ink);
  background: #fbfdff;
}

.field select:focus,
.field input:focus{
  outline: none;
  border-color: var(--brand);
}

.dialog-actions{
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.btn-primary, .btn-secondary{
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  padding: 11px 16px;
  font-family: var(--font-en);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary{
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover{ background: var(--brand-dark); }

.btn-secondary{
  background: #fff;
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
}

.btn-secondary:hover{ background: #f4f8fb; }

.btn-primary i, .btn-secondary i{ width: 15px; height: 15px; }

/* ---------- Responsive ---------- */
@media (max-width: 480px){
  .app{ padding: 16px 10px 32px; }
  .brand-text h1{ font-size: 0.95rem; }
  .brand-sub{ font-size: 0.7rem; }
  .icon-btn span{ display: none; }
  .icon-btn{ padding: 10px; }
  .month-title h2{ font-size: 1.08rem; }
  .day-cell{ min-height: 62px; padding: 8px 3px 10px; }
  .hijri-num{ font-size: 1rem; }
  .greg-date{ font-size: 0.62rem; }
  .weekday-row div{ font-size: 0.62rem; padding: 9px 2px; }
  .dialog-actions{ flex-direction: column; }
  .fb-link span{ font-size: 0.76rem; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; }
}
