/* ============================================
   HOLLIDAY CHAT WIDGET - STYLES v1.3
   ============================================ */

/* CSS varijable */
:root {
    --holliday-primary: #c41e3a;
    --holliday-primary-dark: #a01830;
    --holliday-primary-light: #d63950;
    --holliday-white: #ffffff;
    --holliday-bg: #f8f9fa;
    --holliday-text: #212529;
    --holliday-text-muted: #6c757d;
    --holliday-border: #dee2e6;
    --holliday-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    --holliday-shadow-lg: 0 10px 40px rgba(196, 30, 58, 0.25);
}

/* ============================================
   ADMIN BADGE
   ============================================ */
.holliday-admin-badge-floating {
    position: fixed !important;
    top: 90px !important;
    right: 20px !important;
    background: linear-gradient(135deg, #ffc107, #ff9800) !important;
    color: #000 !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    z-index: 999998 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    animation: holliday-pulse 2s infinite !important;
}

@keyframes holliday-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ============================================
   CONTAINER - SVE SA !important da preglasi sajt CSS
   ============================================ */
#holliday-chat-container {
    position: fixed !important;
    bottom: 20px !important;
    z-index: 999999 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
}

#holliday-chat-container *, 
#holliday-chat-container *::before, 
#holliday-chat-container *::after {
    box-sizing: border-box !important;
}

#holliday-chat-container.holliday-chat-right {
    right: 20px !important;
}

#holliday-chat-container.holliday-chat-left {
    left: 20px !important;
}

/* ============================================
   PLIVAJUCE DUGME
   ============================================ */
.holliday-chat-toggle {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: var(--holliday-primary) !important;
    color: var(--holliday-white) !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: var(--holliday-shadow-lg) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
}

.holliday-chat-toggle:hover {
    background: var(--holliday-primary-dark) !important;
    transform: scale(1.1) !important;
}

/* SVG ikonice u dugmetu - VAZNO! */
.holliday-chat-toggle svg {
    width: 28px !important;
    height: 28px !important;
    transition: opacity 0.2s, transform 0.2s !important;
    color: var(--holliday-white) !important;
    fill: none !important;
    stroke: currentColor !important;
    display: block !important;
}

.holliday-chat-toggle svg path,
.holliday-chat-toggle svg circle {
    stroke: var(--holliday-white) !important;
    fill: none !important;
}

.holliday-icon-close {
    position: absolute !important;
    opacity: 0 !important;
    transform: rotate(-90deg) !important;
}

#holliday-chat-container.is-open .holliday-icon-chat {
    opacity: 0 !important;
    transform: rotate(90deg) !important;
}

#holliday-chat-container.is-open .holliday-icon-close {
    opacity: 1 !important;
    transform: rotate(0) !important;
}

.holliday-chat-toggle.has-new-message::after {
    content: '' !important;
    position: absolute !important;
    top: 5px !important;
    right: 5px !important;
    width: 12px !important;
    height: 12px !important;
    background: #ff4757 !important;
    border: 2px solid var(--holliday-white) !important;
    border-radius: 50% !important;
    animation: holliday-bounce 1s infinite !important;
}

@keyframes holliday-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ============================================
   CHAT PROZOR
   ============================================ */
.holliday-chat-window {
    position: absolute !important;
    bottom: 80px !important;
    width: 400px !important;
    max-width: calc(100vw - 40px) !important;
    height: 600px !important;
    max-height: calc(100vh - 120px) !important;
    background: var(--holliday-white) !important;
    border-radius: 16px !important;
    box-shadow: var(--holliday-shadow) !important;
    display: flex !important;
    flex-direction: column !important;
    opacity: 0 !important;
    transform: translateY(20px) scale(0.95) !important;
    pointer-events: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

#holliday-chat-container.holliday-chat-right .holliday-chat-window {
    right: 0 !important;
}

#holliday-chat-container.holliday-chat-left .holliday-chat-window {
    left: 0 !important;
}

#holliday-chat-container.is-open .holliday-chat-window {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
}

/* ============================================
   HEADER
   ============================================ */
.holliday-chat-header {
    background: linear-gradient(135deg, var(--holliday-primary) 0%, var(--holliday-primary-dark) 100%) !important;
    color: var(--holliday-white) !important;
    padding: 16px 20px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.holliday-chat-header-info {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
}

.holliday-chat-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--holliday-white) !important;
    flex-shrink: 0 !important;
}

.holliday-chat-avatar svg {
    width: 22px !important;
    height: 22px !important;
    color: var(--holliday-white) !important;
    fill: none !important;
    stroke: currentColor !important;
}

.holliday-chat-avatar svg path,
.holliday-chat-avatar svg circle {
    stroke: var(--holliday-white) !important;
}

.holliday-chat-avatar svg circle {
    fill: var(--holliday-white) !important;
}

