/* ============================================================
   Woo Product Exchange Pro+ — Frontend Styles (Mobile First)
   ============================================================ */

/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --wpep-primary:   #2b6cb0;
    --wpep-green:     #38a169;
    --wpep-red:       #e53e3e;
    --wpep-gray:      #a0aec0;
    --wpep-bg:        #f7fafc;
    --wpep-border:    #e2e8f0;
    --wpep-radius:    10px;
    --wpep-shadow:    0 2px 12px rgba(0,0,0,.07);
    --wpep-font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reasons & Upload ──────────────────────────────────────── */
.wpep-reasons-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.wpep-reason-option {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--wpep-bg);
    border: 1px solid var(--wpep-border);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #4a5568;
    transition: all .2s;
}
.wpep-reason-option:hover { border-color: var(--wpep-primary); }
.wpep-reason-option input { margin: 0; }

.wpep-text-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--wpep-border);
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: var(--wpep-font);
}

.wpep-upload-area {
    border: 2px dashed var(--wpep-border);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: background .2s;
}
.wpep-upload-area:hover { background: #edf2f7; }
.wpep-upload-placeholder p { margin: 8px 0 4px; font-weight: 600; color: #2d3748; }

.wpep-remove-btn {
    margin-top: 10px;
    background: var(--wpep-red);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

/* ── Countdown Bar ─────────────────────────────────────────── */
.wpep-countdown-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fffaf0;
    border: 1px solid #fbd38d;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.wpep-countdown-icon { font-size: 24px; }
.wpep-countdown-bar strong { color: #9c4221; font-size: 14px; display: block; }
.wpep-countdown-timer { font-size: 13px; color: #c05621; font-family: monospace; font-weight: 600; margin-top: 3px; }


/* ── Wallet Pay-the-Difference Card ────────────────────────── */
.wpep-wallet-pay-card {
    background: #fff;
    border: 2px solid var(--wpep-primary);
    border-radius: var(--wpep-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.wpep-wallet-pay-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.wpep-wallet-icon {
    font-size: 28px;
    line-height: 1;
}

.wpep-wallet-pay-header strong {
    display: block;
    font-size: 15px;
    color: #2d3748;
    margin-bottom: 4px;
}

.wpep-wallet-bal-line {
    margin: 0;
    font-size: 13px;
    color: #718096;
}

.wpep-wallet-bal-line strong {
    color: var(--wpep-green);
    display: inline;
    font-size: 13px;
}

/* ── Payment option radio cards ────────────────────────────── */
.wpep-pay-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wpep-pay-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--wpep-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.wpep-pay-option:hover {
    border-color: var(--wpep-primary);
    background: #ebf8ff;
}

.wpep-pay-option--selected {
    border-color: var(--wpep-primary) !important;
    background: #ebf8ff !important;
}

.wpep-pay-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--wpep-primary);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.wpep-pay-option-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wpep-pay-option-body strong {
    font-size: 14px;
    color: #2d3748;
}

.wpep-pay-option-body span {
    font-size: 12px;
    color: #718096;
    line-height: 1.4;
}

#wpep-wallet-coverage-msg {
    color: #718096;
}

/* ── Partial payment info box ──────────────────────────────── */
.wpep-partial-info-box {
    margin-top: 12px;
    background: #fffbeb;
    border: 1px solid #f6e05e;
    border-radius: 8px;
    padding: 12px 14px;
}

.wpep-partial-info-box p {
    margin: 0;
    font-size: 13px;
    color: #744210;
    line-height: 1.5;
}

/* ── Success panel ─────────────────────────────────────────── */
.wpep-success-panel {
    text-align: center;
    padding: 30px 20px !important;
}

.wpep-success-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.wpep-success-panel h3 {
    color: var(--wpep-green) !important;
    font-size: 1.3rem;
    margin: 0 0 10px;
}

.wpep-success-panel p {
    color: #4a5568;
    margin-bottom: 20px;
}

/* ── Container ─────────────────────────────────────────────── */
.wpep-container {
    font-family: var(--wpep-font);
    max-width: 800px;
    margin: 0 auto;
    padding: 0 12px 40px;
    box-sizing: border-box;
}

.wpep-title {
    text-align: center;
    color: var(--wpep-primary);
    font-size: 1.4rem;
    margin-bottom: 20px;
}

/* ── Step Indicator ────────────────────────────────────────── */
.wpep-steps {
    display: flex;
    border-radius: var(--wpep-radius);
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--wpep-border);
}

.wpep-step {
    flex: 1;
    text-align: center;
    padding: 12px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--wpep-gray);
    background: #edf2f7;
    border-right: 1px solid var(--wpep-border);
    transition: background .2s, color .2s;
}

.wpep-step:last-child { border-right: none; }

.wpep-step.active {
    background: var(--wpep-primary);
    color: #fff;
}

/* ── Panels ────────────────────────────────────────────────── */
.wpep-panel,
.wpep-diff-panel,
.wpep-summary-panel {
    background: #fff;
    border: 1px solid var(--wpep-border);
    border-radius: var(--wpep-radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--wpep-shadow);
}

.wpep-panel h3,
.wpep-diff-panel h3,
.wpep-summary-panel h3 {
    margin: 0 0 14px;
    font-size: 1rem;
    color: #2d3748;
}

/* ── Step 1: Current product ───────────────────────────────── */
.wpep-product-current {
    display: flex;
    align-items: center;
    gap: 14px;
}

.wpep-product-img img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--wpep-border);
}

.wpep-product-info h4 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    color: #2d3748;
}

