:root {
    --font-main: 'Ramabhadra', sans-serif;
    --font-secondary: 'Inter', sans-serif;

    --color-primary: #9F0909;
    --color-background: #E5E8E8;
    --color-background-card: #F7E7CE;
    --color-text: #242424;
}

.hidden {
    display: none;
}

/* ===================== */
/* POPUP                 */
/* ===================== */

.popup-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background:
        radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.16), transparent 45%),
        radial-gradient(circle at 80% 85%, rgba(255, 255, 255, 0.12), transparent 40%),
        rgba(8, 12, 24, 0.58);
    backdrop-filter: blur(12px);
    z-index: 9999;
}

@keyframes popupEnter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup {
    width: min(1120px, 95vw);
    min-height: 650px;
    max-height: 92vh;
    border-radius: 28px;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.46);
    backdrop-filter: blur(24px) saturate(165%);
    -webkit-backdrop-filter: blur(24px) saturate(165%);
    box-shadow:
        0 26px 56px rgba(2, 8, 23, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.76),
        inset 0 -1px 0 rgba(255, 255, 255, 0.16);
    position: relative;
    display: flex;
    flex-direction: row;
    color: var(--color-text);
    overflow: hidden auto;
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    scroll-behavior: smooth;
}

.popup-overlay.is-open .popup {
    animation: popupEnter 320ms cubic-bezier(0.2, 0.75, 0.2, 1) forwards;
}

.popup::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        linear-gradient(
            -45deg,
            rgba(255, 255, 255, 0.58) 0%,
            rgba(255, 255, 255, 0.14) 30%,
            rgba(255, 255, 255, 0.06) 52%,
            rgba(255, 255, 255, 0.20) 75%,
            rgba(255, 255, 255, 0.08) 100%
        );
    mix-blend-mode: screen;
    opacity: 0.86;
}

.popup::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    pointer-events: none;
    background:
        radial-gradient(
            circle at 72% 18%,
            rgba(255, 255, 255, 0.74),
            rgba(255, 255, 255, 0.20) 25%,
            transparent 55%
        );
    opacity: 0.5;
}

.popup > * {
    position: relative;
    z-index: 1;
}

.popup-close {
    position: absolute;
    top: 32px;
    right: 60px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.72);
    font-size: 26px;
    line-height: 1;
    color: rgba(15, 23, 42, 0.86);
    cursor: pointer;
    z-index: 20;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

.popup-close:hover {
    background: rgba(255, 255, 255, 0.82);
    transform: translateY(-1px) scale(1.03);
}

/* ===================== */
/* INFO — FRAME FIGMA    */
/* 270 x 570             */
/* ===================== */

