/**
 * Product Simulator - WordPress版スタイル
 * simulation_ajax.phpと完全に同じスタイル
 */

/* リセット - WordPressテーマのスタイルを上書き */
.product-simulator-container * {
    box-sizing: border-box;
}

.product-simulator-container h1,
.product-simulator-container h2,
.product-simulator-container h3,
.product-simulator-container h4,
.product-simulator-container h5,
.product-simulator-container h6 {
    font-family: inherit !important;
    line-height: 1.4 !important;
}

/* コンテナ */
.product-simulator-container {
    max-width: 1000px !important;
    margin: 0 auto !important;
    padding: 30px 20px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif !important;
    line-height: 1.6 !important;
    color: #333 !important;
}

/* 選択パネル */
.ps-selection-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* カテゴリー選択 */
.ps-category-selection {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 30px;
}

.ps-category-selection h2 {
    font-size: 1.5em !important;
    margin-bottom: 20px !important;
    color: #333 !important;
}

.ps-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.ps-category-card {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    text-align: center;
}

.ps-category-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-3px);
}

.ps-category-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.ps-category-name {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.ps-category-desc {
    font-size: 0.9em;
    color: #6c757d;
}

/* セクション */
.ps-section {
    padding: 30px 25px !important;
    border-bottom: 1px solid #e9ecef !important;
}

.ps-section:last-child {
    border-bottom: none !important;
}

.ps-section-header {
    margin-bottom: 20px !important;
}

.ps-section-number {
    display: inline-block !important;
    background: #667eea !important;
    color: white !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    text-align: center !important;
    line-height: 28px !important;
    font-weight: bold !important;
    font-size: 0.9em !important;
    margin-right: 10px !important;
    vertical-align: middle !important;
}

.ps-section-number.completed {
    background: #28a745 !important;
}

.ps-completion-hint {
    margin-top: 24px !important;
    padding: 14px 18px !important;
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 8px !important;
    color: #495057 !important;
    font-size: 0.95em !important;
    line-height: 2 !important;
}

.ps-hint-icon {
    margin-right: 4px !important;
    margin-left: 4px !important;
    vertical-align: middle !important;
}

.ps-section-title-wrapper {
    display: inline-block !important;
    vertical-align: middle !important;
    max-width: calc(100% - 50px) !important;
}

.ps-section-title {
    font-size: 1.3em !important;
    font-weight: 600 !important;
    color: #333 !important;
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
}

.ps-section-required {
    color: #dc3545 !important;
    font-size: 0.9em !important;
    margin-left: 8px !important;
}

.ps-section-description {
    color: #6c757d !important;
    margin-top: 10px !important;
    font-size: 0.95em !important;
    display: block !important;
    line-height: 1.5 !important;
}

/* オプションカード */
.ps-options-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 15px !important;
}

.ps-options-grid.ps-cols-1 {
    grid-template-columns: 1fr !important;
}

.ps-options-grid.ps-cols-2 {
    grid-template-columns: repeat(2, 1fr) !important;
}

.ps-options-grid.ps-cols-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

.ps-options-grid.ps-cols-4 {
    grid-template-columns: repeat(4, 1fr) !important;
}

.ps-options-grid.ps-with-images {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
}

.ps-options-grid.ps-with-images.ps-cols-1 {
    grid-template-columns: 1fr !important;
    max-width: 600px !important;
}

.ps-options-grid.ps-with-images.ps-cols-2 {
    grid-template-columns: repeat(2, 1fr) !important;
}

.ps-options-grid.ps-with-images.ps-cols-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

.ps-options-grid.ps-with-images.ps-cols-4 {
    grid-template-columns: repeat(4, 1fr) !important;
}

.ps-option-card {
    border: 2px solid #e9ecef !important;
    border-radius: 10px !important;
    padding: 20px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    background: #fff !important;
    position: relative !important;
}

.ps-option-card:hover {
    border-color: #667eea !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15) !important;
    transform: translateY(-2px) !important;
}

.ps-option-card.ps-option-selected {
    border-color: #667eea !important;
    background: #f0f3ff !important;
}

.ps-option-card.ps-option-selected::after {
    content: '✓' !important;
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    background: #667eea !important;
    color: white !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.9em !important;
}

.ps-option-image {
    width: 100% !important;
    max-height: 150px !important;
    object-fit: contain !important;  /* cover → contain に変更 */
    border-radius: 8px !important;
    margin-bottom: 15px !important;
}

.ps-option-name {
    font-size: 1.05em !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin-bottom: 6px !important;
}

.ps-option-description {
    font-size: 0.85em !important;
    color: #6c757d !important;
}

.ps-option-price {
    font-size: 1em !important;
    font-weight: 600 !important;
    color: #667eea !important;
    margin-top: 8px !important;
}

/* Information セクション */
.ps-information-section {
    background: #fff9e6 !important;
    border: 2px solid #ffc107 !important;
    border-radius: 10px !important;
    padding: 25px !important;
    line-height: 1.8 !important;
    color: #333 !important;
}

