/* ============================================================================
   Windoow - Configurator Premium Animations
   Tutto compositor-friendly (transform + opacity).
   Target Lighthouse Performance >= 95.
   ============================================================================ */

/* --- Common visually-hidden (radio inputs nascosti ma a11y-friendly) --- */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ============================================================================
   <x-config-card>
   ============================================================================ */
.config-card-wrapper {
    position: relative;
    height: 100%;
}

.config-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1.25rem 1rem;
    border: 2px solid #e9e9e9;
    border-radius: 14px;
    background: #ffffff;
    cursor: pointer;
    text-align: center;
    height: 100%;
    margin: 0;
    position: relative;
    overflow: hidden;
    transition:
        transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 250ms ease,
        border-color 250ms ease,
        background 250ms ease;
}

.config-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    border-color: #c8c8c8;
}

.config-card-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    width: 100%;
}

.config-card-image {
    max-width: 100%;
    object-fit: contain;
}

.config-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.config-card-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: #5a5a5a;
}

.config-card-tick {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #0087a2;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition:
        opacity 200ms ease,
        transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.config-card-input:checked + .config-card {
    border-color: #0087a2;
    background: linear-gradient(135deg, rgba(0, 135, 162, 0.04) 0%, rgba(0, 135, 162, 0.10) 100%);
    transform: scale(1.02);
    box-shadow: 0 10px 24px rgba(0, 135, 162, 0.18);
}

.config-card-input:checked + .config-card .config-card-tick {
    opacity: 1;
    transform: scale(1);
}

.config-card-input:focus-visible + .config-card {
    outline: 3px solid #0087a2;
    outline-offset: 4px;
}

/* ============================================================================
   <x-color-swatch>
   ============================================================================ */
.color-swatch-wrapper {
    position: relative;
    height: 100%;
}

.color-swatch {
    display: block;
    cursor: pointer;
    margin: 0;
    text-align: center;
    transition: transform 200ms ease;
}

.color-swatch:hover {
    transform: scale(1.05);
}

.color-swatch-image-wrap {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e9e9e9;
    aspect-ratio: 1 / 1;
    transition:
        border-color 200ms ease,
        box-shadow 200ms ease;
}

.color-swatch-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.color-swatch-tick {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition:
        opacity 200ms ease,
        transform 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.color-swatch-input:checked + .color-swatch .color-swatch-image-wrap {
    border-color: #0087a2;
    box-shadow: 0 0 0 3px rgba(0, 135, 162, 0.25);
}

.color-swatch-input:checked + .color-swatch .color-swatch-tick {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.color-swatch-input:focus-visible + .color-swatch .color-swatch-image-wrap {
    outline: 3px solid #0087a2;
    outline-offset: 3px;
}

.color-swatch-name {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.3;
}

/* ============================================================================
   Pricing live count-up animation
   ============================================================================ */
#js-total-amount.is-updating,
#js-sticky-total.is-updating {
    animation: count-up-pulse 280ms ease-out;
}

@keyframes count-up-pulse {
    0%   { transform: scale(1);    color: #1a1a1a; }
    50%  { transform: scale(1.06); color: #0087a2; }
    100% { transform: scale(1);    color: #1a1a1a; }
}

/* ============================================================================
   Step content enter animation (staggered fade-in)
   ============================================================================ */
.configurator-content > * {
    animation: step-enter 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.configurator-content > *:nth-child(1) { animation-delay: 0ms; }
.configurator-content > *:nth-child(2) { animation-delay: 80ms; }
.configurator-content > *:nth-child(3) { animation-delay: 160ms; }
.configurator-content > *:nth-child(4) { animation-delay: 240ms; }
.configurator-content > *:nth-child(5) { animation-delay: 320ms; }

@keyframes step-enter {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   Sticky price bar (mobile only)
   ============================================================================ */
.sticky-price-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    padding: 0.75rem 0;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08);
    animation: sticky-enter 380ms ease-out 200ms both;
}

@keyframes sticky-enter {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.sticky-price-label {
    font-size: 0.65rem;
    color: #5a5a5a;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.1rem;
    line-height: 1.2;
}

.sticky-price-total {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.sticky-price-rate {
    font-size: 0.7rem;
    color: #0087a2;
    margin-top: 0.1rem;
    line-height: 1.3;
}

.sticky-price-rate strong {
    font-weight: 700;
}

/* Padding-bottom dinamico per non nascondere contenuto sotto la sticky bar */
@media (max-width: 991.98px) {
    body { padding-bottom: 110px; }
}

/* ============================================================================
   Progress bar animation
   ============================================================================ */
.progress-bar {
    transition: width 480ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ============================================================================
   Form: floating label per input misure (step 1)
   ============================================================================ */
.form-floating-windoow {
    position: relative;
}
.form-floating-windoow input:focus,
.form-floating-windoow input:not(:placeholder-shown) {
    border-color: #0087a2;
    box-shadow: 0 0 0 3px rgba(0, 135, 162, 0.12);
}

/* ============================================================================
   Accessibility: respect user motion preferences
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
