/* Shared Financing Plan Cards — used by homepage + Credit by Avedson */

/* ═══ Financing Plan Cards - Mobile First ═══ */
.fp-card {
    background: #fff;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
    .fp-card:hover {
        box-shadow: 0 12px 28px rgba(0,0,0,0.12);
        transform: translateY(-3px);
    }
    .fp-card:hover .fp-card-img {
        transform: scale(1.05);
    }
}
.fp-card-img-wrap {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: #f8fafc;
    aspect-ratio: 1 / 0.85;
}
.fp-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
    padding: 0.75rem !important;
}
/* Extra-small devices (320px - 374px) */
@media (max-width: 374.98px) {
    .fp-card-img-wrap {
        height: 100px;
        aspect-ratio: 1 / 0.9;
    }
    .fp-card-img {
        padding: 0.5rem !important;
    }
    .fp-card {
        border-radius: 0.75rem;
    }
    .fp-card-body {
        padding: 8px;
    }
    .fp-card-title {
        font-size: 0.7rem;
        margin-bottom: 3px;
    }
    .fp-spec-pill {
        font-size: 0.5rem;
        padding: 0px 4px;
    }
    .fp-installment-label {
        font-size: 0.5rem;
    }
    .fp-term-select {
        font-size: 0.55rem;
        padding: 1px 14px 1px 3px;
        max-width: 80px;
        height: 20px;
    }
    .fp-price-main {
        font-size: 1.15rem;
    }
    .fp-price-suffix {
        font-size: 0.55rem;
    }
    .fp-downpayment,
    .fp-cash-price {
        font-size: 0.55rem;
    }
    .fp-buy-btn {
        width: 28px;
        height: 28px;
        flex: 0 0 28px;
    }
    .fp-buy-btn i {
        font-size: 0.5rem;
    }
    .fp-apply-btn {
        font-size: 0.6rem;
        padding: 6px;
    }
    .fp-btn-group {
        gap: 4px;
    }
}
.fp-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 50rem;
    padding: 2px 8px;
    font-size: 0.6rem;
    font-weight: 600;
    color: #334155;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.fp-card-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.fp-card-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}
.fp-card-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 4px;
}
.fp-spec-pill {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.55rem;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 50rem;
    white-space: nowrap;
}
.fp-card-divider {
    margin: 6px 0;
    border-color: #e2e8f0;
    opacity: 0.6;
}
.fp-installment-section {
    margin-bottom: 8px;
}

.fp-installment-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: #0046be;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.fp-term-select {
    font-size: 0.6rem;
    padding: 2px 18px 2px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #334155;
    background: #fff;
    cursor: pointer;
    appearance: auto;
    max-width: 110px;
}
.fp-term-static {
    font-size: 0.7rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    line-height: 1.2;
}
.fp-term-control {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
#installment-grid .fp-term-select,
#installment-grid .fp-plan-sel {
    max-width: 160px;
}
@media (min-width: 768px) {
    #installment-grid .fp-term-select,
    #installment-grid .fp-plan-sel {
        max-width: 220px;
        font-size: 0.7rem;
    }
}
.fp-term-select:focus {
    outline: none;
    border-color: #0046be;
    box-shadow: 0 0 0 2px rgba(0,70,190,0.15);
}
.fp-price-main {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0046be;
    line-height: 1.1;
    margin-top: 2px;
}
.fp-price-suffix {
    font-size: 0.6rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 4px;
}
.fp-downpayment {
    font-size: 0.6rem;
    color: #475569;
    margin-bottom: 2px;
}
.fp-cash-price {
    font-size: 0.6rem;
    color: #94a3b8;
    margin-bottom: 6px;
}
.fp-strikethrough {
    text-decoration: line-through;
}
.fp-btn-group {
    display: flex;
    gap: 6px;
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
    align-items: stretch;
}
.fp-buy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: #ffc107;
    color: #0f172a;
    font-size: 0;
    font-weight: 600;
    border: 1.5px solid #ffc107;
    border-radius: 50%;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}
.fp-buy-btn:hover {
    border-color: #e0a800;
    color: #0f172a;
    background: #e0a800;
}
.fp-buy-btn i {
    font-size: 0.6rem;
    margin: 0;
}
.fp-apply-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    padding: 8px;
    background: #16a34a;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}
.fp-apply-btn:hover {
    background: #15803d;
    color: #fff;
}
.fp-apply-btn i {
    font-size: 0.55rem;
    transition: transform 0.2s;
}
.fp-apply-btn:hover i {
    transform: translateX(2px);
}
.fp-layaway-note {
    text-align: center;
    font-size: 0.55rem;
    color: #94a3b8;
    margin-top: 6px;
}
.fp-layaway-note i {
    margin-right: 2px;
}

