/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pay-green: #00C853;
    --pay-green-hover: #00a844;
    --border: #d9d9d9;
    --border-focus: #1773b0;
    --bg: #f5f5f5;
    --bg-summary: #fafafa;
    --text: #333;
    --text-light: #707070;
    --text-muted: #999;
    --white: #fff;
    --error: #d12f2f;
    --error-light: #fef1f1;
    --success: #0c7c3a;
    --success-light: #e6f7ed;
    --radius: 5px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--white);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.checkout-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 16px 0 0;
}

.header-inner {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo {
    height: 68px;
    max-width: 240px;
    width: auto;
    object-fit: contain;
}

.breadcrumb-bar {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.breadcrumb-step {
    color: var(--text-muted);
}

.breadcrumb-step.active {
    color: var(--text);
    font-weight: 600;
}

.breadcrumb-chevron {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ===== MAIN LAYOUT ===== */
.checkout-main {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* ===== ORDER SUMMARY (COLLAPSIBLE) ===== */
.order-summary-section {
    background: var(--bg-summary);
    border-bottom: 1px solid var(--border);
    margin: 0 -20px;
    padding: 0 20px;
}

.summary-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.summary-toggle-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--border-focus);
    font-size: 14px;
    font-weight: 500;
}

.summary-toggle-left svg:first-child {
    width: 20px;
    height: 20px;
}

.summary-chevron {
    transition: transform 0.3s;
    width: 12px;
    height: 8px;
}

.summary-toggle-bar.open .summary-chevron {
    transform: rotate(180deg);
}

.summary-toggle-total {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.summary-details {
    padding-bottom: 20px;
    display: none;
}

.summary-details.open {
    display: block;
}

.summary-product {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e1e1e1;
}

.summary-product-image-wrap {
    position: relative;
    flex-shrink: 0;
}

.summary-product-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--white);
}

.summary-product-qty-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: rgba(114,114,114,0.9);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.summary-product-info {
    flex: 1;
    min-width: 0;
}

.summary-product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.summary-product-desc {
    font-size: 12px;
    color: var(--text-light);
}

.summary-product-pricing {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.summary-original-price {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 12px;
}

.summary-discount-badge {
    background: #fef2f2;
    color: #dc2626;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 14px;
    color: var(--text-light);
}

.summary-line.total {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    border-top: 1px solid #e1e1e1;
    margin-top: 8px;
    padding-top: 12px;
}

.summary-local-price {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
}

.free-shipping-tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
}

/* ===== FORM SECTIONS ===== */
.form-section {
    padding: 28px 0 0;
}

.section-header {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e1e1e1;
}

/* ===== FORM FIELDS ===== */
.form-field {
    position: relative;
    margin-bottom: 12px;
}

.form-field:last-child {
    margin-bottom: 0;
}

.form-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 6px;
}

.form-field input,
.form-field select {
    width: 100%;
    height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.form-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 1.5L6 6.5L11 1.5' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-field input:focus,
.form-field select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 1px var(--border-focus);
}

.form-field input.error,
.form-field select.error {
    border-color: var(--error);
    box-shadow: 0 0 0 1px var(--error);
}

.form-field input.valid,
.form-field select.valid {
    border-color: var(--success);
}

.form-field input::placeholder {
    color: #b0b0b0;
}

/* Row: two columns */
.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Inline validation checkmark */
.form-field .field-valid {
    position: absolute;
    right: 14px;
    top: 38px;
    color: var(--success);
    display: none;
    pointer-events: none;
}

.form-field .field-valid.visible {
    display: block;
}

/* Field errors */
.form-field .field-error {
    font-size: 12px;
    color: var(--error);
    margin-top: 4px;
    display: none;
}

.form-field .field-error.visible {
    display: block;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--text-light);
    cursor: pointer;
    margin-top: 12px;
    line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: var(--border-focus);
}

/* ===== SHIPPING METHOD ===== */
.shipping-placeholder-msg {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.shipping-method-card {
    border: 2px solid var(--border-focus);
    border-radius: var(--radius);
    background: #f0f5ff;
    overflow: hidden;
}

.shipping-method-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.shipping-method-radio {
    flex-shrink: 0;
}

.radio-dot {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    position: relative;
}

.radio-dot.active {
    border-color: var(--border-focus);
}

.radio-dot.active::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-focus);
}

.shipping-method-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.shipping-method-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--success);
}

.shipping-estimate {
    padding: 10px 16px;
    background: #f0f5ff;
    border-top: 1px solid #d8e4f0;
    font-size: 13px;
    color: var(--text-light);
}

.shipping-estimate #shipping-estimate-title {
    font-weight: 600;
    color: var(--text);
}

