/* ================================================================
   Delivery Date Modal Component
   ================================================================ */

/* Ensure all modal elements use border-box sizing */
.delivery-date-modal,
.delivery-date-modal * {
  box-sizing: border-box;
}

/* Modal Overlay & Container */
.delivery-date-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.delivery-date-modal.is-active {
  display: flex;
}

.delivery-date-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.delivery-date-modal__content {
  position: relative;
  background-color: var(--pearl-white);
  border-radius: 16px;
  width: 100%;
  max-width: 1140px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

/* Header */
.delivery-date-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 40px 24px;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
}

.delivery-date-modal__title {
  font-family: 'Noto Serif TC', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--velvet-black);
  margin: 0;
}

.delivery-date-modal__close {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--velvet-black);
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delivery-date-modal__close:hover {
  opacity: 0.6;
}

/* Body - Two Column Layout */
.delivery-date-modal__body {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 48px;
  padding: 32px 40px;
  overflow-x: hidden;
}

/* Calendar Section */
.delivery-date-modal__calendar-section {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-width: 0;
}

.delivery-date-modal__section-title {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--velvet-black);
  margin: 0 0 24px 0;
}

.delivery-date-modal__calendar {
  flex: 1;
}

/* Calendar Component */
.calendar {
  width: 100%;
  box-sizing: border-box;
}

.calendar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.calendar__nav {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--velvet-black);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.calendar__nav:hover {
  opacity: 0.6;
}

.calendar__month-year {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--velvet-black);
}

.calendar__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.calendar__weekday {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: rgba(10, 10, 10, 0.5);
  text-align: center;
  padding: 8px 0;
}

.calendar__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar__day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: var(--velvet-black);
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.calendar__day:hover:not(.calendar__day--disabled):not(.calendar__day--selected) {
  background-color: rgba(75, 0, 130, 0.08);
}

.calendar__day--disabled {
  color: rgba(10, 10, 10, 0.2);
  cursor: not-allowed;
}

.calendar__day--selected {
  background-color: var(--imperial-purple);
  color: var(--pearl-white);
  font-weight: 600;
}

.calendar__day--empty {
  visibility: hidden;
  pointer-events: none;
}

/* Info Section */
.delivery-date-modal__info-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
  box-sizing: border-box;
  min-width: 0;
}

