/* ==========================================================================
   SMART DATE RANGE PICKER (Mô phỏng 100% mẫu giao diện yêu cầu)
   ========================================================================== */

/* Fullscreen Overlay / Backdrop */
.sdrp-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  display: none;
  background: transparent;
  box-sizing: border-box;
  user-select: none;
}

.sdrp-modal-overlay.sdrp-open,
html.has-mob-drawer body > .sdrp-modal-overlay.sdrp-open,
body.has-mob-drawer > .sdrp-modal-overlay.sdrp-open,
html.preload-mob-drawer body > .sdrp-modal-overlay.sdrp-open,
body.preload-mob-drawer > .sdrp-modal-overlay.sdrp-open {
  display: block !important;
  z-index: 9999999 !important;
}

/* Floating Popover Container */
.sdrp-popup {
  position: absolute;
  z-index: 1000000;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.2), 0 4px 10px rgba(15, 23, 42, 0.08);
  font-family: inherit;
  color: #1e293b;
  width: max-content;
  max-width: 95vw;
  box-sizing: border-box;
  user-select: none;
  pointer-events: auto;
  animation: sdrpFadeIn 0.18s ease-out;
}

@keyframes sdrpFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Top Range Display Bar */
.sdrp-header {
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
}

.sdrp-header-date {
  letter-spacing: 0.3px;
}

.sdrp-header-sep {
  color: #94a3b8;
  font-weight: 500;
}

/* Main Body: Presets Left + Calendars Right */
.sdrp-body {
  display: flex;
  flex-direction: row;
}

/* Left Presets Sidebar */
.sdrp-presets {
  width: 150px;
  flex-shrink: 0;
  padding: 14px 10px;
  border-right: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #ffffff;
  border-bottom-left-radius: 12px;
}

.sdrp-preset-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.35;
}

.sdrp-preset-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.sdrp-preset-btn.active {
  background: #fee2e2;
  color: #dc2626;
  font-weight: 700;
}

/* Calendars Container (Dual Month) */
.sdrp-calendars {
  display: flex;
  flex-direction: row;
  padding: 12px 14px;
  gap: 16px;
}

.sdrp-month-view {
  width: 252px;
}

/* Month Navigation Header */
.sdrp-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  height: 32px;
}

.sdrp-month-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  flex: 1;
  text-align: center;
}

.sdrp-nav-arrows {
  display: flex;
  align-items: center;
  gap: 2px;
}

.sdrp-nav-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.sdrp-nav-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Weekday header */
.sdrp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 6px;
}

.sdrp-weekday {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Days Grid */
.sdrp-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 3px;
}

.sdrp-day-cell {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  cursor: pointer;
  position: relative;
  transition: background-color 0.12s;
  border-radius: 0;
}

.sdrp-day-cell:hover:not(.empty):not(.disabled) {
  background: #f1f5f9;
  border-radius: 6px;
}

.sdrp-day-cell.other-month {
  color: #cbd5e1;
}

.sdrp-day-cell.today-outline::after {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  pointer-events: none;
}

/* Range Selected States */
.sdrp-day-cell.in-range {
  background: #fff5f2 !important;
  color: #ea580c !important;
  border-radius: 0 !important;
}

.sdrp-day-cell.range-start {
  background: #ef4444 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-top-left-radius: 6px !important;
  border-bottom-left-radius: 6px !important;
}

.sdrp-day-cell.range-end {
  background: #ef4444 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-top-right-radius: 6px !important;
  border-bottom-right-radius: 6px !important;
}

.sdrp-day-cell.range-start.range-end {
  border-radius: 6px !important;
}

/* Bottom Action Footer */
.sdrp-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.sdrp-btn-clear {
  height: 32px;
  padding: 0 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}

.sdrp-btn-clear:hover {
  background: #f1f5f9;
  color: #334155;
}

.sdrp-btn-apply {
  height: 32px;
  padding: 0 18px;
  background: #ef4444;
  border: 1px solid #ef4444;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s;
}

.sdrp-btn-apply:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* Mobile Modal Mode */
@media (max-width: 768px) {
  .sdrp-modal-overlay.sdrp-open,
  html.has-mob-drawer body > .sdrp-modal-overlay.sdrp-open,
  body.has-mob-drawer > .sdrp-modal-overlay.sdrp-open,
  html.preload-mob-drawer body > .sdrp-modal-overlay.sdrp-open,
  body.preload-mob-drawer > .sdrp-modal-overlay.sdrp-open {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(15, 23, 42, 0.5) !important;
    backdrop-filter: blur(2px) !important;
    padding: 12px !important;
    z-index: 9999999 !important;
  }
  .sdrp-popup {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 360px !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
    margin: auto !important;
    border-radius: 16px !important;
  }
  .sdrp-body {
    flex-direction: column !important;
  }
  .sdrp-presets {
    width: 100% !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    border-right: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    white-space: nowrap !important;
  }
  .sdrp-preset-btn {
    width: auto !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 20px !important;
    background: #f8fafc !important;
    flex-shrink: 0 !important;
  }
  .sdrp-preset-btn.active {
    background: #fee2e2 !important;
    border-color: #ef4444 !important;
    color: #dc2626 !important;
  }
  .sdrp-calendars {
    flex-direction: column !important;
    padding: 10px 12px !important;
    gap: 12px !important;
  }
  .sdrp-month-view {
    width: 100% !important;
  }
  .sdrp-month-view:last-child {
    display: none;
  }
  .sdrp-day-cell {
    height: 36px !important;
    font-size: 13.5px !important;
  }
}
