:root {
    --primary: #0080A9;
    --primary-hover: #00759A;
    --dark: #0080A9;
    --bg-chat: #F5F7F9;
    --bg-option: #d4e8ee;
    --border-option: #8aa5ad;
    --text-main: #3B3838;
    --text-white: #FFFFFF;
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --btn-secondary-bg: #a57a3d62;
    --btn-secondary-hover: #C0965C;
    --btn-secondary-text: #000000;
    --btn-dark-bg: #f3e4cf;
    --btn-dark-hover: #ceab7a;
    --btn-dark-text: #000000;
    --gold-glow: rgba(104, 95, 58, 0.438);
    --btn-rating-bg: #e8e8e8;
    --btn-rating-hover: #C0965C;
    --btn-rating-text: #000000;
    --btn-gray-bg: #6c757d;
    --btn-gray-hover: #343a40;
    --btn-gray-text: #FFFFFF;
    --star-gold: #ffd90098;
    --star-light-gold: #ffe45cbe;
    --star-gray: #999999;
    --star-light-gray: #D3D3D3;
}


.bot-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 90px;
    height: 90px;
    background-color: var(--primary);
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
    cursor: pointer;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, background 0.3s;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.bot-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background-color: var(--primary);
    z-index: -1;
    animation: pulseOutward 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.bot-toggle-btn:hover {
    transform: scale(1.05);
    background: var(--primary-hover);
}

.bot-toggle-btn:active {
    transform: scale(0.95);
}

.bot-toggle-btn svg {
    width: 42px;
    height: 42px;
    fill: var(--text-white);
}

body.chat-open .bot-toggle-btn::before {
    opacity: 0;
    transform: scale(1) !important;
    transition: opacity 0.5s ease, transform 0.5s ease;
    animation: none;
}

@keyframes pulseOutward {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(2.8); opacity: 0; }
}


.chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 460px;
    max-width: calc(100vw - 40px);
    height: 690px;
    max-height: calc(100vh - 100px);
    background: var(--text-white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    z-index: 2147483647;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    animation: slideUp 0.3s ease-out;
}
.chat-window.active { display: flex; }

