/**
 * Avvance Widget Styles - COMPLETE WITH CRITICAL FEATURES
 * 
 * NEW STYLES:
 * 1. Category page widget (compact design)
 * 2. Checkout page widget
 * 3. Pre-approved banner
 * 4. Theme variations (light/dark)
 */

/* ========================================
   BASE WIDGET STYLES
   ======================================== */

.avvance-product-widget,
.avvance-cart-widget,
.avvance-checkout-widget,
.avvance-category-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    margin: 10px 0;
}

.avvance-widget-content {
    display: block;
}

/* ========================================
   PRICE MESSAGE
   ======================================== */

.avvance-price-message {
    display: block;
    line-height: 1.8;
    text-align: left;
}

.avvance-loading {
    color: #666;
    font-style: italic;
}

/* ========================================
   LOGO STYLES
   ======================================== */

.avvance-logo-inline {
    height: 18px;
    width: auto;
    display: inline-block;
    vertical-align: middle;
    margin: 0 3px;
    max-width: 120px;
}

.avvance-logo-small {
    height: 16px;
    width: auto;
    display: block;
    margin: 2px auto 0;
}

.avvance-logo-checkout {
    height: 24px;
    width: auto;
    margin-bottom: 10px;
}

.avvance-brand {
    font-weight: 600;
    color: #0073aa;
}

.avvance-brand-large {
    font-weight: 600;
    color: #0073aa;
    font-size: 20px;
}

/* ========================================
   CTA LINKS & MESSAGES
   ======================================== */

.avvance-prequal-cta {
    display: flex;
    align-items: center;
}

.avvance-prequal-link,
.avvance-prequal-link-checkout {
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s;
}

.avvance-prequal-link:hover,
.avvance-prequal-link-checkout:hover {
    color: #005a87;
    text-decoration: none;
}

.avvance-check-spending-link,
.avvance-learn-more-link,
.avvance-preapproved-details-link {
    color: #235AE4;
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    white-space: nowrap;
}

.avvance-check-spending-link:hover,
.avvance-learn-more-link:hover,
.avvance-preapproved-details-link:hover {
    color: #1a47b8;
    text-decoration: none;
}

/* 0% APR badge */
.avvance-zero-apr {
    color: #0073aa;
    font-weight: 700;
}

/* Pre-approved badge */
.avvance-preapproved-badge {
    color: #2e7d32;
    font-weight: 700;
}

.avvance-preapproved-state {
    color: #333;
}

/* See your details link */
.avvance-see-details-link {
    color: #0073aa;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
}

.avvance-see-details-link:hover {
    color: #005a87;
    text-decoration: none;
}

.avvance-preapproved-message {
    color: #0073aa;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ========================================
   CATEGORY PAGE WIDGET (COMPACT)
   ======================================== */

.woocommerce ul.products li.product .avvance-category-widget {
    text-align: left;
}

li.product .avvance-category-widget,
li.product .avvance-category-widget .avvance-widget-content,
li.product .avvance-category-widget .avvance-price-message {
    text-align: left !important;
}

/* ========================================
   CHECKOUT BANNER
   ======================================== */

.avvance-checkout-banner {
    background: #F1F5FB;
    border: 1px solid #CDD1E2;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.avvance-checkout-preapproved {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avvance-checkout-banner-check {
    background: #02C78F;
    color: #fff;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.avvance-checkout-banner-text {
    flex: 1;
}

/* ========================================
   PRODUCT PAGE WIDGET
   ======================================== */

.avvance-product-widget {
    padding: 12px 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}

/* ========================================
   CART PAGE WIDGET
   ======================================== */

.avvance-cart-widget-container {
    margin: 20px 0;
}

.avvance-cart-widget {
    background: #f8f9fa;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.avvance-cart-widget .avvance-price-message {
    font-size: 15px;
}

/* ========================================
   CHECKOUT PAGE WIDGET
   ======================================== */

#avvance-checkout-widget-container {
    background: #f8f9fa;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin: 15px 0;
}

.avvance-checkout-message {
    text-align: center;
}

.avvance-checkout-header {
    margin-bottom: 15px;
}

.avvance-checkout-tagline {
    font-size: 16px;
    margin: 0 0 15px 0;
    color: #333;
}

.avvance-checkout-tagline strong {
    color: #0073aa;
    font-weight: 600;
}

.avvance-prequal-link-checkout {
    display: inline-block;
    padding: 10px 20px;
    background: #0073aa;
    color: white !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.2s;
}

.avvance-prequal-link-checkout:hover {
    background: #005a87;
}

/* ========================================
   PRE-APPROVED BANNER
   ======================================== */

