/*
 * 日付範囲ピッカー (共通部品)
 *
 * 開始日〜終了日をカレンダーで選ぶ共通 UI。task-manager のカレンダーの意匠を土台に汎用化。
 * 色は CSS 変数でライト/ダーク自動対応。クラス接頭辞 .drp-
 * 使い方: window.renderDateRangePicker({ anchorEl, startDate, endDate, maxDate, onConfirm })
 */

.drp-picker {
  position: fixed;
  z-index: 1005;
  background: var(--color-surface, #fafbfc);
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 8px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 12px;
  width: 280px;
  backdrop-filter: blur(8px);
}

.drp-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.drp-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text, #2c3e50);
  min-width: 100px;
  text-align: center;
}

.drp-nav {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary, #596275);
  font-size: 0.875rem;
  padding: 2px 8px;
  border-radius: 4px;
  transition: background 0.15s;
  line-height: 1;
}

.drp-nav:hover {
  background: var(--color-target, #e8f0ff);
}

.drp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.6875rem;
  color: var(--color-text-secondary, #596275);
  margin-bottom: 4px;
  font-weight: 500;
}

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

.drp-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border-radius: 50%;
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s;
  color: var(--color-text, #2c3e50);
  border: none;
  background: none;
  padding: 0;
}

.drp-day:hover {
  background: var(--color-target, #e8f0ff);
}

.drp-day--other-month {
  color: var(--color-text-tertiary, #b0b8c4);
}

.drp-day--today {
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--color-accent-base, #a4b2dd);
}

.drp-day--in-range {
  background: rgba(164, 178, 221, 0.2);
}

.drp-day--preview-range {
  background: rgba(164, 178, 221, 0.1);
}

/* selected は in-range より後に置いて優先させる */
.drp-day--selected {
  background: var(--color-accent-base, #a4b2dd);
  color: #fff;
  font-weight: 600;
}

.drp-day--selected:hover {
  background: var(--color-accent-hover, #8091d4);
}

.drp-day--disabled {
  color: var(--color-text-tertiary, #b0b8c4);
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.drp-separator {
  border-top: 1px solid var(--color-border, #d1d5db);
  margin: 8px 0;
}

.drp-selection {
  font-size: 0.75rem;
  color: var(--color-text-secondary, #596275);
  text-align: center;
  margin-bottom: 8px;
  min-height: 1.2em;
}

.drp-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.drp-btn {
  font-size: 0.75rem;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background 0.15s,
    opacity 0.15s;
}

.drp-btn-cancel {
  background: none;
  border-color: var(--color-border, #d1d5db);
  color: var(--color-text-secondary, #596275);
}

.drp-btn-cancel:hover {
  background: var(--color-target, #e8f0ff);
}

.drp-btn-confirm {
  background: var(--color-accent-base, #a4b2dd);
  color: #fff;
}

.drp-btn-confirm:hover {
  background: var(--color-accent-hover, #8091d4);
}

.drp-btn-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