.general_info {
    position: absolute;
    top: 42px;
    left: 24px;
    width: 248px;
    color: rgba(15, 23, 42, 0.68);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px;
    border-radius: 18px;
    background:transparent !important;
    border: none !important;
    border-top: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.info {
    width: 270px;
    height: 610px;
    margin: 20px 0 0 20px;
    position: relative;
    flex: 0 0 270px;
    background:transparent !important;
    border: none !important;
    box-shadow: none;
    overflow: visible;
    border-radius: 28px;
}

/* contenitore animazione */
.social-motion {
    position: relative;
    width: 270px;
    height: 570px;
    overflow: hidden;
    background: transparent;
}

/* ===================== */
/* SOCIAL CARDS BASE     */
/* ===================== */

.social-card {
    --x: 0px;
    --y: 0px;
    --r: 0deg;
    --w: 100px;
    --h: 150px;
    --o: 1;
    --z: 1;
    --duration: 300ms;
    --ease: ease-in-out;

    position: absolute;
    left: 0;
    top: 0;

    width: var(--w);
    height: var(--h);

    opacity: var(--o);
    z-index: var(--z);

    border-radius: 15px;
    overflow: hidden;

    cursor: pointer;
    user-select: none;

    transform:
        translate(var(--x), var(--y))
        rotate(var(--r));

    transition:
        transform var(--duration) var(--ease),
        width var(--duration) var(--ease),
        height var(--duration) var(--ease),
        opacity var(--duration) var(--ease),
        box-shadow var(--duration) var(--ease);

    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

.social-motion.is-clicking .social-card {
    --duration: 300ms;
    --ease: ease-in-out;
}

.social-motion.is-spring .social-card {
    --duration: 800ms;
    --ease: cubic-bezier(0.22, 1.35, 0.36, 1);
}

.social-card:focus-visible {
    outline: 3px solid rgba(159, 9, 9, 0.35);
    outline-offset: 4px;
}

/* ===================== */
/* BACKGROUND CARDS      */
/* ===================== */

.linkedin-card {
    background: rgba(10, 102, 194, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.26);
}

.whatsapp-card {
    background: rgba(37, 211, 102, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.26);
}

.gmail-card {
    background:
        radial-gradient(
            circle at 50% 50%,
            rgba(251, 188, 4, 0.95) 0%,
            rgba(251, 188, 4, 0.45) 22%,
            rgba(255, 255, 255, 0.35) 58%,
            rgba(255, 255, 255, 0.55) 100%
        );
    border: 1px solid rgba(255, 255, 255, 0.26);
}

.instagram-card {
    background: linear-gradient(
        180deg,
        rgba(231, 37, 102, 0.62) 0%,
        rgba(131, 58, 180, 0.38) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.26);
}

/* ===================== */
/* CONTENUTO CARD        */
/* ===================== */

.image {
    position: absolute;
    inset: 0 0 auto 0;

    width: 100%;
    height: 100px;

    border-radius: 15px 15px 0 0;

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    opacity: 0;
    transform: translateY(10px);

    transition:
        opacity var(--duration) var(--ease),
        transform var(--duration) var(--ease);

    pointer-events: none;
}

.linkedin_image {
    background-image:
        linear-gradient(180deg, rgba(10, 102, 194, 0) 30%, #0A66C2 90%),
        url('../img/social/linkedin_profile.jpeg');
}

.whatsapp_image {
    background-image:
        linear-gradient(180deg, rgba(37, 211, 102, 0) 30%, #25D366 90%),
        url('../img/social/whatsapp_profile.jpeg');
}

.gmail_image {
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 90%),
        url('../img/social/gmail_profile.jpeg');
}

.instagram_image {
    background-image:
        linear-gradient(180deg, rgba(193, 53, 132, 0) 30%, rgb(192, 24, 125) 80%),
        url('../img/social/instagram_profile.jpeg');
}

.social_logo {
    position: absolute;

    width: 40px;
    height: 40px;

    top: 22px;
    left: 30px;

    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;

    opacity: 0.85;

    transition:
        top var(--duration) var(--ease),
        left var(--duration) var(--ease),
        width var(--duration) var(--ease),
        height var(--duration) var(--ease),
        opacity var(--duration) var(--ease);

    pointer-events: none;
}

.linkedin_logo {
    background-image: url('../img/social/linkedin.png');
}

.whatsapp_logo {
    background-image: url('../img/social/whatsapp.png');
}

.gmail_logo {
    background-image: url('../img/social/gmail.png');
}

.instagram_logo {
    background-image: url('../img/social/instagram.png');
}

.link {
    position: absolute;

    left: 0px;
    bottom: 0px;

    width: 100px;
    height: 25px;

    border-radius: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    text-decoration: none;
    font-size: 12px;
    line-height: 1;

    opacity: 0;
    transform: translateY(10px);

    transition:
        opacity var(--duration) var(--ease),
        transform var(--duration) var(--ease);

    pointer-events: none;

    z-index: 100;
}

.linkedin_link,
.whatsapp_link,
.gmail_link,
.instagram_link {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.74);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.18);
}

.linkedin_link {
    color: #0A66C2;
}

.whatsapp_link {
    color: #25D366;
}

.gmail_link {
    color: #F4B400;
}

.instagram_link {
    color: #C13584;
}

/* card attiva: immagine + link + ombra */
.social-motion[data-state="linkedin"] .linkedin-card,
.social-motion[data-state="whatsapp"] .whatsapp-card,
.social-motion[data-state="gmail"] .gmail-card,
.social-motion[data-state="instagram"] .instagram-card {
    box-shadow: 0 16px 24px rgba(15, 23, 42, 0.28);
}

.social-motion[data-state="linkedin"] .linkedin-card .image,
.social-motion[data-state="whatsapp"] .whatsapp-card .image,
.social-motion[data-state="gmail"] .gmail-card .image,
.social-motion[data-state="instagram"] .instagram-card .image {
    opacity: 1;
    transform: translateY(0);
}

.social-motion[data-state="linkedin"] .linkedin-card .link,
.social-motion[data-state="whatsapp"] .whatsapp-card .link,
.social-motion[data-state="gmail"] .gmail-card .link,
.social-motion[data-state="instagram"] .instagram-card .link {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.social-motion[data-state="linkedin"] .linkedin-card .social_logo,
.social-motion[data-state="whatsapp"] .whatsapp-card .social_logo,
.social-motion[data-state="gmail"] .gmail-card .social_logo,
.social-motion[data-state="instagram"] .instagram-card .social_logo {
    top: 70px;
    left: 25px;
    width: 50px;
    height: 50px;
    opacity: 1;
}

.social-motion[data-state="linkedin"] .linkedin-card {
    background: rgba(10, 102, 194, 1);
}

.social-motion[data-state="whatsapp"] .whatsapp-card {
    background: rgba(37, 211, 102, 1);
}

.social-motion[data-state="gmail"] .gmail-card {
    background: rgba(255, 255, 255, 1);
}

.social-motion[data-state="instagram"] .instagram-card {
    background: rgb(192, 24, 125)
}

/* ===================== */
/* FRAME 16 — LINKEDIN   */
/* ===================== */

.social-motion[data-state="linkedin"] .instagram-card {
    --x: 74px;
    --y: 252px;
    --r: -4deg;
    --z: 2;
}

.social-motion[data-state="linkedin"] .whatsapp-card {
    --x: 50px;
    --y: 318px;
    --r: -12deg;
    --z: 3;
}

.social-motion[data-state="linkedin"] .gmail-card {
    --x: 145px;
    --y: 295px;
    --r: 18deg;
    --z: 1;
}

.social-motion[data-state="linkedin"] .linkedin-card {
    --x: 95px;
    --y: 353px;
    --r: 0deg;
    --z: 10;
}

/* ============================= */
/* FRAME 17 — TRANSITION WA      */
/* ============================= */

.social-motion[data-state="transition-whatsapp"] .whatsapp-card {
    --x: 32px;
    --y: 278px;
    --r: -8deg;
    --w: 130px;
    --h: 200px;
    --z: 5;
}

.social-motion[data-state="transition-whatsapp"] .linkedin-card {
    --x: 37px;
    --y: 372px;
    --r: -12deg;
    --w: 130px;
    --h: 200px;
    --z: 2;
}

.social-motion[data-state="transition-whatsapp"] .instagram-card {
    --x: 145px;
    --y: 381px;
    --r: -4deg;
    --w: 130px;
    --h: 200px;
    --z: 3;
}

.social-motion[data-state="transition-whatsapp"] .gmail-card {
    --x: 142px;
    --y: 302px;
    --r: 0deg;
    --w: 130px;
    --h: 200px;
    --z: 1;
}

/* ===================== */
/* FRAME 18 — WHATSAPP   */
/* ===================== */

.social-motion[data-state="whatsapp"] .instagram-card {
    --x: 105px;
    --y: 300px;
    --r: -4deg;
    --z: 3;
}

.social-motion[data-state="whatsapp"] .linkedin-card {
    --x: 50px;
    --y: 316px;
    --r: -18deg;
    --z: 2;
}

.social-motion[data-state="whatsapp"] .gmail-card {
    --x: 150px;
    --y: 305px;
    --r: 15deg;
    --z: 1;
}

.social-motion[data-state="whatsapp"] .whatsapp-card {
    --x: 95px;
    --y: 350px;
    --r: 0deg;
    --z: 10;
}

/* ============================= */
/* FRAME 19 — TRANSITION GMAIL   */
/* ============================= */

.social-motion[data-state="transition-gmail"] .instagram-card {
    --x: 45px;
    --y: 345px;
    --r: -5deg;
    --w: 130px;
    --h: 200px;
    --z: 1;
}

.social-motion[data-state="transition-gmail"] .whatsapp-card {
    --x: 95px;
    --y: 340px;
    --r: -12deg;
    --w: 130px;
    --h: 200px;
    --z: 2;
}

.social-motion[data-state="transition-gmail"] .linkedin-card {
    --x: 148px;
    --y: 405px;
    --r: 8deg;
    --w: 130px;
    --h: 200px;
    --z: 3;
}

.social-motion[data-state="transition-gmail"] .gmail-card {
    --x: 122px;
    --y: 300px;
    --r: 15deg;
    --w: 130px;
    --h: 200px;
    --z: 5;
}

/* ===================== */
/* FRAME 20 — GMAIL      */
/* ===================== */

.social-motion[data-state="gmail"] .instagram-card {
    --x: 88px;
    --y: 293px;
    --r: -4deg;
    --z: 3;
}

.social-motion[data-state="gmail"] .whatsapp-card {
    --x: 40px;
    --y: 335px;
    --r: -12deg;
    --z: 2;
}

.social-motion[data-state="gmail"] .linkedin-card {
    --x: 147px;
    --y: 324px;
    --r: 14deg;
    --z: 4;
}

.social-motion[data-state="gmail"] .gmail-card {
    --x: 95px;
    --y: 356px;
    --r: 0deg;
    --z: 10;
}

/* ============================= */
/* FRAME 21 — TRANSITION IG      */
/* ============================= */

.social-motion[data-state="transition-instagram"] .instagram-card {
    --x: 102px;
    --y: 185px;
    --r: -4deg;
    --w: 130px;
    --h: 200px;
    --z: 5;
}

.social-motion[data-state="transition-instagram"] .linkedin-card {
    --x: 64px;
    --y: 318px;
    --r: -14deg;
    --w: 100px;
    --h: 150px;
    --z: 3;
}

.social-motion[data-state="transition-instagram"] .whatsapp-card {
    --x: 42px;
    --y: 377px;
    --r: -13deg;
    --w: 100px;
    --h: 150px;
    --z: 2;
}

.social-motion[data-state="transition-instagram"] .gmail-card {
    --x: 153px;
    --y: 360px;
    --r: 12deg;
    --w: 100px;
    --h: 150px;
    --z: 1;
}

/* ===================== */
/* FRAME 22 — INSTAGRAM  */
/* ===================== */

.social-motion[data-state="instagram"] .linkedin-card {
    --x: 126px;
    --y: 300px;
    --r: 8deg;
    --z: 3;
}

.social-motion[data-state="instagram"] .whatsapp-card {
    --x: 47px;
    --y: 318px;
    --r: -13deg;
    --z: 2;
}

.social-motion[data-state="instagram"] .gmail-card {
    --x: 90px;
    --y: 250px;
    --r: -12deg;
    --z: 1;
}

.social-motion[data-state="instagram"] .instagram-card {
    --x: 95px;
    --y: 350px;
    --r: 0deg;
    --z: 10;
}

/* ============================= */
/* FRAME 23 — TRANSITION LI      */
/* ============================= */

.social-motion[data-state="transition-linkedin"] .linkedin-card {
    --x: 74px;
    --y: 280px;
    --r: 0deg;
    --w: 130px;
    --h: 200px;
    --z: 5;
}

.social-motion[data-state="transition-linkedin"] .whatsapp-card {
    --x: 40px;
    --y: 345px;
    --r: -13deg;
    --w: 100px;
    --h: 150px;
    --z: 2;
}

.social-motion[data-state="transition-linkedin"] .instagram-card {
    --x: 93px;
    --y: 410px;
    --r: -4deg;
    --w: 100px;
    --h: 150px;
    --z: 3;
}

.social-motion[data-state="transition-linkedin"] .gmail-card {
    --x: 145px;
    --y: 315px;
    --r: 12deg;
    --w: 100px;
    --h: 150px;
    --z: 1;
}

/* ===================== */
/* FORM                  */
/* ===================== */

.form {
    font-size: 20px;
    line-height: 25px;
    width: 760px;
    height: 610px;
    margin: 20px 20px 0 20px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.52);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.form h6 {
    margin: 0;
    color: rgba(15, 23, 42, 0.58);
    font-weight: 300;
    padding-left: 24px;
}

.form h4 {
    margin: 0;
    padding: 22px 24px 6px;
    font-size: 2rem !important;
    color: #0f172a;
}

.modulo {
    width: 100%;
    height: 525px;
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    justify-content: left;
    align-items: center;
}

.grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px 24px;
    margin-top: 20px;
}

.grid-2x2 > div {
    display: flex;
    flex-direction: column;
}

.grid-2x2 input {
    width: 300px;
    height: 42px;
    font-size: 1rem;
    box-sizing: border-box;
    border: 1px solid rgba(159, 9, 9, 0.28);
    background-color: rgba(255, 255, 255, 0.55);
    border-radius: 12px;
    padding-left: 12px;
    padding-right: 12px;
    margin-bottom: 10px;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.grid-2x2 input:focus {
    outline: none;
    border-color: rgba(159, 9, 9, 0.62);
    box-shadow: 0 0 0 3px rgba(159, 9, 9, 0.12);
    background: rgba(255, 255, 255, 0.82);
}

.checkbox-row {
    display: flex;
    flex-direction: row;
    gap: 24px;
    margin-left: 60px;
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    align-items: flex-start;
}

.checkbox-row label {
    color: rgba(15, 23, 42, 0.72);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
    font-weight: 100;
}

.checkbox-row label input {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    accent-color: var(--color-primary);
    border: 2px solid var(--color-primary);
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
    position: relative;
}

.checkbox-row label input:checked {
    background: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.label {
    text-align: left !important;
    justify-content: flex-start !important;
    display: block;
    width: 100%;
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: rgba(159, 9, 9, 0.92);
    font-weight: 600;
}

.custom-checkbox {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

.custom-checkbox input[type="checkbox"] {
    opacity: 0;
    width: 24px;
    height: 24px;
    margin: 0;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    cursor: pointer;
}

.custom-checkbox .checkmark {
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    background: transparent;
    box-sizing: border-box;
    z-index: 1;
    transition: background 0.2s, border 0.2s;
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark {
    background: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    display: block;
    position: absolute;
    left: 6px;
    top: 1px;
    width: 8px;
    height: 12px;
    border: solid #fff;
    border-width: 0 3px 3px 0;
    border-radius: 1px;
    transform: rotate(45deg);
}

.modulo textarea {
    font-family: var(--font-main);
    font-size: .9rem;
    line-height: 1.3rem;
    width: 600px;
    min-height: 80px;
    border: 1px solid rgba(159, 9, 9, 0.28);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 12px;
    resize: vertical;
    background: rgba(255, 255, 255, 0.55);
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.modulo textarea:focus {
    outline: none;
    border-color: rgba(159, 9, 9, 0.62);
    box-shadow: 0 0 0 3px rgba(159, 9, 9, 0.12);
    background: rgba(255, 255, 255, 0.82);
}

.modulo .send {
    position: absolute;
    height: 50px;
    width: 150px;
    bottom: 30px;
    right: 40px;
    background: linear-gradient(135deg, #9F0909, #7d0b0b);
    color: #f6f6f6;
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 12px 24px;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(159, 9, 9, 0.25);
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.modulo .send:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 22px rgba(159, 9, 9, 0.33);
    filter: saturate(1.08);
}

.form-status {
    position: absolute;
    left: 40px;
    bottom: 40px;
    margin: 0;
    font-size: 0.9rem;
    font-family: var(--font-secondary);
    color: rgba(15, 23, 42, 0.7);
}

.form-status[data-state="loading"] {
    color: rgba(15, 23, 42, 0.7);
}

.form-status[data-state="success"] {
    color: #0a7a2a;
}

.form-status[data-state="error"] {
    color: #b42318;
}
/* ===================== */
/* LAYOUT CONTATTI       */
/* A sinistra intestazione + social, a destra il form. */
/* Pensato per stare sempre nello schermo senza scroll. */
/* ===================== */

.popup {
    width: min(1000px, 94vw);
    min-height: 0;
    max-height: calc(100vh - 40px);
    padding: 0;
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
}

/* ---------- Colonna sinistra ---------- */
.chat-side {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    padding: 32px 30px 20px 34px;
    box-sizing: border-box;
    min-width: 0;
}

.chat-side .modal-head {
    margin-bottom: 18px;
    padding-right: 0;
}

.chat-side .modal-title {
    font-size: 32px;
}

.chat-side .modal-sub {
    font-size: 14.5px;
}

.chat-social-label {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: #5f5a57;
}

.social-quick {
    display: none;
}

/* le card social animate, ridotte e senza lo spazio vuoto sopra */
.social-stage {
    --stage-scale: 0.82;
    position: relative;
    flex: 0 0 auto;
    width: 270px;
    height: calc(390px * var(--stage-scale));
    margin: 6px auto 0;
    overflow: hidden;
}

.popup .social-motion {
    position: absolute;
    left: 50%;
    top: 0;
    transform-origin: 50% 0;
    transform: translateX(-50%) scale(var(--stage-scale)) translateY(-182px);
    pointer-events: none;
}

.popup .social-motion .social-card {
    pointer-events: auto;
}

/* ---------- Colonna destra: form ---------- */
.chat-form {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 26px 30px 26px;
    box-sizing: border-box;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.3));
    border-left: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.4);
    overflow-y: auto;
}

.chat-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.chat-form-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
}

.chat-form-head .modal-close {
    position: static;
    flex: 0 0 auto;
}

.popup .modulo {
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.popup .grid-2x2 {
    width: 100%;
    margin-top: 0;
    grid-template-rows: none;
    gap: 10px 18px;
}

.popup .grid-2x2 > div {
    min-width: 0;
}

.popup .label {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--color-primary);
}

.popup .grid-2x2 input,
.popup .modulo textarea {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.72);
    font-family: inherit;
    font-size: 15px;
}

.popup .grid-2x2 input {
    height: 42px;
}

.popup [aria-invalid="true"] {
    border-color: #c62828 !important;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12) !important;
}

.reason {
    margin: 14px 0 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.reason legend {
    padding: 0;
}

.popup .checkbox-row {
    margin: 2px 0 0;
    flex-wrap: wrap;
    gap: 8px 22px;
}

.popup .checkbox-row.is-invalid {
    animation: rowShake 0.4s ease-in-out;
}

.popup .checkbox-row.is-invalid .checkmark {
    border-color: #c62828;
}

@keyframes rowShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
}

.popup .checkbox-row label {
    font-size: 15px;
    font-weight: 500;
    color: #3d3b40;
    cursor: pointer;
}

.popup .custom-checkbox {
    width: 22px;
    height: 22px;
    margin-right: 4px;
}

.popup .custom-checkbox input[type="checkbox"],
.popup .custom-checkbox .checkmark {
    width: 22px;
    height: 22px;
}

.popup .custom-checkbox input[type="checkbox"]:checked + .checkmark::after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border-width: 0 2.5px 2.5px 0;
}

.popup .modulo > .label {
    margin-top: 14px;
}

.popup .modulo textarea {
    min-height: 88px;
    margin-bottom: 0;
    line-height: 1.5;
    resize: none;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 16px;
}

.consent {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    font-size: 13px;
    line-height: 1.45;
    color: #5f5a57;
    cursor: pointer;
}

.consent.is-invalid .checkmark {
    border-color: #c62828;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

.consent a {
    color: var(--color-primary);
    font-weight: 600;
}

.consent .custom-checkbox {
    flex: 0 0 auto;
    margin-top: -1px;
}

/* bottone Invia con stato di caricamento */
.popup .modulo .send {
    position: relative;
    inset: auto; /* annulla le coordinate del vecchio bottone in posizione assoluta */
    flex: 0 0 auto;
    width: 140px;
    height: 48px;
    margin: 0;
    padding: 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.send-spinner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    opacity: 0;
    animation: sendSpin 0.8s linear infinite;
}

.send.is-loading {
    pointer-events: none;
}

.send.is-loading .send-label {
    opacity: 0;
}

.send.is-loading .send-spinner {
    opacity: 1;
}

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

/* ---------- Allegati ---------- */
.message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    margin-bottom: 6px;
}

.message-head .label {
    margin: 0;
}

.attach-input {
    display: none;
}

.attach-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px dashed rgba(159, 9, 9, 0.4);
    background: rgba(255, 255, 255, 0.55);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.attach-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.attach-hint {
    font-weight: 500;
    color: #6b6461;
}

.attach-btn:hover {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--color-primary);
}