.wpep-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.wpep-price span {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--wpep-gray);
}

/* ── Search Box ────────────────────────────────────────────── */
.wpep-search-box {
    margin-bottom: 14px;
}

.wpep-search-box .select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    height: 42px;
    border: 1px solid var(--wpep-border);
    border-radius: 8px;
    font-size: 14px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 42px;
    padding-left: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.wpep-btn {
    display: inline-block;
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-family: var(--wpep-font);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: transform .1s, opacity .15s;
    -webkit-tap-highlight-color: transparent;
}

.wpep-btn:active { transform: scale(.97); }

.wpep-btn-primary {
    background: var(--wpep-primary);
    color: #fff;
    width: 100%;
}

.wpep-btn-primary:hover { opacity: .9; color: #fff; }
.wpep-btn-primary:disabled { background: var(--wpep-gray); cursor: not-allowed; opacity: 1; }

.wpep-btn-secondary {
    background: #edf2f7;
    color: #4a5568;
    width: 100%;
}

.wpep-btn-secondary:hover { background: #e2e8f0; }

.wpep-btn-confirm {
    background: var(--wpep-green);
    color: #fff;
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    letter-spacing: .3px;
}

.wpep-btn-confirm:hover { opacity: .9; }

.wpep-exchange-btn {
    display: inline-block !important;
    background: var(--wpep-primary) !important;
    color: #fff !important;
    padding: 8px 18px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(43,108,176,.3) !important;
    transition: opacity .15s !important;
}

.wpep-exchange-btn:hover { opacity: .85 !important; }

/* ── Compare Grid — MOBILE FIRST (stacked) ─────────────────── */
.wpep-compare-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.wpep-compare-col {
    flex: 1;
    padding: 20px 16px 16px;
    border-radius: var(--wpep-radius);
    text-align: center;
    position: relative;
}

.bg-red-light   { background: #fff5f5; border: 1px solid #fed7d7; }
.bg-green-light { background: #f0fff4; border: 1px solid #9ae6b4; }

.wpep-badge-top {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: #4a5568;
    color: #fff;
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    white-space: nowrap;
}

.wpep-compare-col img {
    max-width: 120px;
    height: auto;
    margin-bottom: 12px;
    border-radius: 6px;
}

.wpep-compare-col h4 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: #2d3748;
}

.wpep-compare-vs {
    text-align: center;
    font-weight: 800;
    color: var(--wpep-gray);
    font-size: 18px;
    padding: 4px 0;
}

.wpep-price-tag {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-top: 6px;
}

/* ── Diff Panel ────────────────────────────────────────────── */
.wpep-diff-msg {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    padding: 14px 12px;
    border-radius: 8px;
    margin: 0;
    line-height: 1.5;
}

.diff-pay    { color: #c53030; background: #fff5f5; }
.diff-refund { color: #276749; background: #f0fff4; }
.diff-even   { color: #2b6cb0; background: #ebf8ff; }

/* ── Actions (Back / Next buttons) ────────────────────────── */
.wpep-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.wpep-actions .wpep-btn {
    flex: 1;
}

/* ── Summary (Step 3) ──────────────────────────────────────── */
.wpep-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wpep-summary-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--wpep-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
}

.wpep-summary-list li:last-child { border-bottom: none; }

.wpep-summary-list li span { color: #718096; flex-shrink: 0; }
.wpep-summary-list li strong { text-align: right; }

.wpep-summary-total {
    font-size: 1rem !important;
    font-weight: 700;
    background: var(--wpep-bg);
    padding: 12px !important;
    border-radius: 6px;
}

/* ── Badges (status) ───────────────────────────────────────── */
.wpep-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .3px;
}

.wpep-badge-pending  { background: #d69e2e; }
.wpep-badge-approved { background: var(--wpep-green); }
.wpep-badge-rejected { background: var(--wpep-red); }

/* ── Exchange Section (on view-order page) ─────────────────── */
.wpep-exchange-section {
    margin-top: 28px;
    font-family: var(--wpep-font);
}

.wpep-exchange-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid var(--wpep-primary);
    padding-bottom: 10px;
    color: var(--wpep-primary);
    font-size: 1rem;
    margin-bottom: 12px;
}

/* Make the exchange table scroll on very small screens */
.wpep-exchange-section .woocommerce-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
}

.wpep-exchange-section .woocommerce-table th,
.wpep-exchange-section .woocommerce-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--wpep-border);
    font-size: 13px;
    vertical-align: middle;
}

.wpep-exchange-section .woocommerce-table th {
    background: var(--wpep-bg);
    font-weight: 600;
    color: #4a5568;
}

/* ── Loading Spinner ────────────────────────────────────────── */
.wpep-spinner {
    border: 3px solid rgba(0,0,0,.1);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border-left-color: var(--wpep-primary);
    animation: wpep-spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

@keyframes wpep-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Wallet Page ────────────────────────────────────────────── */
.wpep-wallet-card {
    background: linear-gradient(135deg, #2b6cb0, #3182ce);
    color: #fff;
    padding: 24px 20px;
    border-radius: var(--wpep-radius);
    margin-bottom: 24px;
    box-shadow: 0 4px 14px rgba(43,108,176,.35);
}

.wpep-wallet-card h4 { margin: 0 0 8px; opacity: .85; font-size: 13px; font-weight: 500; }
.wpep-wallet-card p  { margin: 0; font-size: 2.4rem; font-weight: 700; }

/* ── Tablet & Desktop ───────────────────────────────────────── */
@media ( min-width: 600px ) {

    .wpep-container { padding: 0 0 40px; }

    .wpep-step { font-size: 14px; padding: 14px 10px; }

    /* Side-by-side compare only on wider screens */
    .wpep-compare-grid {
        flex-direction: row;
        align-items: stretch;
    }

    .wpep-compare-vs {
        display: flex;
        align-items: center;
        font-size: 22px;
        padding: 0 4px;
    }

    .wpep-compare-col img { max-width: 150px; }

    .wpep-btn-primary,
    .wpep-btn-secondary,
    .wpep-btn-confirm {
        width: auto;
    }

    /* Don't force full-width on desktop */
    .wpep-btn-confirm { width: 100%; }

    .wpep-diff-msg { font-size: 1.1rem; }

    .wpep-price-tag { font-size: 1.8rem; }
}
