@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Poppins:wght@400;700&display=swap');

:root {
    --chat-bg: #0a0a0a;
    --chat-panel: #1a1a1a;
    --chat-accent: #ffcc00;
    --chat-cyan: #00FFFF;
    --chat-green: #39ff14;
    --chat-pink: #ff0044;
    --chat-border: 3px solid #000;
    --chat-shadow: 4px 4px 0 #000;
}

#ds-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: 'Poppins', sans-serif;
}

#ds-chat-window {
    width: 360px;
    height: 520px;
    max-height: 80vh;
    background: var(--chat-panel);
    border: var(--chat-border);
    border-radius: 12px 12px 0 0;
    box-shadow: 6px 6px 0 #000, 0 0 30px rgba(255,204,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(0);
}

#ds-chat-container .ds-chat-collapsed {
    transform: translateY(calc(100% - 70px));
}

#ds-chat-header {
    height: 70px;
    background: var(--chat-accent);
    padding: 8px 14px;
    border-bottom: var(--chat-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

#ds-chat-header span {
    font-family: 'Bangers', cursive;
    font-size: 1.3rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #000;
}

.ds-header-actions { display: flex; align-items: center; gap: 6px; }
#ds-chat-clear {
    background: transparent; border: none; font-size: 20px; line-height: 1;
    cursor: pointer; padding: 2px; color: #000;
    transition: transform 0.2s;
}
#ds-chat-clear:hover { transform: scale(1.2); }

/* Badge */
.ds-chat-badge {
    background: var(--chat-pink); color: #fff; font-size: 10px; font-weight: bold;
    padding: 2px 6px; border-radius: 10px; margin-left: 6px;
    font-family: 'Poppins', sans-serif;
}
.ds-badge-pulse { animation: badgePulse 1.5s infinite; }
@keyframes badgePulse { 0%,100%{transform:scale(1)}50%{transform:scale(1.2)} }

/* Messages area */
#ds-chat-messages {
    flex-grow: 1; padding: 16px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px;
    background: #0a0a0a;
}

.ds-message {
    padding: 10px 14px; border: 2px solid #000; border-radius: 10px;
    max-width: 85%; word-wrap: break-word;
    box-shadow: 3px 3px 0 #000;
    font-size: 13px; font-weight: 500;
    position: relative; line-height: 1.5;
}

.ai-message {
    align-self: flex-start; background: #1a1a2e;
    color: #f8f4ec; border-color: var(--chat-cyan);
    border-bottom-left-radius: 2px;
}
.ai-message img.ds-chat-image {
    display: block !important; width: 100% !important; height: auto !important;
    max-width: 100% !important; border-radius: 8px !important; margin: 10px 0 !important;
    border: 3px solid var(--chat-cyan) !important;
}

/* Emoji-k (a WP img.emoji-ra konvertál) — betű méretben, ne óriás képként */
#ds-chat-container img.emoji,
#ds-chat-container img.wp-smiley {
    width: 1em !important; height: 1em !important;
    display: inline !important; max-width: none !important;
    border: none !important; border-radius: 0 !important;
    margin: 0 2px !important; padding: 0 !important;
    vertical-align: -0.15em !important;
    background: none !important; box-shadow: none !important;
}

.user-message {
    align-self: flex-end; background: #1a1a1a;
    color: #f8f4ec; border-color: var(--chat-accent);
    border-bottom-right-radius: 2px;
}

.ds-timestamp {
    display: block; font-size: 10px; color: #888;
    margin-top: 6px; font-weight: normal; text-align: right;
}

