/* =========================================================
   Floating Survey Digital PPID - Frontend
   ========================================================= */

.ppid-survey-floating {
    position: fixed;
    z-index: var(--ppid-z, 99990);
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    inset-inline-start: auto;
    inset-inline-end: auto;
    inset-block-start: auto;
    inset-block-end: auto;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 19px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: var(--ppid-radius, 999px);
    background: var(--ppid-bg, #005baa);
    color: var(--ppid-text, #fff);
    font-family: inherit;
    font-size: var(--ppid-font-size, 15px);
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 5px 18px rgba(15,23,42,.20);
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.ppid-survey-floating[style*="--ppid-horizontal: right"] { right: var(--ppid-desktop-x, 24px); }
.ppid-survey-floating[style*="--ppid-horizontal: left"] { left: var(--ppid-desktop-x, 24px); }
.ppid-survey-floating[style*="--ppid-vertical: bottom"] { bottom: var(--ppid-desktop-y, 24px); }
.ppid-survey-floating[style*="--ppid-vertical: top"] { top: var(--ppid-desktop-y, 24px); }

.ppid-survey-floating:hover {
    transform: translateY(-2px);
    box-shadow: 0 9px 24px rgba(15,23,42,.24);
    background: var(--ppid-hover-bg, #004a8d);
}

.ppid-survey-floating:active { transform: translateY(0); }

.ppid-survey-floating:focus-visible {
    outline: 3px solid #ffcc00;
    outline-offset: 3px;
}

.ppid-survey-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ppid-icon-size, 18px);
    height: var(--ppid-icon-size, 18px);
    flex: 0 0 var(--ppid-icon-size, 18px);
}

.ppid-survey-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* =========================================================
   Modal
   ========================================================= */

.ppid-survey-dialog {
    width: min(1000px, calc(100vw - 32px));
    max-width: 1000px;
    height: min(850px, calc(100vh - 32px));
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15,23,42,.32);
}

.ppid-survey-dialog::backdrop {
    background: rgba(15,23,42,.66);
    backdrop-filter: blur(2px);
}

.ppid-survey-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #fff;
}

/* =========================================================
   Refined header
   ========================================================= */

.ppid-survey-header {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
    padding: 19px 70px 18px 28px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.ppid-survey-header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 3px;
    background: #005baa;
}

.ppid-survey-heading {
    min-width: 0;
    width: 100%;
}

.ppid-survey-kicker {
    margin: 0 0 4px;
    color: #005baa;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ppid-survey-header h2 {
    margin: 0;
    color: #111827;
    font-size: 20px;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: -.01em;
}

.ppid-survey-header p {
    max-width: 760px;
    margin: 5px 0 0;
    color: #667085;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.5;
}

.ppid-survey-close {
    position: absolute;
    top: 50%;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    transform: translateY(-50%);
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: #f8fafc;
    color: #475467;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.ppid-survey-close svg { display: block; }

.ppid-survey-close:hover {
    background: #eef2f6;
    border-color: #d0d5dd;
    color: #111827;
    transform: translateY(-50%) scale(1.04);
}

.ppid-survey-close:focus-visible {
    outline: 3px solid rgba(0,91,170,.25);
    outline-offset: 2px;
}

/* =========================================================
   Form area
   ========================================================= */

.ppid-survey-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 16px 16px;
    box-sizing: border-box;
    background: #f8fafc;
    overflow: hidden;
}

.ppid-survey-body iframe {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
}

.ppid-survey-loading {
    position: absolute;
    inset: 14px 16px 16px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: #667085;
    font-size: 14px;
}

.ppid-survey-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #dbe3ec;
    border-top-color: #005baa;
    border-radius: 50%;
    animation: ppid-survey-spin .8s linear infinite;
}

.ppid-survey-loading.is-hidden { display: none; }

.ppid-survey-fallback {
    position: absolute;
    inset: auto 28px 28px 28px;
    z-index: 4;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: rgba(255,255,255,.97);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    text-align: center;
}

.ppid-survey-fallback.is-visible { display: flex; }
.ppid-survey-fallback a { font-weight: 600; color: #005baa; }

@keyframes ppid-survey-spin { to { transform: rotate(360deg); } }

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 600px) {
    .ppid-survey-floating {
        min-height: 46px;
        padding: 11px 15px;
        font-size: 14px;
    }

    .ppid-survey-floating[style*="--ppid-horizontal: right"] { right: var(--ppid-mobile-x, 16px); }
    .ppid-survey-floating[style*="--ppid-horizontal: left"] { left: var(--ppid-mobile-x, 16px); }
    .ppid-survey-floating[style*="--ppid-vertical: bottom"] { bottom: var(--ppid-mobile-y, 80px); }
    .ppid-survey-floating[style*="--ppid-vertical: top"] { top: var(--ppid-mobile-y, 80px); }

    .ppid-survey-dialog {
        width: calc(100vw - 10px);
        height: calc(100vh - 10px);
        max-height: calc(100vh - 10px);
        border-radius: 11px;
    }

    .ppid-survey-header {
        padding: 16px 58px 15px 18px;
    }

    .ppid-survey-kicker {
        margin-bottom: 3px;
        font-size: 9px;
    }

    .ppid-survey-header h2 {
        font-size: 17px;
        line-height: 1.35;
    }

    .ppid-survey-header p {
        margin-top: 4px;
        font-size: 12px;
        line-height: 1.45;
    }

    .ppid-survey-close {
        right: 13px;
        width: 36px;
        height: 36px;
    }

    .ppid-survey-body {
        padding: 9px;
    }

    .ppid-survey-body iframe {
        min-height: 400px;
        border-radius: 8px;
    }

    .ppid-survey-loading {
        inset: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ppid-survey-floating,
    .ppid-survey-close { transition: none; }
    .ppid-survey-spinner { animation: none; }
}
