/* =============================================
   Assure Checkout Modal
   ============================================= */

/* Overlay */
.assure-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Modal container */
.assure-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: assureSlideUp 0.3s ease-out;
}

@keyframes assureSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.assure-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    background: #1a2332;
    border-radius: 16px 16px 0 0;
}

.assure-modal-header-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.assure-modal-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.assure-modal-plan-badge {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.assure-modal-plan-tier {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.assure-modal-plan-price {
    color: #22c55e;
    font-size: 20px;
    font-weight: 700;
}

.assure-modal-plan-terms {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
}

.assure-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 28px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.assure-modal-close:hover {
    color: #fff;
}

/* Step indicators */
.assure-modal-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px 8px;
    gap: 8px;
}

.assure-step-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.assure-step-indicator.active,
.assure-step-indicator.completed {
    opacity: 1;
}

.assure-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.3s, color 0.3s;
}

.assure-step-indicator.active .assure-step-number {
    background: #1a2332;
    color: #fff;
}

.assure-step-indicator.completed .assure-step-number {
    background: #22c55e;
    color: #fff;
}

.assure-step-label {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
}

.assure-step-divider {
    width: 32px;
    height: 2px;
    background: #e5e7eb;
    border-radius: 1px;
}

/* Modal body */
.assure-modal-body {
    padding: 16px 24px 24px;
}

.assure-modal-body h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1a2332;
    margin: 0 0 16px;
}

.assure-step-description {
    color: #4b5563;
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.5;
}

/* Form elements */
.assure-form-group {
    margin-bottom: 16px;
}

.assure-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.assure-required {
    color: #ef4444;
}

.assure-form-group input[type="text"],
.assure-form-group input[type="email"],
.assure-form-group input[type="tel"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    color: #1a2332;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.assure-form-group input:focus {
    outline: none;
    border-color: #1a2332;
    box-shadow: 0 0 0 3px rgba(26, 35, 50, 0.1);
}

.assure-form-group input.assure-input-error {
    border-color: #ef4444;
}

.assure-form-row--half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Buttons */
.assure-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.assure-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    line-height: 1.2;
}

.assure-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.assure-btn-primary {
    background: #22c55e;
    color: #fff;
    flex: 1;
}

.assure-btn-primary:hover:not(:disabled) {
    background: #16a34a;
}

.assure-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.assure-btn-secondary:hover {
    background: #e5e7eb;
}

/* Damage choice */
.assure-damage-choice {
    display: grid;
    gap: 12px;
}

.assure-choice-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
    width: 100%;
}

.assure-choice-btn:hover {
    border-color: #1a2332;
    background: #f9fafb;
}

.assure-choice-btn.selected {
    border-color: #1a2332;
    background: #f0f9ff;
}

.assure-choice-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.assure-choice-label {
    font-size: 15px;
    color: #1a2332;
    font-weight: 500;
}

/* Upload area */
.assure-upload-area {
    margin-top: 16px;
    position: relative;
}

.assure-upload-area input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
    top: 0;
    left: 0;
}

.assure-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 20px;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.assure-upload-label:hover {
    border-color: #1a2332;
    background: #f9fafb;
}

.assure-upload-icon {
    font-size: 32px;
}

.assure-upload-hint {
    font-size: 12px;
    color: #9ca3af;
}

.assure-upload-preview {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.assure-upload-preview img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Damage result */
.assure-result-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}

.assure-result-text {
    color: #374151;
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 8px;
}

.assure-result-fee {
    color: #1a2332;
    font-size: 15px;
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.assure-fee-amount {
    color: #1a2332;
}

/* Order summary */
.assure-order-summary {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.assure-order-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 15px;
    color: #1a2332;
}

.assure-order-line + .assure-order-line {
    border-top: 1px solid #e5e7eb;
}

.assure-order-terms {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
}

/* Stripe Payment Element container */
#assure-payment-element {
    margin-bottom: 16px;
    min-height: 100px;
}

/* Terms checkbox */
.assure-terms-accept {
    margin-bottom: 8px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.assure-terms-accept label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.assure-terms-accept input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.assure-terms-accept a {
    color: #1a2332;
    text-decoration: underline;
}

/* Payment error */
.assure-payment-error {
    color: #ef4444;
    font-size: 14px;
    padding: 12px 16px;
    background: #fef2f2;
    border-radius: 8px;
    margin-top: 12px;
}

/* Spinner */
.assure-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #1a2332;
    border-radius: 50%;
    animation: assureSpin 0.7s linear infinite;
    margin: 0 auto 16px;
}

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