/* Typing indicator */
.ds-typing-indicator { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 0; flex-wrap: wrap; }
.ds-typing-text { width: 100%; text-align: center; font-size: 11px; color: #888; font-style: italic; margin-bottom: 4px; }
.ds-typing-dot { width: 7px; height: 7px; background: var(--chat-accent); border: 2px solid #000; border-radius: 50%; animation: dsBounce 1.4s infinite ease-in-out; }
.ds-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ds-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dsBounce { 0%,80%,100%{transform:translateY(0);opacity:0.3}40%{transform:translateY(-6px);opacity:1} }

/* Footer */
#ds-chat-footer {
    padding: 12px; border-top: var(--chat-border);
    display: flex; gap: 8px;
    background: var(--chat-panel); align-items: flex-end;
}

#ds-chat-input {
    flex-grow: 1; padding: 8px 12px;
    border: 2px solid #333; border-radius: 8px;
    outline: none; font-size: 13px; color: #f8f4ec;
    background: #0a0a0a; font-family: 'Poppins', sans-serif;
    resize: none; min-height: 20px; max-height: 100px; line-height: 1.4;
}
#ds-chat-input:focus { border-color: var(--chat-accent); }
#ds-chat-input::placeholder { color: #555; font-weight: 400; }

#ds-chat-send {
    background: var(--chat-accent); color: #000;
    border: var(--chat-border); border-radius: 6px;
    padding: 8px 18px; cursor: pointer; font-weight: bold;
    text-transform: uppercase; font-size: 13px;
    box-shadow: 3px 3px 0 #000; transition: all 0.15s;
    font-family: 'Bangers', cursive; letter-spacing: 1px;
}
#ds-chat-send:hover { transform: translate(2px,2px); box-shadow: 1px 1px 0 #000; }

