/**
 * GOOBIKE-6073: Souba FAB widget styles
 * Floating Action Button + Overlay + Card for kaitori souba form
 * Shared between PC (souba_fab.html) and SMP (souba_fab_smp.html)
 */

/* Floating Button */
.tradein-floating-btn {
    background-image: url('/common/img/kaitori_form/icon_circle_souba.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
    position: fixed;
    bottom: 20px;
    right: 30px;
    width: 100px;
    height: 100px;
    box-shadow: 0 4px 12px rgba(0, 57, 180, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9990;
    text-decoration: none;
    border: none;
    overflow: hidden;
}

@media (hover: hover) {
    .tradein-floating-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(0, 57, 180, 0.5);
    }
}

.tradein-floating-btn:active {
    transform: scale(0.98);
}
.tradein-floating-btn:focus {
    outline: none;
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 57, 180, 0.4);
}

/* Attention pulse: expanding double "sonar" ring to draw the user's eye.
   Uses box-shadow (not transform), so it is not clipped by overflow:hidden
   and does not conflict with the :hover / :active scale feedback above. */
@keyframes soubaFabPulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 57, 180, 0.55), 0 0 0 0 rgba(0, 57, 180, 0.35); }
    50%  { box-shadow: 0 0 0 12px rgba(0, 57, 180, 0),  0 0 0 0 rgba(0, 57, 180, 0.35); }
    100% { box-shadow: 0 0 0 24px rgba(0, 57, 180, 0),  0 0 0 16px rgba(0, 57, 180, 0); }
}
.tradein-floating-btn {
    /* animation: soubaFabPulse 1.8s ease-out infinite; */
    /* promote to own compositor layer: animating box-shadow repaints every
       frame, and during scroll the browser re-rasterizes the button at a
       lower resolution, blurring the SVG icon. A dedicated layer keeps the
       icon crisp while scrolling. */
    will-change: box-shadow;
    backface-visibility: hidden;
}
@media (prefers-reduced-motion: reduce) {
    .tradein-floating-btn {
        animation: none;
        will-change: auto;
    }
}

/* Overlay */
.souba-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9990;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding-right: 45px;
    padding-bottom: 140px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.souba-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* Card */
.souba-card {
    background: #fff;
    border: 2px solid #1a3a6b;
    border-radius: 14px;
    padding: 1.1rem 1.1rem 1.4rem;
    width: 250px;
    position: relative;
    transform: translateY(10px) scale(0.97);
    transition: transform 0.2s ease;
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}
.souba-overlay.open .souba-card {
    transform: translateY(0) scale(1);
}

/* Arrow pointing down-right toward FAB */
.souba-card::after {
    content: '';
    position: absolute;
    bottom: -15px;
    right: 24px;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-top: 15px solid #1a3a6b;
}
.souba-card::before {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 25px;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #fff;
    z-index: 1;
}

/* Close button */
.souba-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #1a3a6b;
    font-size: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    padding: 0;
}
.souba-close:hover { background: #f5f5f5; }

.souba-close::before,
.souba-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    background: #1a3a6b;
    border-radius: 1px;
}
.souba-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}
.souba-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Title */
.souba-title {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: #1a3a6b;
    margin-bottom: 0.9rem;
}
.souba-title-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    margin-right: 7px;
}

.souba-title-icon img {
    width: 100%;
    height: auto;
}

/* Card overrides for tradein-price inside souba popup */
.souba-card .card-tradein-price {
    padding-top: 0;
}
.souba-card .card-tradein-price .box-simulation__container {
    border: none;
}
.souba-card .card-tradein-price .box-simulation__body {
    padding: 0;
}

/* Check item inside souba card */
.souba-card .check-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
}

.souba-card .check-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 1.5px solid #aaa;
    border-radius: 4px;
    cursor: pointer;
    accent-color: #1a3a6b;
    margin-top: 5px;
    margin-right: 12px;
}

.souba-card .check-item label {
    cursor: pointer;
    line-height: 1.55;
}

.souba-card .check-item .main-text {
    font-size: 14px;
    color: #222;
    display: block;
}

.souba-card .check-item .note-text {
    font-size: 12px;
    color: #e02020;
    display: block;
    margin-top: 4px;
}

.souba-card .card-tradein-price .box-simulation__body .box-simulation__form {
    gap: unset;
}

.souba-card .card-tradein-price .box-simulation__body .box-simulation__form .select2-container {
    margin-bottom: 9px;
}

.souba-card .card-tradein-price .box-simulation__body .box-simulation__form .select2-container:last-of-type {
    margin-bottom: 0;
}

.summary .tradein-floating-btn,
.summary .souba-overlay {
    z-index: 99;
}

/* SMP responsive overrides */
@media screen and (max-width: 768px) {
    .summary .tradein-floating-btn {
        bottom: 10px;
        right: 15px;
        width: 85px;
        height: 85px;
        box-shadow: none;
        background-size: 99%;
    }

    .summary .souba-overlay {
        padding-right: 25px;
        padding-bottom: 115px;
    }

    .souba-card .sticky-banner__text {
        font-size: .7rem;
    }

    .souba-card .card-tradein-price .box-simulation__body .box-simulation__cta {
        margin-bottom: 0;
    }

    .souba-card .card-tradein-price .box-simulation__body .box-simulation__cta-btn {
        height: 46px;
    }

    .souba-card .card-tradein-price .box-simulation__body .box-simulation__form {
        margin-bottom: 0;
    }

    .souba-card .sticky-banner__text img {
        margin-top: -3px;
    }
}

/* Iphone SE 2nd, Iphone 6/6s */
@media only screen and (min-width: 375px) and (max-width: 767px) {
    .souba-title {
        margin-bottom: 0;
        font-size: 16px;
    }

    .souba-card {
        padding-bottom: 1rem;
    }

    .summary .tradein-floating-btn {
        width: 75px;
        height: 75px;
    }

    .summary .souba-overlay {
        padding-right: 20px;
        padding-bottom: 105px;
    }

    .souba-card .card-tradein-price .box-simulation__body .box-simulation__cta-btn {
        height: 40px;
    }
}

@media (max-height: 500px) {
    .souba-overlay,
    .summary .souba-overlay {
        padding-top: 60px;
    }
    .souba-card {
        box-sizing: border-box;
        max-height: 100%;
        display: flex;
        flex-direction: column;
        width: 50%
    }
    .souba-card .souba-title { flex-shrink: 0; }
    .souba-card .card-tradein-price {
        overflow-y: auto;
        min-height: 0;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}
