/* ─── 3qare Dual Date Picker — Navy & Gold Brand ─── */
:root {
  --qari-dp-navy: #1a2530;
  --qari-dp-navy-deep: #0f172a;
  --qari-dp-navy-mid: #243447;
  --qari-dp-gold: #c5a059;
  --qari-dp-gold-soft: #d4b87a;
  --qari-dp-gold-bg: #faf7f0;
  --qari-dp-border: rgba(197, 160, 89, 0.42);
  --qari-dp-shadow: 0 14px 36px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(197, 160, 89, 0.14);
}

.qari-date-field {
  position: relative;
  width: 100%;
}

.qari-date-input-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}

.qari-date-display {
  flex: 1;
  cursor: pointer;
  text-align: right;
  direction: ltr;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.qari-date-iso {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.qari-date-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--qari-dp-border);
  background: linear-gradient(180deg, var(--qari-dp-gold-bg) 0%, #f0e6d2 100%);
  color: var(--qari-dp-navy-deep);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.qari-date-open-btn:hover {
  border-color: var(--qari-dp-gold);
  background: var(--qari-dp-gold);
  color: var(--qari-dp-navy-deep);
  transform: translateY(-1px);
}

.qari-date-open-btn .qari-icon {
  pointer-events: none;
}

/* ─── Popover (anchored to field, not full-screen) ─── */
.qari-date-popover {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 10050;
  min-width: 18rem;
  max-width: 22.5rem;
  background: #fff;
  border: 1px solid var(--qari-dp-border);
  border-radius: 0.9rem;
  box-shadow: var(--qari-dp-shadow);
  overflow: hidden;
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

.qari-date-popover.qari-date-popover-floating {
  position: fixed;
  z-index: 10050;
}

/* ─── Hijri / Gregorian tabs ─── */
.qari-date-mode-toggle {
  display: flex;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  background: linear-gradient(180deg, var(--qari-dp-navy) 0%, var(--qari-dp-navy-deep) 100%);
  border-bottom: 2px solid var(--qari-dp-gold);
}

.qari-date-mode-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 0.55rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.qari-date-mode-btn:hover {
  color: #fff;
  background: rgba(197, 160, 89, 0.18);
  border-color: rgba(197, 160, 89, 0.35);
}

.qari-date-mode-btn.active {
  color: var(--qari-dp-navy-deep);
  background: linear-gradient(180deg, var(--qari-dp-gold-soft) 0%, var(--qari-dp-gold) 100%);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.qari-date-picker-host {
  padding: 0.35rem 0.4rem 0.5rem;
  background: #fff;
}

/* ─── ZulNs Datepicker overrides (kill W3 orange/teal theme) ─── */
.qari-date-picker-host .zulns-datepicker,
.qari-date-picker-host .qari-zulns-datepicker {
  border: none !important;
  box-shadow: none !important;
  margin: 0 auto;
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif !important;
  background: #fff !important;
}

.qari-date-picker-host .zulns-datepicker.w3-card-4 {
  box-shadow: none !important;
}

/* Header — theme class becomes w3-{theme} after init (not w3-theme) */
.qari-date-picker-host .w3-display-container,
.qari-date-picker-host .w3-theme,
.qari-date-picker-host .w3-display-container[class*="w3-"] {
  background: linear-gradient(180deg, var(--qari-dp-navy) 0%, var(--qari-dp-navy-mid) 100%) !important;
  color: #fff !important;
}

.qari-date-picker-host .w3-display-middle,
.qari-date-picker-host .w3-display-bottommiddle {
  color: #fff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.qari-date-picker-host .w3-xlarge {
  font-size: 1.35rem !important;
}

.qari-date-picker-host .w3-large {
  font-size: 0.95rem !important;
  opacity: 0.92;
}

.qari-date-picker-host .w3-display-container .w3-button,
.qari-date-picker-host .w3-theme .w3-button {
  color: rgba(255, 255, 255, 0.92) !important;
}

.qari-date-picker-host .w3-display-container .w3-button:hover,
.qari-date-picker-host .w3-display-container .w3-button:focus,
.qari-date-picker-host .w3-theme .w3-button:hover,
.qari-date-picker-host .w3-theme .w3-button:focus {
  background-color: rgba(197, 160, 89, 0.28) !important;
  color: #fff !important;
}

/* Weekday row */
.qari-date-picker-host .w3-light-grey {
  background: var(--qari-dp-gold-bg) !important;
  color: var(--qari-dp-navy) !important;
  border-radius: 0.35rem;
  font-weight: 600;
}

.qari-date-picker-host .w3-light-grey .w3-text-teal,
.qari-date-picker-host .w3-light-grey .w3-text-red {
  color: var(--qari-dp-navy-mid) !important;
}

.qari-date-picker-host .w3-light-grey .w3-cell:nth-child(6) {
  color: var(--qari-dp-gold) !important;
  font-weight: 700;
}

/* Day cells */
.qari-date-picker-host .w3-white {
  background: #fff !important;
}

.qari-date-picker-host .date.w3-btn {
  border-radius: 0.45rem !important;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--qari-dp-navy) !important;
  transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
}

.qari-date-picker-host .date.w3-text-teal,
.qari-date-picker-host .date.w3-text-red {
  color: var(--qari-dp-navy-mid) !important;
}

/* Selected / today */
.qari-date-picker-host .date[class*="w3-deep-orange"],
.qari-date-picker-host .date[class*="w3-blue"],
.qari-date-picker-host .date[class*="w3-blue-grey"],
.qari-date-picker-host .date[class*="w3-teal"],
.qari-date-picker-host .date[class*="w3-orange"],
.qari-date-picker-host .date[class*="w3-amber"],
.qari-date-picker-host .w3-theme .w3-deep-orange,
.qari-date-picker-host .w3-theme [class*="w3-deep-orange"],
.qari-date-picker-host .w3-theme [class*="w3-blue-grey"],
.qari-date-picker-host .w3-theme [class*="w3-blue"] {
  background: linear-gradient(180deg, var(--qari-dp-gold-soft) 0%, var(--qari-dp-gold) 100%) !important;
  color: var(--qari-dp-navy-deep) !important;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(197, 160, 89, 0.35);
}

/* Hover states — replace W3 teal/red/grey hovers */
.qari-date-picker-host .date.w3-hover-teal:hover,
.qari-date-picker-host .date.w3-hover-red:hover,
.qari-date-picker-host .date.w3-hover-dark-grey:hover,
.qari-date-picker-host .date.w3-ripple:hover:not(:disabled) {
  background-color: rgba(197, 160, 89, 0.2) !important;
  color: var(--qari-dp-navy-deep) !important;
}

.qari-date-picker-host .date:disabled {
  opacity: 0.35 !important;
  color: #94a3b8 !important;
}

.qari-date-picker-host .w3-cell-row {
  margin-bottom: 0.15rem !important;
}

.qari-date-picker-host .w3-cell {
  padding: 0.35rem 0 !important;
}

@media (max-width: 640px) {
  .qari-date-popover {
    right: 0;
    left: auto;
    min-width: min(100vw - 1rem, 20rem);
  }

  .qari-date-picker-host .zulns-datepicker {
    width: 100% !important;
    max-width: none !important;
  }
}