/* Quick reply & starter buttons */
.ds-quick-btn {
    display: inline-block; background: #1a1a1a; color: var(--chat-cyan);
    border: 2px solid var(--chat-cyan); border-radius: 6px;
    padding: 6px 10px; margin: 6px 4px 0 0; cursor: pointer;
    font-family: 'Poppins', sans-serif; font-size: 15px; letter-spacing: 0.5px;
    transition: all 0.15s;
}
.ds-quick-btn:hover { background: var(--chat-cyan); color: #0a0a0a; }

.ds-conversation-starters { padding: 4px 0; display: flex; flex-wrap: wrap; gap: 4px; }

/* Ticket buttons */
.ds-ticket-btns { display: flex; gap: 4px; }
.ds-ticket-btn { background: transparent; border: none; font-size: 16px; cursor: pointer; padding: 2px; transition: transform 0.2s; }
.ds-ticket-btn:hover { transform: scale(1.2); }

/* Error & retry */
.ds-error { color: var(--chat-pink); font-size: 12px; }
.ds-retry-btn {
    background: #1a1a1a; border: 2px solid var(--chat-pink); border-radius: 6px;
    padding: 4px 10px; cursor: pointer; font-weight: bold; font-size: 12px;
    color: var(--chat-pink); margin-top: 6px;
}
.ds-retry-btn:hover { background: var(--chat-pink); color: #fff; }

/* Ticket panel */
.ds-ticket-panel { background: #1a1a1a; border: 2px solid var(--chat-cyan); border-radius: 10px; padding: 14px; max-width: 100%; font-size: 13px; color: #f8f4ec; }

/* Mobile */
@media (max-width: 768px) {
    /* A chat összecsukva: kompakt pirula a jobb alsó sarokban (16px-re a jobb széltől) */
    #ds-chat-container { bottom: 16px; right: 16px; }

    #ds-chat-container #ds-chat-window.ds-chat-collapsed {
        width: auto; max-width: calc(100vw - 32px);
        height: 48px; min-height: 48px; border-radius: 999px;
        bottom: auto; right: auto; transform: none;
        box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
        padding: 0 14px; background: var(--chat-accent);
    }
    #ds-chat-container #ds-chat-window.ds-chat-collapsed #ds-chat-messages,
    #ds-chat-container #ds-chat-window.ds-chat-collapsed #ds-chat-footer { display: none; }
    #ds-chat-container #ds-chat-window.ds-chat-collapsed #ds-chat-header {
        height: 100%; padding: 0; border-radius: 999px; justify-content: center; border: none; gap: 8px;
    }
    #ds-chat-container #ds-chat-window.ds-chat-collapsed #ds-chat-header span {
        display: inline-block;
        font-family: 'Bangers', cursive;
        font-size: 16px; letter-spacing: 1px; text-transform: uppercase;
        color: #0a0a0a;
        max-width: 22vw;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    #ds-chat-container #ds-chat-window.ds-chat-collapsed .ds-header-actions { display: none; }

    /* A scroll-top ne lógjon a chat-pirulára */
    body:has(#ds-chat-window.ds-chat-collapsed) .pp-scroll-top { bottom: 78px; }

    #ds-chat-container #ds-chat-window:not(.ds-chat-collapsed) {
        position: fixed; bottom: 20px; left: 20px; right: 20px;
        width: calc(100% - 40px); height: 70vh; max-height: none;
        border-radius: 12px; transform: none;
        box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 20px rgba(255,204,0,0.2);
    }
}

/* Oldalra vivő gomb (GOMB-URL) */
.ds-link-btn {
    display: block; margin-top: 10px; text-align: center;
    background: var(--chat-cyan); color: #0a0a0a;
    border: 2px solid #000; border-radius: 8px;
    padding: 8px 14px; font-family: var(--chat-font, 'Bangers', cursive);
    font-size: 14px; text-decoration: none; letter-spacing: 1px;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.4);
    transition: all 0.15s;
}
.ds-link-btn:hover { transform: translateY(-2px); color: #0a0a0a; background: #fff; }

/* Followup csík (minden AI válasz alatt) */
.ds-followup {
    margin-top: 8px; border-top: 2px dashed rgba(255,255,255,0.12); padding-top: 8px;
}
.ds-followup-text { font-size: 11px; color: #b0b3c0; display: block; margin-bottom: 6px; }
.ds-followup-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ds-followup .ds-fb-thanks { display: block; margin-top: 6px; }
.ds-fu-btn {
    display: inline-block; background: #1a1a1a; color: var(--chat-cyan);
    border: 2px solid var(--chat-cyan); border-radius: 6px;
    padding: 5px 9px; cursor: pointer;
    font-family: 'Poppins', sans-serif; font-size: 13px; letter-spacing: 0.3px;
    transition: all 0.15s;
}
.ds-fu-btn:hover { background: var(--chat-cyan); color: #0a0a0a; }
.ds-email-btn { font-family: 'Poppins', sans-serif; font-size: 14px; padding: 5px 9px; }

/* Visszajelzés gombok */
.ds-feedback {
    display: flex; align-items: center; gap: 6px;
    margin-top: 8px; border-top: 2px dashed rgba(255,255,255,0.12); padding-top: 6px;
}
.ds-fb-btn {
    background: #1a1a1a; border: 2px solid #444; border-radius: 6px;
    font-size: 12px; line-height: 1; padding: 2px 6px;
    cursor: pointer; transition: all 0.15s;
}
.ds-fb-btn:hover { border-color: var(--chat-accent); transform: scale(1.1); }
.ds-fb-btn.ds-fb-sent { opacity: 0.45; pointer-events: none; }
.ds-fb-thanks { font-size: 10px; color: var(--chat-green); font-family: 'Poppins', sans-serif; }

/* Kijelentkezett ticket-jelzés (gomb) */
.ds-ticket-logged-out {
    font-size: 11px; color: #aaa; text-decoration: none;
    border: 2px solid #444; border-radius: 8px; padding: 3px 10px;
    background: #1a1a1a; font-family: var(--chat-font, 'Bangers', cursive);
    letter-spacing: 1px; box-shadow: 2px 2px 0 rgba(0,0,0,0.35);
    transition: all 0.15s;
}
.ds-ticket-logged-out:hover {
    color: var(--chat-accent); border-color: var(--chat-accent);
    background: #222; transform: translateY(-1px);
}
