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

:root {
    --chat-primary-bg: #d3d3d3;
    --chat-accent: #ffcc00;
    --chat-border: 3px solid #000000;
    --chat-shadow: 6px 6px 0px #000000;
    --chat-shadow-hover: 2px 2px 0px #000000;
    --chat-font: 'Poppins', sans-serif;
}

#ds-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: var(--chat-font);
}

#ds-chat-window {
    width: 350px;
    height: 500px;
    max-height: 80vh;
    background: var(--chat-primary-bg);
    border: var(--chat-border);
    border-radius: 10px 10px 0 0;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(0);
}

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

#ds-chat-header {
    height: 60px;
    background-color: var(--chat-accent);
    padding: 0 15px;
    border-bottom: var(--chat-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: filter 0.2s;
}

#ds-chat-header:hover { filter: brightness(0.95); }

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

.ds-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

#ds-chat-close {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    font-weight: bold;
    color: #000;
    transition: transform 0.2s;
}
#ds-chat-close:hover { transform: scale(1.2); }

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

/* Messages */
#ds-chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #545454;
}

.ds-message {
    padding: 12px 18px;
    border: var(--chat-border);
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    box-shadow: 3px 3px 0px #000;
    font-size: 0.85rem;
    font-weight: bold;
    position: relative;
}

.ai-message {
    align-self: flex-start;
    background-color: #ffffff;
    border-bottom-left-radius: 0;
}

.user-message {
    align-self: flex-end;
    background-color: var(--chat-accent);
    border-bottom-right-radius: 0;
}

/* Timestamp */
.ds-timestamp {
    display: block;
    font-size: 0.65rem;
    color: #999;
    margin-top: 6px;
    font-weight: normal;
    text-align: right;
}

.user-message .ds-timestamp {
    color: #666;
}

/* Typing indicator */
.ds-typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 0;
    flex-wrap: wrap;
}
.ds-typing-text {
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    font-style: italic;
    margin-bottom: 4px;
}
.ds-typing-dot {
    width: 8px; height: 8px;
    background-color: 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; }
.ds-typing-dot:nth-child(4) { animation-delay: 0.6s; }

@keyframes dsBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
    40% { transform: translateY(-8px); opacity: 1; }
}

/* Footer */
#ds-chat-footer {
    padding: 15px;
    border-top: var(--chat-border);
    display: flex;
    gap: 10px;
    background-color: var(--chat-primary-bg);
    align-items: flex-end;
}

#ds-chat-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: var(--chat-border);
    border-radius: 8px;
    outline: none;
    font-size: 0.85rem;
    font-weight: bold;
    color: #000;
    font-family: var(--chat-font);
    resize: none;
    min-height: 20px;
    max-height: 120px;
    line-height: 1.4;
}

#ds-chat-input:focus { background-color: #fffde7; }
#ds-chat-input::placeholder { color: #666; font-weight: 500; }

#ds-chat-send {
    background-color: #00ffff;
    color: #000;
    box-shadow: 4px 4px 0px #1d2327;
    border: var(--chat-border);
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s;
}

#ds-chat-send:hover {
    transform: translate(3px, 3px);
    box-shadow: 1px 1px 0px #1d2327;
    background-color: var(--chat-accent);
}

/* Quick reply buttons */
.ds-quick-btn {
    display: inline-block;
    background-color: var(--chat-primary-bg);
    color: #000;
    border: 2px solid #000;
    border-radius: 6px;
    padding: 6px 12px;
    margin: 8px 5px 0 0;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 2px 2px 0px #000;
    transition: all 0.2s;
}

.ds-quick-btn:hover {
    background-color: var(--chat-accent);
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px #000;
}

/* Conversation starters */
.ds-conversation-starters {
    padding: 5px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

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

/* Error & retry */
.ds-error {
    color: #d63638;
    font-size: 0.8rem;
}
.ds-retry-btn {
    background: var(--chat-primary-bg);
    border: 2px solid #000;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.75rem;
    margin-top: 6px;
    transition: all 0.2s;
}
.ds-retry-btn:hover {
    background: var(--chat-accent);
}

/* Ticket panel */
.ds-ticket-panel {
    background: #fff;
    border: var(--chat-border);
    border-radius: 12px;
    padding: 15px;
    max-width: 100%;
    font-size: 0.85rem;
}

/* Images */
#ds-chat-messages .ds-message img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    border-radius: 8px !important;
    margin: 15px 0 !important;
    border: 3px solid #000 !important;
    box-shadow: 4px 4px 0px #000 !important;
    box-sizing: border-box !important;
    background-color: #fff !important;
}

/* Mobile */
@media (max-width: 768px) {
    #ds-chat-container #ds-chat-window.ds-chat-collapsed {
        width: 60px;
        height: 60px;
        min-height: 60px;
        border-radius: 50%;
        bottom: 20px;
        right: 20px;
        transform: none;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        padding: 0;
        background-color: 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: 50%;
        justify-content: center;
    }

    #ds-chat-container #ds-chat-window.ds-chat-collapsed #ds-chat-header span,
    #ds-chat-container #ds-chat-window.ds-chat-collapsed #ds-chat-close,
    #ds-chat-container #ds-chat-window.ds-chat-collapsed .ds-header-actions {
        display: none;
    }

    #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: 15px;
        transform: none;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }
}