.avvance-preapproved-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #4caf50;
}

.avvance-checkmark {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
}

.avvance-banner-content {
    flex: 1;
    text-align: left;
}

.avvance-banner-content strong {
    display: block;
    font-size: 18px;
    color: #2e7d32;
    margin-bottom: 5px;
}

.avvance-banner-content p {
    margin: 0;
    color: #558b2f;
    font-size: 14px;
}

/* ========================================
   THEME VARIATIONS
   ======================================== */

/* Light Theme (Default) */
.avvance-widget-light {
    color: #333;
}

.avvance-widget-light .avvance-prequal-link {
    color: #0073aa;
}

.avvance-widget-light .avvance-price-message {
    color: #333;
}

/* Dark Theme */
.avvance-widget-dark {
    color: #fff;
    background: #2c3e50;
    padding: 15px;
    border-radius: 6px;
}

.avvance-widget-dark .avvance-prequal-link {
    color: #66b3ff;
}

.avvance-widget-dark .avvance-price-message {
    color: #fff;
}

.avvance-widget-dark .avvance-brand {
    color: #66b3ff;
}

.avvance-widget-dark .avvance-preapproved-message {
    color: #66b3ff;
}

/* ========================================
   MODAL STYLES
   ======================================== */

.avvance-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.avvance-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.avvance-modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 660px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    background: #F1F5FB;
    border-radius: 8px;
    border: 1px solid #7f7f84;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: avvanceSlideDown 0.25s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

@keyframes avvanceSlideDown {
    from {
        transform: translate(-50%, calc(-50% - 24px));
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

/* Scrollable body — padding-bottom makes room for sticky CTA when present */
.avvance-modal-scrollable {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 48px;
    padding: 64px;
}

.avvance-modal-scrollable--has-cta {
    padding-bottom: 96px;
}

/* Sticky CTA */
.avvance-modal-sticky-cta {
    flex-shrink: 0;
    padding: 16px 64px;
    background: #F1F5FB;
    border-top: 1px solid #e0e0e6;
}

/* Modal Header */
.avvance-modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.avvance-modal-logo-img {
    width: 100%;
    max-width: 380px;
    height: auto;
}

.avvance-modal-close {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #4c4c50;
    padding: 0;
    line-height: 1;
}

.avvance-modal-close:hover {
    color: #000;
}

/* Modal Body */
.avvance-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.avvance-modal-heading {
    font-size: 28px;
    line-height: 35.84px;
    color: #000;
    font-weight: 700;
    margin: 0;
    word-break: break-word;
}

.avvance-modal-subtitle {
    font-size: 20px;
    line-height: 32px;
    color: #4c4c50;
    font-weight: 400;
    margin: 0;
    word-break: break-word;
}

/* Calculator Row */
.avvance-calculator-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px;
    gap: 16px;
    border: 1px solid #d6d6d9;
    border-radius: 8px;
    background: #fff;
}

.avvance-calculator-label {
    font-size: 16px;
    line-height: 23.2px;
    letter-spacing: 0.16px;
    color: #000;
    flex: 1;
}

.avvance-currency-input {
    border: none;
    border-bottom: 1px solid #7f7f84;
    font-size: 20px;
    padding: 2px 4px;
    width: 110px;
    background: transparent;
    outline: none;
    color: #4c4c50;
}

.avvance-currency-input:focus {
    border-bottom-color: #235AE4;
}

.avvance-calc-btn {
    background: #235AE4;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.avvance-calc-btn:hover {
    background: #1a47b8;
}

/* Loan Cards */
.avvance-loan-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.avvance-loan-card {
    border: 1px solid #d6d6d9;
    border-radius: 8px;
    padding: 24px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.avvance-loan-card-header {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 4px;
}

.avvance-loan-monthly {
    font-size: 28px;
    font-weight: 700;
    color: #001E79;
    white-space: nowrap;
}

.avvance-loan-monthly .avvance-price-suffix {
    font-size: 14px;
    font-weight: 400;
    color: #4c4c50;
}

.avvance-loan-apr-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #235AE4;
    white-space: nowrap;
}

.avvance-loan-details {
    font-size: 13px;
    color: #4c4c50;
    margin-top: 2px;
}

.avvance-loan-details span {
    margin-right: 16px;
}

/* PROMO Loan Card */
.avvance-loan-card--promo {
    padding: 0;
    overflow: hidden;
    gap: 0;
}

.avvance-promo-banner {
    background: #EEF6FF;
    color: #001E79;
    font-size: 14px;
    line-height: 22px;
    padding: 12px 24px;
}

.avvance-promo-banner strong {
    font-weight: 700;
}

.avvance-promo-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 24px 24px;
}