.ps-information-section a {
    color: #667eea !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

.ps-information-section a:hover {
    text-decoration: underline !important;
}

.ps-information-section strong {
    color: #856404 !important;
    font-size: 1.05em !important;
}

/* 入力フォーム */
.ps-text-input,
.ps-textarea,
.ps-select {
    width: 100% !important;
    padding: 12px 15px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 8px !important;
    font-size: 1em !important;
    transition: border-color 0.2s ease !important;
}

.ps-text-input:focus,
.ps-textarea:focus,
.ps-select:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* 確定ボタン */
.ps-btn-confirm {
    background: #28a745 !important;
    color: white !important;
    border: none !important;
    padding: 12px 32px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    font-size: 1em !important;
    transition: all 0.3s ease !important;
}

.ps-btn-confirm:hover {
    background: #218838 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3) !important;
    color: white !important;
}

/* カート追加セクション */
.ps-add-to-cart-section {
    background: #f8f9fa !important;
    padding: 30px 25px !important;
    border-radius: 10px !important;
    margin-top: 20px !important;
}

.ps-add-to-cart-section h3 {
    font-size: 1.3em !important;
    margin-bottom: 20px !important;
    color: #333 !important;
}

/* サマリーボックス */
.ps-summary-box {
    background: white !important;
    padding: 20px !important;
    border-radius: 8px !important;
    border: 2px solid #667eea !important;
    margin-bottom: 20px !important;
}

.ps-summary-box h4 {
    font-size: 1.2em !important;
    margin: 0 0 15px 0 !important;
    color: #212529 !important;
    font-weight: 600 !important;
}

.ps-summary-row {
    display: flex !important;
    justify-content: space-between !important;
    margin-bottom: 8px !important;
    color: #495057 !important;
    font-size: 0.95em !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid #e9ecef !important;
}

.ps-summary-row:last-child {
    border-bottom: none !important;
}

.ps-summary-row strong {
    color: #333 !important;
    font-weight: 600 !important;
}

.ps-summary-row span {
    text-align: right !important;
    flex: 1 !important;
    margin-left: 20px !important;
}

/* カート追加ボタン */
.ps-btn-add-cart {
    background: #667eea !important;
    color: white !important;
    padding: 14px 28px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 1.1em !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
}

.ps-btn-add-cart:hover {
    background: #5568d3 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

/* エラー表示 */
.ps-error {
    background: #fee !important;
    color: #c33 !important;
    padding: 20px !important;
    border-radius: 8px !important;
    border: 1px solid #fcc !important;
    margin: 20px 0 !important;
}

.ps-loading {
    text-align: center !important;
    padding: 40px !important;
    font-size: 18px !important;
    color: #666 !important;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .product-simulator-container {
        padding: 20px 15px !important;
    }
    
    .ps-category-grid {
        grid-template-columns: 1fr !important;
    }
    
    .ps-section {
        padding: 20px 15px !important;
    }
    
    /* スマホでは全て1列表示 */
    .ps-options-grid,
    .ps-options-grid.ps-cols-1,
    .ps-options-grid.ps-cols-2,
    .ps-options-grid.ps-cols-3,
    .ps-options-grid.ps-cols-4,
    .ps-options-grid.ps-with-images,
    .ps-options-grid.ps-with-images.ps-cols-1,
    .ps-options-grid.ps-with-images.ps-cols-2,
    .ps-options-grid.ps-with-images.ps-cols-3,
    .ps-options-grid.ps-with-images.ps-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    .ps-section-title-wrapper {
        max-width: 100% !important;
    }
    
    .ps-summary-row {
        flex-direction: column !important;
        gap: 4px !important;
    }
    
    .ps-summary-row span {
        text-align: left !important;
        margin-left: 0 !important;
    }
}

/* ── Terminal Message (information と同デザイン) ──────────────── */
.ps-terminal-contact-btn {
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 28px;
    font-size: .95em;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.ps-terminal-contact-btn:hover {
    background: #5568d5;
}

/* ── Out of Stock オーバーレイ ─────────────────────────────────── */
.ps-option-oos {
    pointer-events: none;
}
.ps-oos-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .58);
    color: #fff;
    font-size: .82em;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
}
.ps-oos-badge {
    display: inline-block;
    background: #6c757d;
    color: #fff;
    font-size: .75em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
}

/* ── 欠品タイトル下注記 ── */
.ps-oos-title-note {
    font-size: .82em;
    color: #888;
    margin: 4px 0 6px;
    padding: 4px 10px;
    background: #fafafa;
    border-left: 3px solid #ffc107;
    border-radius: 3px;
}
.ps-oos-badge-inline {
    display: inline-block;
    background: #ffc107;
    color: #333;
    font-size: .8em;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
}

/* ── 選択なしで次へ ── */
/* グリッド外・セクション全幅で中央揃えにするためのラッパー */
.ps-skip-wrap {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    width: 100%;
}
.ps-btn-skip {
    background: none;
    border: 1px solid #ccc;
    color: #888;
    font-size: .82em;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: .15s;
}
.ps-btn-skip:hover { background: #f5f5f5; color: #555; border-color: #aaa; }
.ps-btn-skip.ps-btn-skip-active { background: #e8f5e9; border-color: #81c784; color: #388e3c; }

/* ── カート制限メッセージ ── */
.ps-cart-limit-msg {
    background: #fff3e0;
    border: 1px solid #ffb74d;
    color: #e65100;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: .9em;
    margin-bottom: 8px;
}

/* ── check_consent ── */
.ps-check-consent-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}
.ps-check-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    transition: border-color .15s, background .15s;
    user-select: none;
    line-height: 1.5;
}
.ps-check-consent-label:hover {
    border-color: #80bdff;
    background: #f0f7ff;
}
.ps-check-consent-label.ps-check-consent-checked {
    border-color: #28a745;
    background: #f0fff4;
}
.ps-check-consent-input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #28a745;
    cursor: pointer;
    flex-shrink: 0;
}
.ps-check-consent-text {
    color: #343a40;
    font-size: .95em;
}
.ps-check-consent-checked .ps-check-consent-text {
    color: #155724;
}

/* check_consent タイプチップ */
.ps-type-check { background: #e8f5e9; color: #2e7d32; border: 1px solid #86efac; }

/* ── check_consent ⇒ご了承済 ── */
.ps-consent-agreed {
    color: #dc3545;
    font-weight: 700;
}
