/* ============================================================
   PayFast JetEngine – Frontend Styles
   ============================================================ */

/* ----- Buttons ----- */
.pfje-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #00a651;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.pfje-btn:hover,
.pfje-btn:focus   { background: #007a3d; color: #fff; }
.pfje-btn:disabled { background: #aaa; cursor: not-allowed; }

.pfje-btn-remove {
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.pfje-btn-remove:hover { background: #c0392b; }

/* ----- Messages ----- */
.pfje-msg { font-size: 0.85em; min-height: 1.2em; }
.pfje-msg.pfje-error,
.pfje-error { color: #c0392b; }
.pfje-msg.pfje-success { color: #27ae60; }

/* ----- Add to Cart widget ----- */
.pfje-add-to-cart-wrap {
    display: inline-flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    max-width: 280px;
}
.pfje-price {
    font-size: 1.5em;
    font-weight: 700;
    color: #1a1a1a;
}

/* ----- Cart table ----- */
.pfje-cart-container { max-width: 860px; margin: 0 auto; }

.pfje-cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.pfje-cart-table th,
.pfje-cart-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: middle;
}
.pfje-cart-table tfoot th,
.pfje-cart-table tfoot td { font-weight: 700; background: #f9f9f9; }
.pfje-text-right { text-align: right !important; }

.pfje-cart-actions { text-align: right; margin-top: 8px; }
.pfje-proceed-to-checkout-btn { font-size: 1.05em; padding: 14px 28px; }

.pfje-cart-empty { font-style: italic; color: #666; }

/* ============================================================
   Checkout Page  (WooCommerce two-column style)
   ============================================================ */
.pfje-checkout-page { max-width: 1060px; margin: 0 auto; }

.pfje-checkout-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 48px;
    align-items: start;
}
@media (max-width: 860px) {
    .pfje-checkout-grid { grid-template-columns: 1fr; }
}

/* Left column sections */
.pfje-checkout-section {
    margin-bottom: 32px;
}
.pfje-checkout-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 1.2em;
    font-weight: 700;
}

/* ----- Billing / Shipping form fields ----- */
.pfje-field { margin-bottom: 18px; }
.pfje-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9em;
    color: #222;
}
.pfje-field label abbr {
    text-decoration: none;
    color: #c0392b;
    margin-left: 3px;
}
.pfje-optional {
    font-weight: 400;
    color: #888;
    font-size: 0.85em;
    margin-left: 4px;
}
.pfje-field input[type="text"],
.pfje-field input[type="email"],
.pfje-field input[type="tel"],
.pfje-field select,
.pfje-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #333;
    -webkit-appearance: none;
}
.pfje-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}
.pfje-field textarea {
    resize: vertical;
    min-height: 80px;
}
.pfje-field input:focus,
.pfje-field select:focus,
.pfje-field textarea:focus {
    border-color: #00a651;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,166,81,0.12);
}

/* Invalid field state */
.pfje-field.pfje-field-error input,
.pfje-field.pfje-field-error select,
.pfje-field.pfje-field-error textarea {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}

.pfje-field-row--half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 480px) {
    .pfje-field-row--half { grid-template-columns: 1fr; }
}

/* ----- Ship to different address toggle ----- */
.pfje-checkout-shipping-toggle-section {
    margin-bottom: 0;
}
.pfje-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    padding: 14px 16px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    user-select: none;
}
.pfje-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00a651;
    cursor: pointer;
    flex-shrink: 0;
}

/* ----- Checkout notice (inline error / success) ----- */
.pfje-checkout-notice {
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 4px;
    font-size: 0.95em;
    display: none;
}
.pfje-checkout-notice.pfje-notice--error {
    background: #fdf0ef;
    border: 1px solid #e74c3c;
    color: #c0392b;
}
.pfje-checkout-notice.pfje-notice--success {
    background: #edfaf3;
    border: 1px solid #27ae60;
    color: #1e8449;
}

/* ----- Order summary (right column) ----- */
.pfje-checkout-summary {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 24px;
    position: sticky;
    top: 24px;
}
.pfje-checkout-summary h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 1.2em;
    font-weight: 700;
}

.pfje-order-review-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}
.pfje-order-review-table th,
.pfje-order-review-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e8e8e8;
    font-size: 0.95em;
    vertical-align: top;
}
.pfje-order-review-table thead th {
    font-size: 0.8em;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
}
.pfje-order-review-table td:last-child,
.pfje-order-review-table th:last-child {
    text-align: right;
    white-space: nowrap;
}
.pfje-qty-badge {
    display: inline-block;
    background: #e0e0e0;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.75em;
    margin-left: 6px;
    color: #555;
    font-weight: 700;
}
.pfje-order-subtotal-row th,
.pfje-order-subtotal-row td {
    color: #666;
    font-size: 0.9em;
}
.pfje-order-total-row th,
.pfje-order-total-row td {
    border-bottom: none;
    border-top: 2px solid #e0e0e0;
    padding-top: 14px;
    font-size: 1.05em;
    font-weight: 700;
}

.pfje-payment-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 0.85em;
    color: #666;
}
.pfje-payment-notice p { margin: 0; }
.pfje-lock-icon { font-size: 1.1em; flex-shrink: 0; }