.assure-damage-loading,
.assure-step-processing {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 15px;
}

/* Success state */
.assure-step-success {
    text-align: center;
    padding: 24px 0;
}

.assure-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.assure-success-heading {
    text-align: center;
}

.assure-success-message {
    color: #4b5563;
    font-size: 15px;
    line-height: 1.6;
    max-width: 360px;
    margin: 0 auto;
}

.assure-step-success .assure-form-actions {
    justify-content: center;
    margin-top: 24px;
}

/* Stepper number input */
.assure-stepper {
    display: flex;
    align-items: stretch;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.assure-stepper-btn {
    width: 48px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    user-select: none;
    line-height: 1;
    padding: 0;
}

.assure-stepper-btn:hover {
    background: #e5e7eb;
}

.assure-stepper-btn:active {
    background: #d1d5db;
}

.assure-stepper-value {
    flex: 1;
    border: none;
    border-left: 1px solid #d1d5db;
    border-right: 1px solid #d1d5db;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #1a2332;
    padding: 12px 0;
    background: #fff;
    min-width: 0;
    -moz-appearance: textfield;
    outline: none;
}

.assure-stepper-value::-webkit-outer-spin-button,
.assure-stepper-value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Photo upload groups */
.assure-photo-group {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.assure-photo-group-header {
    font-size: 15px;
    font-weight: 600;
    color: #1a2332;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}

.assure-photo-group-icon {
    font-size: 18px;
}

/* Photo upload fields */
.assure-photo-field {
    margin-bottom: 14px;
}

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

.assure-photo-field-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.assure-photo-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assure-photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.assure-photo-pick-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.assure-photo-pick-btn:hover {
    border-color: #1a2332;
    background: #f3f4f6;
}

.assure-photo-pick-icon {
    font-size: 18px;
}

.assure-photo-thumb {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.assure-photo-thumb:empty {
    display: none;
}

.assure-photo-thumb img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Pricing breakdown */
.assure-pricing-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 20px;
}

.assure-pricing-line {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: #374151;
}

.assure-pricing-line + .assure-pricing-line {
    border-top: 1px solid #e5e7eb;
}

.assure-pricing-total {
    font-size: 16px;
    color: #1a2332;
}

.assure-pricing-original s {
    color: #9ca3af;
}

.assure-discount-value {
    color: #22c55e;
    font-weight: 600;
}

/* Savings celebration banner */
.assure-savings-banner {
    margin-top: 16px;
    background: linear-gradient(135deg, #065f46 0%, #047857 100%);
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    text-align: center;
}

.assure-savings-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.assure-savings-headline {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.assure-savings-headline strong {
    color: #bbf7d0;
}

.assure-savings-detail {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.assure-savings-detail strong {
    color: #fff;
}

/* Promo code */
.assure-promo-section {
    margin-bottom: 16px;
}

.assure-promo-link {
    font-size: 14px;
    color: #1a2332;
}

.assure-promo-input-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.assure-promo-input-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.assure-promo-input-row input:focus {
    outline: none;
    border-color: #1a2332;
}

.assure-promo-result {
    font-size: 13px;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
}

.assure-promo-success {
    background: #f0fdf4;
    color: #166534;
}

.assure-promo-error {
    background: #fef2f2;
    color: #991b1b;
}

/* Pre-auth notice */
.assure-preauth-notice {
    font-size: 14px;
    color: #78350f;
    line-height: 1.6;
    padding: 14px 18px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-left: 4px solid #f97316;
    border-radius: 8px;
    margin-bottom: 16px;
}

.assure-preauth-notice strong {
    color: #9a3412;
}

/* Responsive: full-screen on small viewports */
@media (max-width: 560px) {
    .assure-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .assure-modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 16px 16px 0 0;
        animation: assureSlideUpMobile 0.3s ease-out;
    }

    @keyframes assureSlideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .assure-modal-body {
        padding: 16px;
    }

    .assure-step-label {
        display: none;
    }

    .assure-form-row--half {
        grid-template-columns: 1fr;
    }
}
