/* ========== モーダルオーバーレイ ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--space-base);
  animation: overlayFadeIn var(--transition-base) ease;
}

.modal-overlay.open {
  display: flex;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ========== モーダルコンテナ ========== */
.modal-container {
  background-color: var(--color-card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn var(--transition-base) ease;
  overflow: hidden;
}

.modal-container--large {
  max-width: 680px;
}

.modal-container--fullheight {
  max-width: 680px;
  height: 85vh;
}

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

/* ========== モーダルヘッダー ========== */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-header--warning {
  background-color: rgba(229,57,53,0.06);
}

.modal-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  line-height: 1;
}

.modal-close-btn:hover {
  background-color: var(--color-border);
  color: var(--color-text-primary);
}

/* ========== モーダル本文 ========== */
.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

/* ========== モーダルフッター ========== */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-footer--sticky {
  border-top: 1px solid var(--color-border);
  background-color: var(--color-card-bg);
  padding: var(--space-md) var(--space-lg);
  flex-shrink: 0;
}

/* ========== 進捗ログ ========== */
.progress-logs-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-height: 200px;
  overflow-y: auto;
  padding: var(--space-sm);
  background-color: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.progress-log-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  padding: 4px 0;
  border-bottom: 1px solid rgba(0,0,0,0.03);
}

.progress-log-item:last-child {
  border-bottom: none;
}

.progress-log-content {
  flex: 1;
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

.progress-log-date {
  color: var(--color-text-muted);
  white-space: nowrap;
  font-size: var(--font-size-xs);
  padding-top: 2px;
}

.progress-log-text {
  flex: 1;
  word-break: break-word;
}

.btn-copy-single-log {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  opacity: 0.3;
  transition: all var(--transition-fast);
  font-size: 14px;
}

.btn-copy-single-log:hover {
  opacity: 1;
  background-color: rgba(0,0,0,0.05);
}

/* ========== 箇条書き個別設定モード ========== */
.bulk-step-actions {
  margin-top: var(--space-sm);
  display: flex;
  justify-content: flex-end;
}

.bulk-step2-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.bulk-step2-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.bulk-individual-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-height: 420px;
  overflow-y: auto;
}

.bulk-row {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.bulk-row-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  word-break: break-word;
}

.bulk-row-fields {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.bulk-row-fields .form-select {
  flex: 1;
  min-width: 100px;
  font-size: var(--font-size-xs);
  padding: 4px 8px;
  height: 30px;
}

/* 今日優先度選択ボタン */
.btn-today-prio, .btn-recurring-today-prio {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-today-prio:hover, .btn-recurring-today-prio:hover {
  background-color: rgba(0,0,0,0.05);
  transform: scale(1.1);
}

/* ========== モバイルレスポンシブ（767px以下） ========== */
@media (max-width: 767px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-container {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    animation: modalSlideUp var(--transition-base) ease;
  }

  .modal-container--large,
  .modal-container--fullheight {
    max-width: 100%;
    height: 92vh;
  }

  @keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}