.shipping-location-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ===== PAYMENT SECTION ===== */
.section-header-no-border {
    border-bottom: none;
    margin-bottom: 2px;
    padding-bottom: 0;
}

.payment-secure-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.payment-option-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.payment-option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.card-brands {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-brands svg {
    height: 22px;
    width: auto;
    border-radius: 3px;
}

.payment-option-body {
    padding: 16px;
    background: var(--white);
}

/* ===== STRIPE ELEMENTS ===== */
.stripe-element-container {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 48px;
}

.stripe-element-container.StripeElement--focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 1px var(--border-focus);
}

.stripe-element-container.StripeElement--invalid {
    border-color: var(--error);
    box-shadow: 0 0 0 1px var(--error);
}

#card-errors {
    font-size: 13px;
    color: var(--error);
    margin-top: 8px;
    min-height: 0;
}

/* ===== PAYMENT ERROR ===== */
.payment-error {
    background: var(--error-light);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 14px;
    color: var(--error);
    display: none;
    margin-bottom: 14px;
}

.payment-error.visible {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.payment-error svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ===== PAYMENT RETRY ===== */
.payment-retry {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

.retry-header {
    font-size: 15px;
    font-weight: 600;
    color: #c2410c;
    margin-bottom: 10px;
}

.retry-tips {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 12px;
}

.retry-tips ul {
    list-style: none;
    padding: 0;
    margin: 6px 0 0 0;
}

.retry-tips li {
    padding: 3px 0 3px 16px;
    position: relative;
}

.retry-tips li::before {
    content: "\2022";
    position: absolute;
    left: 4px;
    color: #f59e0b;
}

.retry-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--pay-green);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.retry-btn:hover {
    background: var(--pay-green-hover);
}

/* ===== EXPRESS CHECKOUT ===== */
.express-checkout {
    margin-bottom: 16px;
}

.express-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 12px;
}

#payment-request-button {
    margin-bottom: 0;
}

.express-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.express-divider::before,
.express-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.express-divider span {
    white-space: nowrap;
}

/* ===== PAY BUTTON ===== */
.pay-section {
    padding-top: 24px !important;
}

.pay-button {
    width: 100%;
    height: 52px;
    padding: 0 24px;
    background: var(--pay-green);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pay-button:hover {
    background: var(--pay-green-hover);
}

.pay-button:active {
    background: #009040;
}

.pay-button:disabled {
    background: #a0e6c0;
    cursor: not-allowed;
}

.pay-button .spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== TRUST MESSAGE ===== */
.pay-trust-message {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pay-trust-message svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ===== FOOTER ===== */
.checkout-footer {
    text-align: center;
    padding: 24px 20px 20px;
    border-top: 1px solid #e1e1e1;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    font-size: 12px;
    color: var(--border-focus);
    text-decoration: underline;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #0f5a8c;
}

/* ===== TESTIMONIAL CAROUSEL ===== */
.depo-carousel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    padding: 10px 16px;
}

.depo-track {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    height: 36px;
}

.depo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.depo-item.active {
    opacity: 1;
}

.depo-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.depo-bubble {
    font-size: 12px;
    color: #374151;
    line-height: 1.4;
}

.depo-bubble strong {
    color: #1f2937;
}

/* ===== DESKTOP: >=768px ===== */
@media (min-width: 768px) {
    /* Summary collapsed by default on desktop too - user opens it */
    .summary-details {
        display: none;
    }
    .summary-details.open {
        display: block;
    }

    .summary-toggle-bar {
        cursor: default;
    }

    .summary-chevron {
        display: none;
    }

    .order-summary-section {
        border-radius: 8px;
        margin: 20px 0 0;
        border: 1px solid var(--border);
    }
}

/* ===== MOBILE: <768px ===== */
@media (max-width: 767px) {
    .header-logo {
        height: 56px;
        max-width: 180px;
    }

    .breadcrumb-bar {
        padding: 0 16px 10px;
        font-size: 12px;
    }

    .checkout-main {
        padding: 0 16px 80px;
    }

    .order-summary-section {
        margin: 0 -16px;
        padding: 0 16px;
    }

    /* Summary collapsed by default on mobile */
    .summary-details {
        display: none;
    }

    .summary-details.open {
        display: block;
    }

    .form-row.two-col {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .section-header {
        font-size: 16px;
    }

    .pay-button {
        font-size: 16px;
        height: 50px;
    }

    .footer-links {
        gap: 16px;
    }
}

/* ===== PREVENT iOS ZOOM ===== */
@media screen and (max-width: 767px) {
    .form-field input,
    .form-field select {
        font-size: 16px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