.attach-btn:active {
    transform: scale(0.96);
}

.attach-btn:focus-visible {
    outline: 3px solid rgba(159, 9, 9, 0.45);
    outline-offset: 2px;
}

.attach-list {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.attach-list.has-files {
    display: flex;
}

.attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-height: 30px;
    padding: 0 4px 0 12px;
    border-radius: 999px;
    background: rgba(159, 9, 9, 0.07);
    border: 1px solid rgba(159, 9, 9, 0.15);
    font-size: 12.5px;
    color: #3d3b40;
    animation: chipIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.attach-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.attach-size {
    color: #6b6461;
}

.attach-remove {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-primary);
    cursor: pointer;
}

.attach-remove:hover {
    background: rgba(159, 9, 9, 0.12);
}

.attach-remove svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

@keyframes chipIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: none; }
}

/* file trascinati sopra il form */
.chat-form.is-dragover {
    outline: 2px dashed rgba(159, 9, 9, 0.5);
    outline-offset: -10px;
    background: rgba(255, 255, 255, 0.7);
}

/* ---------- Schermi bassi: si compatta invece di scorrere ---------- */
@media (min-width: 769px) and (max-height: 700px) {
    .chat-side { padding-top: 26px; }
    .chat-side .modal-head { margin-bottom: 12px; }
    .chat-side .modal-title { font-size: 28px; }
    .social-stage { --stage-scale: 0.66; }
    .chat-form { padding-top: 20px; padding-bottom: 20px; }
    .chat-form-head { margin-bottom: 8px; }
    .popup .grid-2x2 { gap: 8px 18px; }
    .popup .grid-2x2 input { height: 38px; }
    .reason, .message-head { margin-top: 10px; }
    .popup .modulo textarea { min-height: 64px; }
    .form-footer { margin-top: 12px; }
}

@media (min-width: 769px) and (max-height: 580px) {
    .social-stage { display: none; }

    .social-quick {
        display: flex;
        gap: 10px;
        margin-top: 12px;
    }

    .social-quick a {
        width: 44px;
        height: 44px;
        display: grid;
        place-items: center;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.8);
    }

    .social-quick img {
        width: 22px;
        height: 22px;
        object-fit: contain;
    }

    .popup .modulo textarea { min-height: 52px; }
}