.chat-header {
    background: var(--dark);
    color: var(--text-white);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.chat-header h4 { margin: 0; font-size: 15px; font-weight: 600; }
.chat-close {
    cursor: pointer; font-size: 24px; background: none; border: none;
    color: var(--text-white); opacity: 0.8; transition: opacity 0.2s;
    padding: 4px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-close:hover { opacity: 1; }

.chat-messages {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    background: var(--bg-chat);
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.message {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-main);
    animation: messageAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation-fill-mode: forwards;
    opacity: 0;
    transform: translateY(10px);
    word-wrap: break-word;
}
.message.bot {
    background: var(--text-white);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.message.user {
    background: var(--primary);
    color: var(--text-white);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-options {
    padding: 12px 16px;
    background: var(--text-white);
    border-top: 1px solid #eef2f5;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: auto;
    align-items: center;
    flex-shrink: 0;
}

.option-btn {
    background: var(--bg-option);
    border: 1px solid var(--border-option);
    padding: 10px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-main);
    animation: buttonFadeIn 0.4s ease-out;
    animation-fill-mode: forwards;
    opacity: 0;
    transform: translateY(8px);
    text-align: center;
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
}
.option-btn:hover {
    background: var(--primary);
    color: var(--text-white);
    border-color: var(--primary);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 2px 8px rgba(16, 189, 153, 0.2);
}
.option-btn:active { transform: scale(0.98); }

.option-btn-secondary {
    background: var(--btn-secondary-bg) !important;
    border: 1px solid #718096 !important;
    color: var(--btn-secondary-text) !important;
    font-weight: 600 !important;
}
.option-btn-secondary:hover {
    background: var(--btn-secondary-hover) !important;
    border-color: var(--btn-secondary-hover) !important;
    color: #2D3748 !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 3px 12px var(--gold-glow),
    0 0 15px rgba(244, 208, 63, 0.25);
}

.option-btn-outline {
    background: var(--btn-dark-bg) !important;
    border: 2px solid #2D3748 !important;
    color: var(--btn-dark-text) !important;
    font-weight: 600 !important;
}
.option-btn-outline:hover {
    background: var(--btn-dark-hover) !important;
    border-color: var(--btn-dark-hover) !important;
    color: #2D3748 !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 3px 12px var(--gold-glow),
    0 0 15px rgba(244, 208, 63, 0.25),
    inset 0 0 6px rgba(255, 255, 255, 0.2);
}

.option-btn-rating {
    background: var(--btn-rating-bg) !important;
    border: 1px solid #999999 !important;
    color: var(--btn-rating-text) !important;
    font-weight: 600 !important;
}
.option-btn-rating:hover {
    background: var(--btn-rating-hover) !important;
    border-color: var(--btn-rating-hover) !important;
    color: #333333 !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px var(--gold-glow),
    0 0 30px rgba(244, 208, 63, 0.4);
}


.option-btn-gray {
    background: var(--btn-gray-bg) !important;
    border: 1px solid var(--btn-gray-bg) !important;
    color: var(--btn-gray-text) !important;
    font-weight: 600 !important;
}
.option-btn-gray:hover {
    background: var(--btn-gray-hover) !important;
    border-color: var(--btn-gray-hover) !important;
    color: var(--btn-gray-text) !important;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.option-btn-external {
    background: rgba(0, 168, 150, 0.1) !important;
    color: var(--primary) !important;
    border: 2px solid var(--primary) !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    padding: 10px 16px !important;
    transition: all 0.3s ease;
    cursor: pointer;
}
.option-btn-external:hover {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(0, 168, 150, 0.4);
}


.rating-stars {
    display: flex !important;
    gap: 8px !important;
    justify-content: center !important;
    padding: 12px 0 !important;
    margin: 8px 0 !important;
}

.rating-star {
    width: 36px !important;
    height: 36px !important;
    cursor: pointer !important;
    transition: transform 0.2s ease !important;
    user-select: none !important;
}

.rating-star svg {
    width: 100% !important;
    height: 100% !important;
    fill: var(--star-light-gray) !important;
    stroke: var(--star-gray) !important;
    stroke-width: 1.5 !important;
    transition: fill 0.2s ease, stroke 0.2s ease, filter 0.2s ease !important;
}

.rating-star:hover svg,
.rating-star.active svg {
    fill: var(--star-gold) !important;
    stroke: var(--star-gold) !important;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.6)) !important;
}

.rating-star:hover {
    transform: scale(1.15) !important;
}


.external-link-icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}


@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes messageAppear {
    0% { opacity: 0; transform: translateY(15px) scale(0.95); }
    60% { transform: translateY(-3px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes buttonFadeIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}


@media (max-width: 480px) {

    .bot-toggle-btn {
        bottom: 16px !important;
        right: 16px !important;
        width: 81px !important;
        height: 81px !important;
    }
    .bot-toggle-btn::before {
        animation-duration: 2.5s !important;
    }
    .bot-toggle-btn svg {
        width: 38px !important;
        height: 38px !important;
    }


    .chat-window {
        width: calc(100vw - 32px) !important;
        max-width: none !important;
        bottom: 95px !important;
        right: 16px !important;
        left: 16px !important;
        height: calc(100vh - 120px) !important;
        max-height: none !important;
        border-radius: 12px !important;

        padding-top: env(safe-area-inset-top);
    }


    @supports (height: 100dvh) {
        .chat-window {
            height: calc(100dvh - 120px) !important;
        }
    }


    .chat-header {
        padding: 12px 14px !important;
        padding-top: calc(12px + env(safe-area-inset-top)) !important;
    }
    .chat-header h4 {
        font-size: 14px !important;
    }
    .chat-close {
        font-size: 22px !important;
        padding: 4px !important;
        min-width: 28px !important;
        min-height: 28px !important;
    }


    .chat-messages {
        padding: 10px 12px !important;
        gap: 8px !important;
    }


    .message {
        max-width: 92% !important;
        padding: 9px 12px !important;
        font-size: 13px !important;
        border-radius: 14px !important;
    }


    .chat-options {
        padding: 10px 12px !important;
        gap: 6px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    }


    .option-btn {
        padding: 9px 12px !important;
        font-size: 13px !important;
        min-height: 38px !important;
        min-width: 38px !important;
        border-radius: 18px !important;
        white-space: normal !important;
        word-wrap: break-word;
    }


    .rating-star {
        width: 34px !important;
        height: 34px !important;
    }
}


@media (max-width: 360px) {
    .chat-window {
        bottom: 90px !important;
        height: calc(100vh - 110px) !important;
    }
    .option-btn {
        padding: 8px 10px !important;
        font-size: 12px !important;
        min-height: 36px !important;
    }
}


body.chat-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
}