/* Location Selector */
.delivery-date-modal__location {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.delivery-date-modal__location-selector {
  width: 100%;
  padding: 16px 20px;
  background-color: var(--pearl-white);
  border: 1px solid rgba(10, 10, 10, 0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.2s ease;
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: var(--velvet-black);
  text-align: left;
}

.delivery-date-modal__location-selector:hover {
  border-color: rgba(10, 10, 10, 0.24);
}

.delivery-date-modal__location-icon {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.delivery-date-modal__location-selector.is-expanded .delivery-date-modal__location-icon {
  transform: rotate(180deg);
}

.delivery-date-modal__location-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.delivery-date-modal__location-dropdown.is-open {
  max-height: 400px;
}

.delivery-date-modal__location-dropdown-content {
  padding: 20px;
  background-color: rgba(10, 10, 10, 0.02);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.delivery-date-modal__form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.delivery-date-modal__label {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--velvet-black);
}

/* Custom Select Dropdown */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--pearl-white);
  border: 1px solid rgba(10, 10, 10, 0.12);
  border-radius: 8px;
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: var(--velvet-black);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.custom-select__trigger:hover:not(:disabled) {
  border-color: rgba(10, 10, 10, 0.24);
}

.custom-select__trigger:disabled {
  background-color: rgba(10, 10, 10, 0.04);
  cursor: not-allowed;
  opacity: 0.6;
}

.custom-select.is-open .custom-select__trigger {
  border-color: var(--imperial-purple);
}

.custom-select__value {
  flex: 1;
  color: var(--velvet-black);
}

.custom-select__arrow {
  width: 20px;
  height: 20px;
  color: var(--velvet-black);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.custom-select.is-open .custom-select__arrow {
  transform: rotate(180deg);
}

.custom-select__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--pearl-white);
  border: 1px solid rgba(10, 10, 10, 0.12);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(10, 10, 10, 0.1);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  max-height: 280px;
  overflow: hidden;
}

.custom-select.is-open .custom-select__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select__options {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.custom-select__options::-webkit-scrollbar {
  width: 6px;
}

.custom-select__options::-webkit-scrollbar-track {
  background: rgba(10, 10, 10, 0.04);
  border-radius: 3px;
}

.custom-select__options::-webkit-scrollbar-thumb {
  background: rgba(10, 10, 10, 0.2);
  border-radius: 3px;
}

.custom-select__options::-webkit-scrollbar-thumb:hover {
  background: rgba(10, 10, 10, 0.3);
}

.custom-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: var(--velvet-black);
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.custom-select__option:hover {
  background-color: rgba(75, 0, 130, 0.08);
}

.custom-select__option.is-selected {
  background-color: rgba(75, 0, 130, 0.12);
  font-weight: 400;
}

.custom-select__option-text {
  flex: 1;
}

/* Express Badge (similar to bestseller badge) */
.custom-select__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background-color: var(--champagne-gold);
  color: var(--velvet-black);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-left: 8px;
  flex-shrink: 0;
}

.custom-select__badge-icon {
  width: 12px;
  height: 12px;
}

.custom-select--disabled {
  pointer-events: none;
}

/* Location Confirm Button */
.delivery-date-modal__location-confirm {
  width: 100%;
  padding: 12px 24px;
  background-color: var(--imperial-purple);
  border: none;
  border-radius: 8px;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--pearl-white);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.delivery-date-modal__location-confirm:hover {
  background-color: var(--deep-plum);
}

.delivery-date-modal__location-confirm:disabled {
  background-color: rgba(75, 0, 130, 0.3);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Today Display */
.delivery-date-modal__today {
  padding: 16px 20px;
  background-color: rgba(10, 10, 10, 0.02);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.delivery-date-modal__today-label {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--velvet-black);
}

.delivery-date-modal__today-date {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: var(--velvet-black);
}

/* Delivery Time */
.delivery-date-modal__time {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Express Delivery Card */
.delivery-date-modal__express {
  margin-bottom: 8px;
}

.delivery-date-modal__express-card {
  display: flex;
  padding: 20px 20px 20px 56px;
  background-color: var(--pearl-white);
  border: 1px solid var(--grey-200);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.delivery-date-modal__express-card:hover {
  border-color: var(--imperial-purple);
}

/* Express card selected state */
.delivery-date-modal__radio:checked + .delivery-date-modal__express-content {
  border-color: var(--imperial-purple);
}

.delivery-date-modal__express-card:has(input:checked) {
  border-color: var(--imperial-purple);
  background-color: rgba(75, 0, 130, 0.04);
}

.delivery-date-modal__radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.delivery-date-modal__express-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
  position: relative;
}

/* Checkmark for selected express delivery - inside the box */
.delivery-date-modal__express-card::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='11' fill='%234B0082' stroke='%234B0082' stroke-width='2'/%3E%3Cpath d='M8 12L11 15L16 9' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.delivery-date-modal__express-card:has(input:checked)::before {
  opacity: 1;
}

.delivery-date-modal__express-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.delivery-date-modal__express-title {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--velvet-black);
}

.delivery-date-modal__express-subtitle {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: rgba(10, 10, 10, 0.6);
}

.delivery-date-modal__express-price {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--velvet-black);
  flex-shrink: 0;
}

/* Custom Time Slots */
.delivery-date-modal__custom-time {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.delivery-date-modal__custom-time-label {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--velvet-black);
}

.delivery-date-modal__time-slots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  max-width: 480px;
  min-width: 0;
}

/* Scrollbar styles */
.delivery-date-modal__time-slots::-webkit-scrollbar {
  height: 6px;
}

.delivery-date-modal__time-slots::-webkit-scrollbar-track {
  background: rgba(10, 10, 10, 0.05);
  border-radius: 3px;
}

