/* ===============================================================
   CHAT WINDOW — PRODUCTION READY v3
   Covers: chat window + trigger button, all screen sizes
   =============================================================== */


/* ================================================================
   BASE — mobile-first (< 375px baseline)
   ================================================================ */

/* ---- Chat window ---- */

.chat-window {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;

    width: 100% !important;
    height: 70vh;
    min-height: 300px;
    max-height: 82vh;

    background-color: #f8fbfd;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.18);

    display: flex;
    flex-direction: column;
    justify-content: flex-start;

    overflow: hidden;
    z-index: 10000 !important;

    text-align: left;
    font-size: 13px;
    color: #000319;
    font-family: Inter, sans-serif;
    box-sizing: border-box;

    opacity: 0;
    transform: translateY(20px);
    animation: chatSlideUp 0.25s ease forwards;
}

@keyframes chatSlideUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    to { transform: translateY(0); opacity: 1; }
}

.chat-window .frame-parent {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
    min-height: 0;
}

/* ---- Header ---- */

.chat-window .frame-group {
    align-self: stretch;
    flex-shrink: 0;
    background-color: #f8fbfd;
    border-bottom: 1px solid #dfe5ed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 8px;
    box-sizing: border-box;
}

.chat-window .comment-01-parent {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chat-window .comment-01-icon {
    height: 30px;
    width: 30px;
    border-radius: 8px;
    flex-shrink: 0;
}

.chat-window .privassistant {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-window .arrow-down-01-parent {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chat-window .arrow-down-01-icon {
    width: 18px;
    height: auto;
    cursor: pointer;
}

.chat-window .chat-close-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.chat-window .chat-close-btn img {
    width: 18px;
    height: 18px;
    display: block;
}

/* ---- Message area ---- */

.chat-window .frame-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 8px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    font-size: 13px;
}

.chat-window .hi-i-am-a-assistant-powered-b-wrapper {
    align-self: stretch;
    border-radius: 10px;
    background-color: #fff;
    border: 1px solid #dfe5ed;
    display: flex;
    align-items: flex-start;
    padding: 12px 14px;
    box-sizing: border-box;
}

.chat-window .hi-i-am {
    flex: 1;
    line-height: 1.5;
}

.chat-window .i-need-information-wrapper {
    align-self: flex-end;
    border-radius: 10px;
    background-color: #008b00;
    border: 1px solid #dfe5ed;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 14px;
    text-align: right;
    color: #fff;
    box-sizing: border-box;
    max-width: 85%;
}

/* ---- Input area ---- */

.chat-window .chat-window-inner {
    flex-shrink: 0;
    align-self: stretch;
    background-color: #fff;
    border-top: 1px solid #dfe5ed;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    box-sizing: border-box;
}

.chat-window .frame-div {
    flex: 1;
    min-height: 68px;
    max-height: 80px;
    position: relative;
    box-shadow: 0px 2px 0px #008b00;
    border-radius: 10px;
    background-color: #fff;
    border: 1px solid #008b00;
    box-sizing: border-box;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 8px 10px;
    gap: 8px;
}

.chat-window .wrapper {
    position: absolute;
    top: 6px;
    right: 8px;
    pointer-events: none;
    display: flex;
    align-items: center;
    font-size: 9px;
    opacity: 0.5;
}

.chat-window .div {
    position: relative;
}

.chat-window .chat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    font-family: Inter, sans-serif;
    background: transparent;
    line-height: 1.4;
    padding-top: 16px;
    -webkit-tap-highlight-color: transparent;
    resize: none;
    color: #000319;
}

.chat-window .chat-input::placeholder {
    color: #aab0ba;
}

.chat-window .frame-child-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 36px;
    min-height: 36px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.chat-window .frame-child {
    height: 20px;
    width: 20px;
    display: block;
}


/* ================================================================
   CHAT TRIGGER BUTTON — base (desktop default)
   ================================================================ */

.chat-assistant {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    cursor: pointer;
    width: auto;
    height: auto;
}

.chat-assistant .chat {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* P logo — same visual size as the header brand P */
.chat-assistant .chat-child {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.chat-assistant .need-help-parent {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-assistant .need-help {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.chat-assistant .lets-chat {
    font-size: 12px;
    color: #fff;
    white-space: nowrap;
}

.chat-assistant .comment-01-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}


/* ================================================================
   xs — < 375px  (iPhone SE 1st gen)
   ================================================================ */

@media (max-width: 374px) {

    .chat-window {
        font-size: 13px;
    }

    .chat-window .frame-group {
        padding: 10px 12px;
    }

    .chat-window .comment-01-icon {
        height: 28px;
        width: 28px;
    }

    .chat-window .frame-div {
        min-height: 64px;
        max-height: 76px;
        padding: 6px 10px;
    }

    /* Trigger — icon only */
    .chat-assistant {
        bottom: 12px;
        right: 12px;
    }

    .chat-assistant .need-help-parent {
        display: none;
    }

    .chat-assistant .chat-child {
        width: 24px;
        height: 24px;
    }

    .chat-assistant .comment-01-icon {
        width: 24px;
        height: 24px;
    }
}


/* ================================================================
   sm — 375–479px  (iPhone SE 2/3, iPhone 12 Pro)
   ================================================================ */

@media (min-width: 375px) and (max-width: 479px) {

    .chat-window {
        font-size: 14px;
    }

    .chat-window .frame-group {
        padding: 12px 16px;
    }

    .chat-window .comment-01-icon {
        height: 32px;
        width: 32px;
    }

    .chat-window .privassistant {
        font-size: 14px;
    }

    .chat-window .frame-container {
        padding: 10px 12px;
        font-size: 13px;
    }

    .chat-window .frame-div {
        min-height: 72px;
        max-height: 84px;
        padding: 8px 12px;
    }

    .chat-window .chat-input {
        font-size: 13px;
    }

    /* Trigger — icon only, hide text */
    .chat-assistant {
        bottom: 16px;
        right: 16px;
    }

    .chat-assistant .need-help-parent {
        display: none;
    }

    .chat-assistant .chat-child {
        width: 28px;
        height: 28px;
    }

    .chat-assistant .comment-01-icon {
        width: 28px;
        height: 28px;
    }
}


/* ================================================================
   md — 480–767px  (large phones, floating card)
   ================================================================ */

@media (min-width: 480px) and (max-width: 767px) {

    .chat-window {
        bottom: 90px !important;
        left: auto !important;
        right: 16px !important;
        width: 420px !important;
        max-width: calc(100vw - 32px) !important;
        height: 68vh;
        border-radius: 12px;
        box-shadow: 0px 1px 18.6px rgba(0, 0, 0, 0.25);
        font-size: 14px;
    }

    .chat-window .frame-group {
        padding: 13px 18px;
    }

    .chat-window .comment-01-icon {
        height: 38px;
        width: 38px;
        border-radius: 10px;
    }

    .chat-window .privassistant {
        font-size: 14px;
    }

    .chat-window .arrow-down-01-icon {
        width: 20px;
    }

    .chat-window .frame-container {
        padding: 10px 14px;
        font-size: 13px;
    }

    .chat-window .frame-div {
        min-height: 80px;
        max-height: 90px;
        padding: 10px 12px;
    }

    .chat-window .chat-input {
        font-size: 13px;
    }

    .chat-window .chat-close-btn img {
        width: 20px;
        height: 20px;
    }

    .chat-assistant {
        bottom: 20px;
        right: 20px;
    }

    .chat-assistant .chat-child {
        width: 28px;
        height: 28px;
    }

    .chat-assistant .comment-01-icon {
        width: 28px;
        height: 28px;
    }
}


/* ================================================================
   lg — 768–1023px  (tablets portrait)
   ================================================================ */

@media (min-width: 768px) and (max-width: 1023px) {

    .chat-window {
        bottom: 96px !important;
        left: auto !important;
        right: 24px !important;
        width: 400px !important;
        height: 560px;
        max-height: 75vh;
        border-radius: 12px;
        font-size: 15px;
    }

    .chat-window .frame-group {
        padding: 14px 20px;
        gap: 12px;
    }

    .chat-window .comment-01-icon {
        height: 42px;
        width: 42px;
        border-radius: 10px;
    }

    .chat-window .privassistant {
        font-size: 15px;
    }

    .chat-window .arrow-down-01-icon {
        width: 22px;
    }

    .chat-window .frame-container {
        padding: 12px 18px;
        font-size: 14px;
    }

    .chat-window .frame-div {
        min-height: 90px;
        max-height: 100px;
        padding: 10px 14px;
    }

    .chat-window .chat-input {
        font-size: 14px;
    }

    .chat-window .chat-close-btn {
        min-width: 40px;
        min-height: 40px;
    }

    .chat-window .chat-close-btn img {
        width: 20px;
        height: 20px;
    }

    .chat-assistant {
        bottom: 24px;
        right: 24px;
    }

    .chat-assistant .chat-child {
        width: 30px;
        height: 30px;
    }

    .chat-assistant .comment-01-icon {
        width: 30px;
        height: 30px;
    }
}


/* ================================================================
   xl — 1024–1279px  (tablets landscape / small laptops)
   ================================================================ */

@media (min-width: 1024px) and (max-width: 1279px) {

    .chat-window {
        bottom: 104px !important;
        left: auto !important;
        right: 28px !important;
        width: 370px !important;
        height: 600px;
        max-height: 80vh;
        border-radius: 12px;
        font-size: 16px;
    }

    .chat-window .frame-group {
        padding: 14px 22px;
        gap: 14px;
    }

    .chat-window .comment-01-icon {
        height: 44px;
        width: 44px;
        border-radius: 12px;
    }

    .chat-window .privassistant {
        font-size: 16px;
    }

    .chat-window .frame-container {
        padding: 14px 20px;
        font-size: 14px;
    }

    .chat-window .frame-div {
        min-height: 100px;
        max-height: 110px;
        padding: 12px;
    }

    .chat-window .chat-input {
        font-size: 14px;
    }

    .chat-window .chat-close-btn img {
        width: 22px;
        height: 22px;
    }

    .chat-assistant {
        bottom: 24px;
        right: 28px;
    }

    .chat-assistant .chat-child {
        width: 32px;
        height: 32px;
    }

    .chat-assistant .comment-01-icon {
        width: 32px;
        height: 32px;
    }
}


/* ================================================================
   2xl — 1280–1535px  (standard desktops)
   ================================================================ */

@media (min-width: 1280px) and (max-width: 1535px) {

    .chat-window {
        bottom: 110px !important;
        left: auto !important;
        right: 32px !important;
        width: 380px !important;
        height: 600px;
        max-height: 80vh;
        border-radius: 12px;
        font-size: 17px;
    }

    .chat-window .frame-group {
        padding: 16px 24px;
        gap: 20px;
    }

    .chat-window .comment-01-icon {
        height: 46px;
        width: 46px;
        border-radius: 12px;
    }

    .chat-window .privassistant {
        font-size: 17px;
    }

    .chat-window .arrow-down-01-icon {
        width: 24px;
    }

    .chat-window .arrow-down-01-parent {
        gap: 16px;
    }

    .chat-window .frame-container {
        padding: 14px 22px;
        font-size: 14px;
    }

    .chat-window .frame-div {
        min-height: 108px;
        max-height: 118px;
        padding: 12px 14px;
        gap: 16px;
    }

    .chat-window .chat-input {
        font-size: 14px;
    }

    .chat-window .chat-close-btn {
        min-width: auto;
        min-height: auto;
        padding: 4px 8px;
    }

    .chat-window .chat-close-btn img {
        width: 22px;
        height: 22px;
    }

    .chat-window .frame-child {
        height: 24px;
        width: 24px;
    }

    .chat-assistant {
        bottom: 24px;
        right: 32px;
    }

    .chat-assistant .chat-child {
        width: 32px;
        height: 32px;
    }

    .chat-assistant .comment-01-icon {
        width: 32px;
        height: 32px;
    }
}


/* ================================================================
   3xl — 1536px+  (large / ultrawide desktops)
   ================================================================ */

@media (min-width: 1536px) {

    .chat-window {
        bottom: 120px !important;
        left: auto !important;
        right: 40px !important;
        width: 420px !important;
        height: 640px;
        max-height: 80vh;
        border-radius: 12px;
        font-size: 18px;
    }

    .chat-window .frame-group {
        padding: 18px 28px;
        gap: 24px;
    }

    .chat-window .comment-01-icon {
        height: 50px;
        width: 50px;
        border-radius: 14px;
    }

    .chat-window .privassistant {
        font-size: 18px;
    }

    .chat-window .frame-container {
        padding: 16px 26px;
        font-size: 15px;
        gap: 12px;
    }

    .chat-window .hi-i-am-a-assistant-powered-b-wrapper,
    .chat-window .i-need-information-wrapper {
        padding: 18px 20px;
    }

    .chat-window .frame-div {
        min-height: 118px;
        max-height: 128px;
        padding: 14px 16px;
        gap: 20px;
    }

    .chat-window .chat-input {
        font-size: 15px;
    }

    .chat-window .chat-close-btn img {
        width: 22px;
        height: 22px;
    }

    .chat-window .frame-child {
        height: 24px;
        width: 24px;
    }

    .chat-assistant {
        bottom: 24px;
        right: 40px;
    }

    .chat-assistant .chat-child {
        width: 34px;
        height: 34px;
    }

    .chat-assistant .comment-01-icon {
        width: 34px;
        height: 34px;
    }
}


/* ================================================================
   LANDSCAPE PHONE — full screen takeover
   ================================================================ */

@media (max-width: 900px) and (max-height: 500px) {

    .chat-window {
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
    }

    .chat-window .frame-group {
        padding: 6px 14px;
    }

    .chat-window .comment-01-icon {
        height: 26px;
        width: 26px;
    }

    .chat-window .frame-div {
        min-height: 56px;
        max-height: 64px;
        padding: 6px 8px;
    }
}


/* ================================================================
   TOUCH — 44×44px minimum tap targets
   ================================================================ */

@media (hover: none) and (pointer: coarse) {

    .chat-window .chat-close-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .chat-window .frame-child-btn {
        min-width: 44px;
        min-height: 44px;
    }
}


/* ================================================================
   MOUSE / HOVER
   ================================================================ */

@media (hover: hover) and (pointer: fine) {

    .chat-window .chat-close-btn:hover {
        opacity: 0.7;
        transition: opacity 0.15s ease;
    }

    .chat-window .frame-child-btn:hover {
        opacity: 0.8;
        transition: opacity 0.15s ease;
    }

    .chat-assistant .chat:hover {
        opacity: 0.9;
        transition: opacity 0.15s ease;
    }
}


/* ================================================================
   ACCESSIBILITY — REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {

    .chat-window {
        animation: none;
        opacity: 1;
        transform: none;
    }
}


/* ================================================================
   CHAT TRIGGER — P logo visibility + size fix
   The chat-child img collapses to 0 without explicit dimensions
   because the parent .chat flex context isn't set in chat_window.css
   ================================================================ */

/* ---- Trigger container ---- */
.chat-assistant {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    cursor: pointer;
}

.chat-assistant .chat {
    display: flex !important;       /* force flex — may be overridden by priva_ver2.css */
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px;
    cursor: pointer;
}

/* P logo — explicitly sized, never collapses */
.chat-assistant .chat-child {
    display: block !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;     /* prevents flex from shrinking it to 0 */
    min-height: 32px !important;
    object-fit: contain;
    flex-shrink: 0 !important;
}

/* Chat bubble icon */
.chat-assistant .comment-01-icon {
    display: block !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    flex-shrink: 0 !important;
    object-fit: contain;
}

/* Text labels */
.chat-assistant .need-help-parent {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-assistant .need-help {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.chat-assistant .lets-chat {
    font-size: 12px;
    color: #fff;
    white-space: nowrap;
}


/* ================================================================
   xs < 375px — icon only
   ================================================================ */
@media (max-width: 374px) {

    .chat-assistant {
        bottom: 12px;
        right: 12px;
    }

    .chat-assistant .need-help-parent {
        display: none !important;
    }

    .chat-assistant .chat-child {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        min-height: 24px !important;
    }

    .chat-assistant .comment-01-icon {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
    }
}


/* ================================================================
   sm 375–479px (iPhone 12 Pro) — icon only
   ================================================================ */
@media (min-width: 375px) and (max-width: 479px) {

    .chat-assistant {
        bottom: 16px;
        right: 16px;
    }

    .chat-assistant .need-help-parent {
        display: none !important;
    }

    .chat-assistant .chat-child {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
    }

    .chat-assistant .comment-01-icon {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
    }
}


/* ================================================================
   md 480–767px
   ================================================================ */
@media (min-width: 480px) and (max-width: 767px) {

    .chat-assistant {
        bottom: 20px;
        right: 20px;
    }

    .chat-assistant .chat-child {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
    }

    .chat-assistant .comment-01-icon {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
    }
}