/* Small mobile (375px - 575px) */
@media (min-width: 375px) and (max-width: 575.98px) {
    .fp-card-img-wrap {
        height: 130px;
        aspect-ratio: 1 / 0.8;
    }
    .fp-card-img {
        padding: 0.75rem !important;
    }
    .fp-card {
        border-radius: 0.875rem;
    }
    .fp-card-body {
        padding: 10px;
    }
    .fp-card-title {
        font-size: 0.75rem;
    }
    .fp-price-main {
        font-size: 1.25rem;
    }
}

/* FP Cards — Tablet (576px+) */
@media (min-width: 576px) {
    .fp-card-img-wrap { height: 170px; aspectratio: auto; }
    .fp-card-body { padding: 12px; }
    .fp-card-title { font-size: 0.85rem; }
    .fp-spec-pill { font-size: 0.6rem; padding: 2px 8px; }
    .fp-card-badge { font-size: 0.65rem; padding: 3px 10px; }
    .fp-installment-label { font-size: 0.6rem; }
    .fp-term-select { font-size: 0.6rem; max-width: 90px; height: 22px; padding: 1px 16px 1px 5px; }
    .fp-price-main { font-size: 1.5rem; }
    .fp-price-suffix { font-size: 0.65rem; }
    .fp-downpayment { font-size: 0.65rem; }
    .fp-cash-price { font-size: 0.65rem; }
    .fp-buy-btn { font-size: 0; width: 36px; height: 36px; padding: 0; flex: 0 0 36px; border-radius: 50%; gap: 0; }
    .fp-buy-btn i { font-size: 0.65rem; margin: 0; }
    .fp-apply-btn { font-size: 0.75rem; padding: 10px; border-radius: 12px; }
    .fp-layaway-note { font-size: 0.6rem; }
}

/* FP Cards — Desktop (768px+) */
@media (min-width: 768px) {
    .fp-card-img-wrap { height: 190px; }
    .fp-card-body { padding: 14px; }
    .fp-card-title { font-size: 0.9rem; }
    .fp-spec-pill { font-size: 0.65rem; }
    .fp-card-badge { font-size: 0.7rem; }
    .fp-installment-label { font-size: 0.65rem; }
    .fp-term-select { font-size: 0.7rem; padding: 3px 20px 3px 8px; }
    .fp-price-main { font-size: 1.65rem; }
    .fp-price-suffix { font-size: 0.7rem; }
    .fp-downpayment { font-size: 0.7rem; }
    .fp-cash-price { font-size: 0.7rem; }
    .fp-buy-btn { font-size: 0; width: 40px; height: 40px; padding: 0; flex: 0 0 40px; border-radius: 50%; gap: 0; }
    .fp-buy-btn i { font-size: 0.7rem; margin: 0; }
    .fp-apply-btn { font-size: 0.8rem; padding: 10px 14px; }
    .fp-layaway-note { font-size: 0.65rem; }
}

/* FP Cards — Large Desktop (992px+) */
@media (min-width: 992px) {
    .fp-card-img-wrap { height: 210px; }
    .fp-card-body { padding: 16px; }
    .fp-card-title { font-size: 0.95rem; }
    .fp-price-main { font-size: 1.8rem; }
    .fp-buy-btn { font-size: 0; width: 40px; height: 40px; padding: 0; flex: 0 0 40px; border-radius: 50%; gap: 0; }
    .fp-buy-btn i { font-size: 0.75rem; margin: 0; }
    .fp-apply-btn { font-size: 0.85rem; padding: 12px 16px; }
}

/* FP Cards — XL Desktop: restore full text button (1024px+) */
@media (min-width: 1024px) {
    .fp-buy-btn { font-size: 0.75rem; width: auto; height: auto; padding: 10px 16px; flex: 0 0 auto; border-radius: 10px; gap: 4px; }
    .fp-buy-btn i { font-size: 0.5rem; }
}

/* ─── View Toggle Buttons ─── */
.view-toggle {
    color: #6c757d;
    border: none !important;
    background: transparent;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem !important;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: rgba(0,70,190,0.1);
    touch-action: manipulation;
    cursor: pointer;
}
.view-toggle.active {
    background: #0046be !important;
    color: #fff !important;
    box-shadow: 0 1px 3px rgba(0,70,190,0.3);
}
.view-toggle:hover:not(.active) {
    color: #0046be;
    background: rgba(0,70,190,0.08);
}
.view-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,70,190,0.25);
}