.delivery-date-modal__time-slots::-webkit-scrollbar-thumb {
  background: rgba(10, 10, 10, 0.2);
  border-radius: 3px;
}

.delivery-date-modal__time-slots::-webkit-scrollbar-thumb:hover {
  background: rgba(10, 10, 10, 0.3);
}

.delivery-date-modal__time-slot {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.delivery-date-modal__time-slot-content {
  padding: 16px 20px;
  background-color: var(--pearl-white);
  border: 1px solid var(--grey-200);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  text-align: center;
  min-width: 140px;
  white-space: nowrap;
  position: relative;
}

.delivery-date-modal__time-slot:hover .delivery-date-modal__time-slot-content {
  border-color: var(--imperial-purple);
}

.delivery-date-modal__radio:checked + .delivery-date-modal__time-slot-content {
  border-color: var(--imperial-purple);
  background-color: rgba(75, 0, 130, 0.04);
}

/* Checkmark for selected time slot */
.delivery-date-modal__time-slot-content::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='10' cy='10' r='9' fill='%234B0082' stroke='%234B0082' stroke-width='2'/%3E%3Cpath d='M6 10L9 13L14 7' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.delivery-date-modal__radio:checked + .delivery-date-modal__time-slot-content::before {
  opacity: 1;
}

.delivery-date-modal__time-slot-day {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--velvet-black);
}

.delivery-date-modal__time-slot-time {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--imperial-purple);
}

/* Footer */
.delivery-date-modal__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 40px 32px;
  border-top: 1px solid rgba(10, 10, 10, 0.08);
}

.delivery-date-modal__confirm {
  width: 100%;
  max-width: 400px;
  padding: 16px 32px;
  background-color: rgba(75, 0, 130, 0.12);
  border: none;
  border-radius: 8px;
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: rgba(10, 10, 10, 0.3);
  cursor: not-allowed;
  transition: all 0.2s ease;
}

.delivery-date-modal__confirm:not(:disabled) {
  background-color: var(--imperial-purple);
  color: var(--pearl-white);
  cursor: pointer;
}

.delivery-date-modal__confirm:not(:disabled):hover {
  background-color: var(--deep-plum);
}

.delivery-date-modal__skip {
  background: none;
  border: none;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 300;
  color: rgba(10, 10, 10, 0.6);
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.delivery-date-modal__skip:hover {
  color: var(--velvet-black);
}

/* ================================================================
   Responsive Design
   ================================================================ */

@media (max-width: 1024px) {
  .delivery-date-modal__body {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .delivery-date-modal {
    padding: 0;
    align-items: flex-end;
  }

  .delivery-date-modal__content {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    width: 100vw;
  }

  .delivery-date-modal__header {
    padding: 24px 20px 16px;
    box-sizing: border-box;
  }

  .delivery-date-modal__title {
    font-size: 22px;
  }

  .delivery-date-modal__body {
    padding: 24px 20px;
    gap: 24px;
    box-sizing: border-box;
  }

  .delivery-date-modal__footer {
    padding: 20px 20px 32px;
    box-sizing: border-box;
  }

  .delivery-date-modal__confirm {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .delivery-date-modal__time-slots {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .delivery-date-modal__content {
    width: 100vw;
  }

  .delivery-date-modal__body {
    padding: 16px 12px;
  }

  .delivery-date-modal__header {
    padding: 16px 12px 12px;
  }

  .calendar__weekdays,
  .calendar__days {
    gap: 2px;
  }

  .calendar__weekday {
    font-size: 11px;
    padding: 4px 0;
  }

  .calendar__day {
    font-size: 13px;
    padding: 4px;
  }

  .delivery-date-modal__time-slot-content {
    min-width: 100px;
    padding: 10px 12px;
  }

  .delivery-date-modal__express-card {
    padding: 14px 14px 14px 44px;
  }

  .delivery-date-modal__express-card::before {
    left: 14px;
    width: 18px;
    height: 18px;
  }

  .delivery-date-modal__footer {
    padding: 12px 12px 24px;
  }
}