.pfje-place-order-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.1em;
    text-align: center;
    justify-content: center;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.pfje-terms-notice {
    font-size: 0.8em;
    color: #999;
    text-align: center;
    margin-top: 12px;
    margin-bottom: 0;
    line-height: 1.5;
}
.pfje-terms-notice a { color: #00a651; text-decoration: underline; }

/* ============================================================
   Qty Stepper
   ============================================================ */
.pfje-qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    max-width: 120px;
}
.pfje-qty-btn {
    background: #f0f0f0;
    border: none;
    width: 34px;
    height: 38px;
    font-size: 1.2em;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.pfje-qty-btn:hover  { background: #ddd; }
.pfje-qty-btn:active { background: #ccc; }
.pfje-qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pfje-qty-input {
    width: 40px;
    height: 38px;
    border: none;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    text-align: center;
    font-size: 0.95em;
    font-family: inherit;
    padding: 0;
    -moz-appearance: textfield;
    box-sizing: border-box;
}
.pfje-qty-input::-webkit-outer-spin-button,
.pfje-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pfje-qty-input:focus { outline: none; background: #f9fff9; }

.pfje-qty-stepper--cart { max-width: 110px; }
.pfje-qty-stepper--cart .pfje-qty-btn  { width: 28px; height: 34px; font-size: 1em; }
.pfje-qty-stepper--cart .pfje-qty-input { width: 36px; height: 34px; font-size: 0.9em; }

/* Add-to-cart / buy wrap when stepper is present */
.pfje-add-to-cart-wrap,
.pfje-buy-wrap {
    display: inline-flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    max-width: 300px;
}

/* ============================================================
   Result Pages (Thank You & Cancel)
   ============================================================ */
.pfje-result-page {
    max-width: 640px;
    margin: 60px auto;
    padding: 40px 32px;
    text-align: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.pfje-result-icon  { font-size: 3.5em; margin-bottom: 12px; line-height: 1; }
.pfje-result-title { font-size: 1.8em; margin: 0 0 12px; }
.pfje-result-intro { color: #444; font-size: 1.05em; margin-bottom: 28px; }

.pfje-result-page--success .pfje-result-title { color: #1e8449; }
.pfje-result-page--cancel  .pfje-result-title { color: #c0392b; }

/* Order summary box inside thank you page */
.pfje-order-summary-box {
    text-align: left;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 24px;
    margin: 0 auto 28px;
}
.pfje-order-summary-box h2 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.1em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}
.pfje-order-summary-box h3 {
    margin: 20px 0 10px;
    font-size: 0.95em;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.04em;
}
.pfje-order-summary-table,
.pfje-order-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}
.pfje-order-summary-table th,
.pfje-order-summary-table td,
.pfje-order-items-table th,
.pfje-order-items-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e8e8e8;
    text-align: left;
    vertical-align: middle;
}
.pfje-order-summary-table th { width: 38%; color: #555; font-weight: 600; }
.pfje-order-items-table thead th { color: #777; font-size: 0.85em; text-transform: uppercase; }
.pfje-order-items-table tfoot th,
.pfje-order-items-table tfoot td { font-weight: 700; border-top: 2px solid #ddd; border-bottom: none; }

.pfje-result-email-note {
    font-size: 0.85em;
    color: #666;
    margin: 16px 0 0;
    font-style: italic;
}

/* Cancel page specifics */
.pfje-cancel-reasons {
    text-align: left;
    background: #fdf0ef;
    border: 1px solid #f5c6c6;
    border-radius: 6px;
    padding: 16px 20px;
    margin: 0 auto 28px;
    max-width: 440px;
}
.pfje-cancel-reasons h3 { margin-top: 0; font-size: 0.95em; color: #c0392b; }
.pfje-cancel-reasons ul  { margin: 0; padding-left: 20px; color: #555; font-size: 0.9em; }
.pfje-cancel-reasons li  { margin-bottom: 4px; }

.pfje-result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.pfje-btn--secondary {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
}
.pfje-btn--secondary:hover { background: #f5f5f5; color: #333; }

.pfje-result-support {
    font-size: 0.85em;
    color: #888;
    margin: 0;
}
.pfje-result-support a { color: #00a651; }

/* ============================================================
   Status Badges
   ============================================================ */
.pfje-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pfje-status-pending   { background: #fff3cd; color: #856404; }
.pfje-status-complete  { background: #d1f0e0; color: #1a6b3c; }
.pfje-status-failed    { background: #fce8e8; color: #a93226; }
.pfje-status-cancelled { background: #f0f0f0; color: #555;    }

/* ============================================================
   My Orders Table [pfje_my_orders]
   ============================================================ */
.pfje-my-orders { max-width: 860px; margin: 0 auto; }
.pfje-my-orders h2 {
    margin-bottom: 20px;
    font-size: 1.4em;
}
.pfje-my-orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}
.pfje-my-orders-table th,
.pfje-my-orders-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: top;
}
.pfje-my-orders-table thead th {
    background: #f5f5f5;
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    color: #555;
}
.pfje-my-orders-table tbody tr:hover { background: #fafafa; }
.pfje-my-orders-login,
.pfje-my-orders-empty { color: #666; font-style: italic; }
.pfje-my-orders-login a { color: #00a651; }