/* ═══ Financing Plan Cards — List View ═══ */
:is(#fp-products-container, #installment-grid).list-view {
    display: flex !important;
    flex-direction: column !important;
}
:is(#fp-products-container, #installment-grid).list-view > .col-6,
:is(#fp-products-container, #installment-grid).list-view > [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}
:is(#fp-products-container, #installment-grid).list-view .fp-card {
    flex-direction: row;
    border-radius: 0.75rem;
}
:is(#fp-products-container, #installment-grid).list-view .fp-card-img-wrap {
    width: 130px;
    min-width: 130px;
    max-width: 130px;
    height: auto;
    min-height: 130px;
    flex-shrink: 0;
    border-radius: 0.75rem 0 0 0.75rem;
}
:is(#fp-products-container, #installment-grid).list-view .fp-card-img {
    height: 100%;
    padding: 0.75rem !important;
}
:is(#fp-products-container, #installment-grid).list-view .fp-card-badge {
    font-size: 0.55rem;
    padding: 2px 6px;
    top: 4px;
    left: 4px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-card-body {
    padding: 10px;
    flex: 1;
}
:is(#fp-products-container, #installment-grid).list-view .fp-card-title {
    font-size: 0.8rem;
    -webkit-line-clamp: 1;
    margin-bottom: 2px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-card-divider {
    margin: 4px 0;
}
:is(#fp-products-container, #installment-grid).list-view .fp-installment-section {
    margin-bottom: 4px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-price-main {
    font-size: 1.15rem;
}
:is(#fp-products-container, #installment-grid).list-view .fp-price-suffix {
    font-size: 0.55rem;
    margin-bottom: 2px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-downpayment,
:is(#fp-products-container, #installment-grid).list-view .fp-cash-price {
    font-size: 0.55rem;
    margin-bottom: 1px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-btn-group {
    gap: 4px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-buy-btn {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-apply-btn {
    padding: 6px 8px;
    font-size: 0.65rem;
    border-radius: 8px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-layaway-note {
    font-size: 0.5rem;
    margin-top: 4px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-term-select {
    font-size: 0.55rem;
    padding: 1px 14px 1px 4px;
}
:is(#fp-products-container, #installment-grid).list-view .fp-installment-label {
    font-size: 0.5rem;
}
@media (min-width: 576px) {
    :is(#fp-products-container, #installment-grid).list-view .fp-card-img-wrap {
        width: 150px;
        min-width: 150px;
        max-width: 150px;
        min-height: 150px;
    }
    :is(#fp-products-container, #installment-grid).list-view .fp-card-title { font-size: 0.85rem; }
    :is(#fp-products-container, #installment-grid).list-view .fp-price-main { font-size: 1.3rem; }
    :is(#fp-products-container, #installment-grid).list-view .fp-buy-btn { width: 34px; height: 34px; flex: 0 0 34px; }
    :is(#fp-products-container, #installment-grid).list-view .fp-apply-btn { font-size: 0.7rem; padding: 8px 10px; }
}
@media (min-width: 768px) {
    :is(#fp-products-container, #installment-grid).list-view .fp-card-img-wrap {
        width: 170px;
        min-width: 170px;
        max-width: 170px;
        min-height: 160px;
    }
    :is(#fp-products-container, #installment-grid).list-view .fp-card-body { padding: 12px; }
    :is(#fp-products-container, #installment-grid).list-view .fp-card-title { font-size: 0.9rem; -webkit-line-clamp: 2; }
    :is(#fp-products-container, #installment-grid).list-view .fp-price-main { font-size: 1.45rem; }
    :is(#fp-products-container, #installment-grid).list-view .fp-downpayment,
    :is(#fp-products-container, #installment-grid).list-view .fp-cash-price { font-size: 0.6rem; }
    /* Content-sized CTAs, right-aligned — avoid Apply Now stretching full width */
    :is(#fp-products-container, #installment-grid).list-view .fp-btn-group {
        justify-content: flex-end;
        align-items: center;
        gap: 8px;
        width: 100%;
    }
    :is(#fp-products-container, #installment-grid).list-view .fp-buy-btn {
        width: auto;
        height: auto;
        min-height: 36px;
        flex: 0 0 auto;
        padding: 8px 14px;
        border-radius: 8px;
        font-size: 0.75rem;
        gap: 6px;
        white-space: nowrap;
    }
    :is(#fp-products-container, #installment-grid).list-view .fp-buy-btn i {
        font-size: 0.7rem;
        margin: 0;
    }
    :is(#fp-products-container, #installment-grid).list-view .fp-buy-btn .fp-buy-btn-label {
        display: inline !important;
    }
    :is(#fp-products-container, #installment-grid).list-view .fp-apply-btn {
        flex: 0 0 auto;
        width: auto;
        min-height: 36px;
        font-size: 0.75rem;
        padding: 8px 18px;
        white-space: nowrap;
    }
}

/* Grid: equal-height financing cards (isolated from product-card CSS) */
:is(#fp-products-container, #installment-grid):not(.list-view) > [class*="col-"] {
    display: flex;
}
:is(#fp-products-container, #installment-grid):not(.list-view) .fp-card {
    width: 100%;
}
:is(#fp-products-container, #installment-grid):not(.list-view) .fp-card-body {
    flex: 1 1 auto;
    min-width: 0;
}
:is(#fp-products-container, #installment-grid):not(.list-view) .fp-btn-group {
    margin-top: auto;
    width: 100%;
}

/* Installment page: compact card footer — kill the equal-height white gap */
#installment-grid .fp-card-footer {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}
#installment-grid .fp-card-footer-meta {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem 0.5rem;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}
#installment-grid .fp-layaway-note {
    margin-top: 0;
    line-height: 1.2;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
}
#installment-grid .fp-compare-link {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-bottom: 0;
    line-height: 1.2;
    padding: 0;
    white-space: nowrap;
    flex: 0 0 auto;
}
@media (max-width: 575.98px) {
    #installment-grid .fp-card-footer-meta {
        gap: 0.2rem 0.35rem;
    }
    #installment-grid .fp-layaway-note {
        font-size: 0.5rem;
    }
    #installment-grid .fp-compare-link {
        font-size: 0.5rem;
    }
}
#installment-grid .fp-installment-section {
    margin-bottom: 0;
}
#installment-grid .fp-cash-price {
    margin-bottom: 0;
}
#installment-grid:not(.list-view) .fp-btn-group {
    margin-top: 0; /* was auto — caused the large empty band above CTAs */
    width: 100%;
}
/* Keep "Apply Now" on one line in 2-col mobile cards */
@media (max-width: 575.98px) {
    #installment-grid .fp-btn-group {
        gap: 4px;
    }
    #installment-grid .fp-buy-btn.fp-custom-term-btn {
        padding: 6px 8px !important;
        min-height: 32px;
        font-size: 0.6rem !important;
    }
    #installment-grid .fp-apply-btn {
        white-space: nowrap;
        font-size: 0.62rem;
        padding: 6px 8px;
        gap: 3px;
        flex: 1 1 auto;
        line-height: 1.2;
    }
    #installment-grid .fp-apply-btn i {
        font-size: 0.5rem;
        flex-shrink: 0;
    }
}
/* Content-sized cards: no mt-auto spacer. Prefer density over equal footers. */
#installment-grid:not(.list-view) .fp-card-footer {
    margin-top: 0.5rem;
}

/* Installment page: Custom Term button — readable on mobile (not empty yellow circle) */
#installment-grid .fp-buy-btn.fp-custom-term-btn,
#installment-grid.list-view .fp-buy-btn.fp-custom-term-btn,
:is(#fp-products-container, #installment-grid).list-view .fp-buy-btn.fp-custom-term-btn {
    flex: 0 0 auto;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    min-height: 34px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.65rem !important;
    font-weight: 700;
    gap: 4px;
    color: #0f172a;
    white-space: nowrap;
    align-self: stretch;
}
#installment-grid .fp-buy-btn.fp-custom-term-btn i,
#installment-grid.list-view .fp-buy-btn.fp-custom-term-btn i,
:is(#fp-products-container, #installment-grid).list-view .fp-buy-btn.fp-custom-term-btn i {
    font-size: 0.7rem !important;
    line-height: 1;
    margin: 0;
}
#installment-grid .fp-custom-term-label-short {
    display: inline;
}
#installment-grid .fp-custom-term-label-full {
    display: none;
}
@media (min-width: 576px) {
    #installment-grid .fp-buy-btn.fp-custom-term-btn,
    #installment-grid.list-view .fp-buy-btn.fp-custom-term-btn,
    :is(#fp-products-container, #installment-grid).list-view .fp-buy-btn.fp-custom-term-btn {
        min-height: 36px;
        padding: 8px 12px;
        font-size: 0.7rem !important;
    }
}
@media (min-width: 768px) {
    #installment-grid .fp-custom-term-label-short {
        display: none;
    }
    #installment-grid .fp-custom-term-label-full {
        display: inline;
    }
    #installment-grid .fp-buy-btn.fp-custom-term-btn,
    #installment-grid.list-view .fp-buy-btn.fp-custom-term-btn,
    :is(#fp-products-container, #installment-grid).list-view .fp-buy-btn.fp-custom-term-btn {
        min-height: 36px;
        padding: 8px 14px;
        font-size: 0.75rem !important;
        gap: 6px;
    }
}

/* Installment page: Custom Term button shares Buy Now chrome */
.fp-buy-btn.request-custom-term-btn {
    font-family: inherit;
}
.fp-compare-link {
    display: block;
    text-align: center;
    font-size: 0.6rem;
    color: #64748b;
    margin-bottom: 6px;
    text-decoration: none;
}
.fp-compare-link:hover {
    color: #0046be;
}
