﻿/* ============================================================
   PETROL WebChat — Mobile responsive styles (<= 768px)
   Aktivira se isključivo preko <link media="(max-width: 768px)">
   ============================================================ */

/* Wrap/pozicija - ostaje u desnom uglu */
.wc-wrap {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9001;
}

/* Glavni kontejner - centriran kada je chat otvoren */
.wc-container.chat {
    position: fixed;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    inset: 0 0 auto 0;
    width: 100vw !important;
    height: calc(100svh - 12px) !important;
    height: calc(100dvh - 12px) !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    max-width: none !important;
    max-height: none !important;
    display: none;
    flex-direction: column !important;
    min-height: -webkit-fill-available;
}

    .wc-container.chat.is-open {
        display: flex !important;
    }

/* Header kompaktniji; veći "tap targets" */
.wc-header {
    border-radius: 16px 16px 0 0 !important;
    padding: 10px 12px !important;
    min-height: 64px;
}

    .wc-header img {
        max-width: 28% !important;
        margin: 0 0 6px 0 !important;
        left: 0 !important;
        transform: none !important;
    }

    .wc-header .title {
        font-size: 17px !important;
        margin: 4px 0 0 !important;
    }

    .wc-header .subtitle {
        font-size: 12px !important;
        margin-top: 2px !important;
    }

.header-buttons {
    gap: 8px !important;
    right: 6px !important;
}

.header-btn {
    width: 36px !important;
    height: 36px !important;
}

    .header-btn svg {
        width: 22px !important;
        height: 22px !important;
    }

/* Telo chata */
#webchat {
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
    padding: 0 8px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

/* Send box i input (16px da iOS ne zumira) */
.webchat__send-box {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 1000 !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    background: #fff !important;
}

.webchat__send-box__main {
    border-radius: 24px !important;
    min-height: 46px !important;
}

.webchat__send-box-text-box__input,
.webchat__send-box-text-box__input + textarea {
    font-size: 16px !important;
    line-height: 22px !important;
}

#webchat .webchat__send-box__button {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
}

/* Suggested actions */
.webchat__suggested-actions__carousel .react-film__filmstrip__list {
    gap: 6px !important;
    flex-wrap: wrap !important;
}

#webchat .webchat__suggested-action__button,
#webchat .ac-pushButton.style-default {
    min-height: 36px !important;
    max-height: 36px !important;
    font-size: 12px !important;
    padding: 6px 10px !important;
    width: auto !important;
}

/* Poruke + avatari */
.webchat__bubble__content p,
#webchat p {
    font-size: 14px !important;
    line-height: 1.45 !important;
}

.webchat__defaultAvatar,
.webchat__imageAvatar,
.webchat__initialsAvatar {
    width: 36px !important;
    height: 36px !important;
}

/* ========================================
   INTRO KARTICA - POPUP U DONJEM DELU
   (Prikazuje se samo putem JavaScript-a)
   ======================================== */
.wc-container.intro {
    position: fixed !important;
    bottom: 80px !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    transform: translateX(-50%) !important;
    width: 90vw !important;
    max-width: 400px !important;
    height: auto !important;
    min-height: 320px !important;
    max-height: 70vh !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
    /* NE FORSIRAMO display - to kontroliše JavaScript */
}

    .wc-container.intro .wc-header {
        border-radius: 16px 16px 0 0 !important;
        padding: 20px 16px !important;
        text-align: center !important;
        background: linear-gradient(to right, #772025 0%, #EA2227 100%) !important;
    }

        .wc-container.intro .wc-header img {
            width: 80px !important;
            max-width: 80px !important;
            height: auto !important;
            margin: 0 auto 12px auto !important;
            display: block !important;
            position: static !important;
            left: auto !important;
            transform: none !important;
        }

        .wc-container.intro .wc-header > div {
            max-width: 100% !important;
            margin: 0 auto !important;
        }

    .wc-container.intro .subtitle {
        font-size: 12px !important;
        margin-bottom: 8px !important;
        color: white !important;
    }

    .wc-container.intro .title {
        font-size: 20px !important;
        letter-spacing: 1px !important;
        color: white !important;
        margin-bottom: 8px !important;
    }

    .wc-container.intro p {
        font-size: 13px !important;
        line-height: 1.5 !important;
        margin: 16px 20px !important;
        color: #333 !important;
        text-align: center !important;
    }

    .wc-container.intro > .button {
        margin: 16px auto 24px auto !important;
        padding: 12px 32px !important;
        font-size: 14px !important;
        display: block !important;
        width: auto !important;
    }

/* Launcher dugme - DONJI DESNI UGAO (sa !important da overrajduje glavni CSS) */
.wc-btn {
    position: fixed !important;
    right: 20px !important;
    bottom: 20px !important;
    width: 64px !important;
    height: 64px !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
}

    .wc-btn img.open-control {
        width: 100% !important;
        height: 100% !important;
        border-radius: 50%;
        position: relative !important;
        bottom: 0 !important;
        right: 0 !important;
    }

#pdfViewer {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100svh !important; 
    height: 100dvh !important;
    margin-top: 0 !important;
}

    #pdfViewer.show .pdfContainer {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

.pdfHeader {
    min-height: 56px !important;
    padding: 12px 14px !important;
}

.pdfControls button {
    padding: 8px 10px !important;
    min-width: 34px !important;
    height: 36px !important;
}

.pdfContent {
    padding: 10px !important;
}

.pdfPage {
    width: calc(100% - 20px) !important;
    margin: 0 auto 12px auto !important;
}

/* Half režim za PDF+chat (tvoj JS već dodaje .half) */
#webchat.half {
    width: 100% !important;
    height: 45svh !important;
}

/* Confirmation popup */
.confirmation-popup {
    width: 92% !important;
    padding: 22px !important;
}

.wc-container.chat.fullscreen,
#webchat.fullscreen {
    width: 100vw !important;
    height: 100svh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

.webchat__basic-transcript__scrollable {
    max-height: none !important;
    overflow-y: auto !important;
}

.webchat__basic-transcript__filler,
.webchat__basic-transcript__transcript-terminator {
    flex: 0 0 auto !important;
}

@media (max-width: 768px) {
    body {
        overflow: auto !important;
    }
}