.holliday-chat-title {
    font-weight: 600 !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    color: var(--holliday-white) !important;
    margin: 0 !important;
}

.holliday-chat-status {
    font-size: 12px !important;
    opacity: 0.9 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-top: 2px !important;
    color: var(--holliday-white) !important;
}

.holliday-status-dot {
    width: 8px !important;
    height: 8px !important;
    background: #4caf50 !important;
    border-radius: 50% !important;
    box-shadow: 0 0 10px #4caf50 !important;
    animation: holliday-pulse-dot 2s infinite !important;
}

@keyframes holliday-pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* MINIMIZE / X DUGME - VAZNO ZA X DA SE VIDI */
.holliday-chat-minimize {
    background: rgba(255, 255, 255, 0.15) !important;
    border: none !important;
    color: var(--holliday-white) !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
}

.holliday-chat-minimize:hover {
    background: rgba(255, 255, 255, 0.25) !important;
}

.holliday-chat-minimize svg {
    width: 18px !important;
    height: 18px !important;
    color: var(--holliday-white) !important;
    fill: none !important;
    stroke: currentColor !important;
    display: block !important;
}

.holliday-chat-minimize svg path {
    stroke: var(--holliday-white) !important;
}

/* ============================================
   PORUKE
   ============================================ */
.holliday-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 20px !important;
    background: var(--holliday-bg) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    min-height: 0 !important;
}

.holliday-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.holliday-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.holliday-message {
    max-width: 85% !important;
    padding: 12px 16px !important;
    border-radius: 18px !important;
    word-wrap: break-word !important;
    animation: holliday-slide-in 0.3s ease-out !important;
    line-height: 1.5 !important;
    font-size: 14px !important;
}

