/**
 * 配送・受取方法選択システム - フロントエンドCSS v2.0.0
 *
 * ブロック型チェックアウト（WooCommerce Blocks）対応版
 * WooCommerce / テーマ のスタイルへの干渉を排除
 * DPS 固有要素のみスタイル定義
 */

/* =============================================================
   1. Gutenberg ボタンの選択状態（既存ボタン自動検出）
   ============================================================= */

/* 未選択（初期状態）- そのまま表示 */
[data-dps-method].dps-unselected,
[data-method].dps-unselected { opacity: 1; }

/* 非選択（もう一方が選ばれている）- グレーアウト */
[data-dps-method].dps-inactive,
[data-method].dps-inactive,
.wp-block-button__link.dps-inactive {
    opacity: 0.4 !important;
    filter: grayscale(70%) !important;
    transition: opacity 0.3s, filter 0.3s;
}

/* 選択中 - 枠線でハイライト（和風アクセント） */
[data-dps-method].dps-active,
[data-method].dps-active,
.wp-block-button__link.dps-active {
    opacity: 1 !important;
    filter: none !important;
    outline: 3px solid #7c4a2d !important;
    outline-offset: 3px !important;
    position: relative;
}

/* 選択中バッジ */
[data-dps-method].dps-active::after,
[data-method].dps-active::after,
.wp-block-button__link.dps-active::after {
    content: '✓ 選択中';
    position: absolute;
    top: -14px;
    right: -6px;
    background: #7c4a2d;
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(42, 22, 16, 0.2);
    z-index: 10;
}

/* =============================================================
   2. カートページ：受取方法選択ボタン
   ============================================================= */

.dps-delivery-method-selector {
    background: #fff;
    border: 1px solid #e8e0d5;
    border-radius: 10px;
    padding: 20px 24px;
    margin: 0 0 24px;
}

.dps-delivery-method-selector h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 14px;
    color: #2a1610;
}

.dps-method-buttons {
    display: flex;
    gap: 12px;
}

.dps-method-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    border: 2px solid #e8e0d5;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #5c4a3a;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.dps-method-button:hover {
    border-color: #7c4a2d;
    background: #f5efe6;
}

.dps-method-button.active {
    border-color: #7c4a2d;
    background: #f5efe6;
    color: #5c3820;
}

.dps-method-icon { font-size: 20px; }

.dps-method-notice {
    display: none;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
}
.dps-method-notice.success { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }
.dps-method-notice.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }

@media (max-width: 600px) {
    .dps-method-buttons { flex-direction: column; }
}

/* =============================================================
   3. チェックアウト：お渡し方法バー
   ============================================================= */

.dps-delivery-method-info {
    background: #f5efe6;
    border: 1px solid #e8e0d5;
    border-radius: 8px;
    padding: 12px 18px;
    margin: 0 0 20px;
    font-size: 14px;
}

.dps-checkout-method {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dps-checkout-icon { font-size: 18px; }

.dps-change-method-link {
    margin-left: auto;
    font-size: 13px;
    color: #7c4a2d;
    text-decoration: underline;
}

/* =============================================================
   4. 確認モーダル（中央ポップアップ・和風で落ち着き・高級感）
   ============================================================= */

#dps-change-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
#dps-change-modal.dps-modal-open {
    display: flex !important;
}

#dps-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(42, 22, 16, 0.45);
    backdrop-filter: blur(4px);
}

/* モーダル本体：和紙風・中央に大きく視認しやすく */
.dps-modal-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: linear-gradient(180deg, #fdfbf7 0%, #f8f4ed 100%);
    border: 1px solid #d4c4a8;
    border-radius: 12px;
    box-shadow:
        0 4px 0 0 rgba(124, 74, 45, 0.08),
        0 24px 48px rgba(42, 22, 16, 0.18);
    padding: 28px 32px 24px;
    font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

.dps-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8e0d5;
}
.dps-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2a1610;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

#dps-modal-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: -8px -8px 0 0;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #8b7355;
    transition: color 0.2s;
    border-radius: 6px;
}
#dps-modal-close:hover {
    color: #5c3820;
    background: rgba(124, 74, 45, 0.08);
}

.dps-modal-body {
    margin-bottom: 24px;
}
.dps-confirm-message {
    font-size: 16px;
    color: #4a3c2e;
    line-height: 1.65;
    margin: 0;
}

.dps-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.dps-modal-footer button {
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    min-width: 120px;
}
#dps-btn-cancel {
    background: #fff;
    color: #5c4a3a;
    border: 1px solid #d4c4a8;
}
#dps-btn-cancel:hover {
    background: #f5efe6;
    border-color: #b8a088;
}
#dps-btn-confirm {
    background: #5c3820;
    color: #fdfbf7;
    border: 1px solid #4a2e1a;
}
#dps-btn-confirm:hover {
    background: #4a2e1a;
    opacity: 1;
}
#dps-btn-confirm.dps-loading {
    opacity: 0.8;
    cursor: wait;
}

.dps-method-message {
    display: none;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}
.dps-method-message.success { background: #f0f5ee; color: #2d5a3d; border: 1px solid #c5e1b8; }
.dps-method-message.error   { background: #fdf2f2; color: #991b1b; border: 1px solid #f5c6c6; }

/* =============================================================
   5. 商品ページ：保存・包装状態バッジ / 制限バッジ
   ============================================================= */

.dps-temperature-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e8f0ea;
    color: #2d5a3d;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
}

.dps-restriction-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f5efe6;
    color: #8b3a3a;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
}

.dps-product-info {
    font-size: 13px;
    color: #5c4a3a;
    margin: 8px 0;
    padding: 10px 14px;
    background: #faf8f5;
    border-radius: 6px;
    border: 1px solid #e8e0d5;
}

/* =============================================================
   6. 注文履歴：配送・受取バッジ
   ============================================================= */

.dps-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
}

.dps-badge-pickup   { background: #f5efe6; color: #5c3820; }
.dps-badge-delivery { background: #e8f0ea; color: #2d5a3d; }

.dps-history-cell { font-size: 13px; line-height: 1.7; }
.dps-history-date,
.dps-history-time { font-size: 12px; color: #6b5b4a; }

/* =============================================================
   7. チェックアウト数量（注文概要）
   ============================================================= */

.dps-checkout-quantity input.dps-qty-input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #e8e0d5;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.dps-checkout-quantity-fixed {
    font-size: 14px;
    font-weight: 600;
}