.avvance-loan-card-label {
    font-size: 13px;
    color: #4c4c50;
    margin: 0;
}

.avvance-loan-apr-badge--chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #EEF6FF;
    padding: 4px 10px;
    border-radius: 20px;
}

.avvance-toggletip-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
    line-height: 1;
}

.avvance-toggletip-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.avvance-toggletip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: #1d2333;
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    padding: 12px 16px;
    border-radius: 8px;
    width: 260px;
    z-index: 1000;
    white-space: normal;
    text-align: left;
    pointer-events: none;
}

.avvance-toggletip.is-visible {
    display: block;
    pointer-events: auto;
}

.avvance-promo-avoid-interest {
    font-size: 14px;
    color: #4c4c50;
    margin: 0;
}

.avvance-promo-avoid-amount {
    color: #235AE4;
    font-weight: 700;
}

/* Primary Button */
.avvance-btn-primary {
    background: #235AE4;
    color: #fff;
    width: 100%;
    height: 56px;
    padding: 12px 32px;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 700;
    line-height: 32px;
    cursor: pointer;
}

.avvance-btn-primary:hover {
    background: #1a47b8;
}

/* Carousel Section */
.avvance-carousel-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.avvance-carousel-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 32px;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.avvance-carousel-nav {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.avvance-carousel-container {
    background: #fff;
    border: 1px solid #d6d6d9;
    border-radius: 8px;
    padding: 24px;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.avvance-slide {
    display: none;
    width: 100%;
    align-items: flex-start;
    gap: 8px;
    animation: avvanceFadeIn 0.25s ease;
}

.avvance-slide.active {
    display: flex;
}

@keyframes avvanceFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.avvance-step-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.avvance-step-text {
    font-size: 16px;
    line-height: 25.6px;
    letter-spacing: 0.16px;
    color: #4c4c50;
}

/* Carousel Arrow Navigation */
.avvance-arrow-nav {
    background: #fff;
    border: 1px solid #d6d6d9;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #4c4c50;
    font-size: 18px;
    line-height: 1;
    user-select: none;
    transition: background 0.2s;
    appearance: none;
    -webkit-appearance: none;
    padding: 0;
    flex-shrink: 0;
}

.avvance-arrow-nav:hover {
    background: #f0f0f0;
}

.avvance-slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.avvance-dot {
    width: 8px;
    height: 8px;
    background-color: #d6d6d9;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}

.avvance-dot.active {
    background-color: #7f7f84;
    width: 10px;
    height: 10px;
}

/* Disclaimer */
.avvance-disclaimer {
    font-size: 12px;
    line-height: 19.2px;
    letter-spacing: 0.12px;
    color: #4c4c50;
    margin: 0;
}

.avvance-learn-more {
    color: #235AE4;
    text-decoration: none;
}

.avvance-learn-more:hover {
    text-decoration: underline;
}

/* Success Banner (Modal C) */
.avvance-success-banner {
    background: #fff;
    border: 1px solid #d6d6d9;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.avvance-success-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 32px;
    color: #000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.avvance-success-check-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.avvance-success-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    line-height: 22px;
    color: #4c4c50;
}

.avvance-success-text,
.avvance-success-expiry {
    font-size: 16px;
    line-height: 25.6px;
    letter-spacing: 0.16px;
    color: #4c4c50;
    margin: 0;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

@media (max-width: 768px) {
    .avvance-product-widget,
    .avvance-cart-widget {
        font-size: 13px;
    }

    .avvance-category-widget {
        font-size: 11px;
    }

    .avvance-logo-inline {
        height: 16px;
    }

    .avvance-logo-small {
        height: 14px;
    }

    .avvance-checkout-banner {
        padding: 10px 12px;
    }

    .avvance-checkout-preapproved {
        align-items: flex-start;
    }

    .avvance-modal-scrollable {
        padding: 24px 20px 32px;
        gap: 32px;
    }

    .avvance-modal-scrollable--has-cta {
        padding-bottom: 80px;
    }

    .avvance-modal-sticky-cta {
        padding: 12px 20px;
    }

    .avvance-modal-heading {
        font-size: 22px;
        line-height: 1.3;
    }

}

@media (max-width: 600px) {
    .avvance-modal-dialog {
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    @keyframes avvanceSlideDown {
        from {
            transform: translateY(24px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

@media (max-width: 480px) {
    .avvance-logo-inline {
        height: 14px;
    }

    .avvance-modal-heading {
        font-size: 20px;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.avvance-hidden {
    display: none !important;
}

.avvance-loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}