@keyframes holliday-slide-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.holliday-message-bot {
    background: var(--holliday-white) !important;
    color: var(--holliday-text) !important;
    align-self: flex-start !important;
    border-bottom-left-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

.holliday-message-user {
    background: var(--holliday-primary) !important;
    color: var(--holliday-white) !important;
    align-self: flex-end !important;
    border-bottom-right-radius: 4px !important;
}

.holliday-message-bot strong {
    color: var(--holliday-primary) !important;
    font-weight: 700 !important;
}

.holliday-message-bot a {
    color: var(--holliday-primary) !important;
    text-decoration: underline !important;
    word-break: break-word !important;
}

.holliday-message-bot a:hover {
    color: var(--holliday-primary-dark) !important;
}

.holliday-message-bot ul, 
.holliday-message-bot ol {
    margin: 8px 0 !important;
    padding-left: 20px !important;
}

.holliday-message-bot li {
    margin: 4px 0 !important;
}

/* Typing dots */
.holliday-typing-indicator {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 14px 18px !important;
    background: var(--holliday-white) !important;
    border-radius: 18px !important;
    border-bottom-left-radius: 4px !important;
    align-self: flex-start !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

.holliday-typing-dot {
    width: 8px !important;
    height: 8px !important;
    background: var(--holliday-text-muted) !important;
    border-radius: 50% !important;
    animation: holliday-typing 1.4s infinite !important;
}

.holliday-typing-dot:nth-child(2) { animation-delay: 0.2s !important; }
.holliday-typing-dot:nth-child(3) { animation-delay: 0.4s !important; }

@keyframes holliday-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* ============================================
   QUICK REPLIES
   ============================================ */
.holliday-chat-quick-replies {
    padding: 10px 16px !important;
    background: var(--holliday-white) !important;
    border-top: 1px solid var(--holliday-border) !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
}

.holliday-chat-quick-replies.is-hidden {
    display: none !important;
}

.holliday-quick-reply {
    background: var(--holliday-bg) !important;
    border: 1px solid var(--holliday-border) !important;
    color: var(--holliday-text) !important;
    padding: 6px 12px !important;
    border-radius: 16px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
    white-space: nowrap !important;
    font-family: inherit !important;
    margin: 0 !important;
    outline: none !important;
}

.holliday-quick-reply:hover {
    background: var(--holliday-primary) !important;
    color: var(--holliday-white) !important;
    border-color: var(--holliday-primary) !important;
}

/* ============================================
   INPUT - SEND DUGME (VAZNO!)
   ============================================ */
.holliday-chat-input-container {
    display: flex !important;
    gap: 8px !important;
    padding: 14px 16px !important;
    background: var(--holliday-white) !important;
    border-top: 1px solid var(--holliday-border) !important;
    flex-shrink: 0 !important;
    align-items: center !important;
}

.holliday-chat-input {
    flex: 1 !important;
    padding: 10px 16px !important;
    border: 2px solid var(--holliday-border) !important;
    border-radius: 24px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    outline: none !important;
    transition: border-color 0.2s !important;
    background: var(--holliday-bg) !important;
    color: var(--holliday-text) !important;
    min-width: 0 !important;
    margin: 0 !important;
}

.holliday-chat-input:focus {
    border-color: var(--holliday-primary) !important;
    background: var(--holliday-white) !important;
}

/* SEND DUGME - SVG MORA DA SE VIDI */
.holliday-chat-send {
    background: var(--holliday-primary) !important;
    color: var(--holliday-white) !important;
    border: none !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
}

.holliday-chat-send:hover:not(:disabled) {
    background: var(--holliday-primary-dark) !important;
    transform: scale(1.05) !important;
}

.holliday-chat-send:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.holliday-chat-send svg {
    width: 18px !important;
    height: 18px !important;
    color: var(--holliday-white) !important;
    fill: none !important;
    stroke: currentColor !important;
    display: block !important;
}

.holliday-chat-send svg path {
    stroke: var(--holliday-white) !important;
}

/* ============================================
   FOOTER
   ============================================ */
.holliday-chat-footer {
    padding: 6px 16px !important;
    background: var(--holliday-bg) !important;
    text-align: center !important;
    font-size: 10px !important;
    color: var(--holliday-text-muted) !important;
    border-top: 1px solid var(--holliday-border) !important;
    flex-shrink: 0 !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
/* ============================================
   MOBILNI PRIKAZ - full screen sheet
   ============================================ */
@media (max-width: 600px) {

    /* Chat prozor postaje full-screen panel */
    .holliday-chat-window {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;   /* ne racuna URL traku browsera */
        max-height: none !important;
        border-radius: 0 !important;
        opacity: 1 !important;
        transform: translateY(100%) !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    #holliday-chat-container.holliday-chat-right .holliday-chat-window,
    #holliday-chat-container.holliday-chat-left .holliday-chat-window {
        left: 0 !important;
        right: 0 !important;
    }

    #holliday-chat-container.is-open .holliday-chat-window {
        transform: translateY(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Plivajuce dugme - safe area za iPhone home indicator */
    #holliday-chat-container {
        bottom: 16px !important;
        bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    }

    #holliday-chat-container.holliday-chat-right {
        right: 16px !important;
    }

    #holliday-chat-container.holliday-chat-left {
        left: 16px !important;
    }

    .holliday-chat-toggle {
        width: 58px !important;
        height: 58px !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    /* Kad je chat otvoren, sakrij plivajuce dugme (imamo X u headeru) */
    #holliday-chat-container.is-open .holliday-chat-toggle {
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Header - prostor za notch */
    .holliday-chat-header {
        padding: 14px 16px !important;
        padding-top: calc(14px + env(safe-area-inset-top)) !important;
    }

    .holliday-chat-title {
        font-size: 16px !important;
    }

    /* Veci X, lakse se pogadja prstom */
    .holliday-chat-minimize {
        width: 40px !important;
        height: 40px !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .holliday-chat-minimize svg {
        width: 22px !important;
        height: 22px !important;
    }

    /* Poruke - citljivije, bez scroll chaining-a na body */
    .holliday-chat-messages {
        padding: 16px 14px !important;
        gap: 10px !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .holliday-message {
        max-width: 88% !important;
        font-size: 15px !important;
        padding: 11px 15px !important;
    }

    /* Quick replies - jedan red koji se skroluje horizontalno */
    .holliday-chat-quick-replies {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overscroll-behavior-x: contain !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding: 10px 14px !important;
        gap: 8px !important;
    }

    .holliday-chat-quick-replies::-webkit-scrollbar {
        display: none !important;
    }

    .holliday-quick-reply {
        flex: 0 0 auto !important;
        font-size: 13px !important;
        padding: 9px 15px !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    /* Input - 16px OBAVEZNO, inace iOS Safari zumira stranicu na fokus */
    .holliday-chat-input-container {
        padding: 12px 14px !important;
        padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
        gap: 10px !important;
    }

    .holliday-chat-input {
        font-size: 16px !important;
        padding: 12px 16px !important;
    }

    .holliday-chat-send {
        width: 46px !important;
        height: 46px !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .holliday-chat-send svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* Footer zauzima previse prostora na malom ekranu */
    .holliday-chat-footer {
        display: none !important;
    }

    .holliday-admin-badge-floating {
        top: 70px !important;
        right: 10px !important;
        font-size: 10px !important;
        padding: 6px 12px !important;
    }
}

/* Telefon u landscape rezimu - header nizi da ostane mesta za poruke */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
    .holliday-chat-header {
        padding: 8px 16px !important;
    }

    .holliday-chat-avatar {
        width: 32px !important;
        height: 32px !important;
    }

    .holliday-chat-quick-replies {
        display: none !important;
    }
}

/* Kad je chat otvoren na mobilnom - zakljucaj pozadinu */
body.holliday-chat-locked {
    position: fixed !important;
    width: 100% !important;
    overflow: hidden !important;
}
