/*
 * AI Chat Agent - Midnight Premium UI
 * DanskAudit Institutional Style
 */

:root {
    --chat-primary: #004767;
    --chat-accent: #03bfcb;
    --chat-bg: rgba(0, 11, 26, 0.85);
    --chat-text: #ffffff;
    --chat-glass: rgba(255, 255, 255, 0.05);
}

.chat-widget-container {
    position: fixed;
    bottom: 60px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Floating Button */
.chat-trigger {
    width: 60px;
    height: 60px;
    background: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--chat-glass);
}

.chat-trigger:hover {
    transform: scale(1.1);
    background: var(--chat-accent);
}

.chat-trigger i {
    color: white;
    font-size: 24px;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: var(--chat-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--chat-glass);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.6);
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chat-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--chat-primary), #001a33);
    border-bottom: 1px solid var(--chat-glass);
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-logo-mini {
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.chat-logo-mini .dansk {
    font-weight: 900;
    color: #FFF;
}

.chat-logo-mini i {
    font-size: 10px;
    color: var(--chat-accent);
    margin: 0 5px;
    font-style: normal;
}

.chat-logo-mini .audit {
    font-weight: 400;
    color: #CCC;
}

/* Header titles handled in HTML */

/* Message Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--chat-primary) transparent;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-primary);
    border-radius: 10px;
}

/* Message Wrappers & Avatars */
.message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 5px;
}

.message-wrapper.user {
    justify-content: flex-end;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--chat-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--chat-glass);
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-avatar i {
    color: white;
    font-size: 16px;
}

/* Bubbles */
.message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    animation: bubbleIn 0.3s ease-out forwards;
}

@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.ai {
    background: var(--chat-glass);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    box-shadow: 1px 1px 7px 0px rgba(3, 191, 203, 0.4);
}

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

/* Typing Indicator */
.typing {
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-text {
    animation: typing-color-pulse 2s infinite ease-in-out;
}

.typing-dots span {
    animation: typing-dot-flow 1.5s infinite;
    opacity: 0;
    font-weight: 900;
    font-size: 16px;
    line-height: 0;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot-flow {
    0% { opacity: 0; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
    100% { opacity: 0; transform: translateY(0); }
}

@keyframes typing-color-pulse {
    0%, 100% { color: #ffffff; }
    50% { color: var(--chat-accent); }
}

/* Input Area */
.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--chat-glass);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    background: var(--chat-glass);
    border: 1px solid var(--chat-glass);
    padding: 12px 15px;
    border-radius: 25px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input-area input:focus {
    border-color: var(--chat-accent);
}

.chat-input-area button {
    background: var(--chat-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

.chat-input-area button:hover {
    background: var(--chat-accent);
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        right: -10px;
        height: 80vh;
    }
}

/* Interactive Components - Confirmation UI */
.confirmation-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    animation: bubbleIn 0.4s ease-out forwards;
}

.chat-btn-group {
    display: flex;
    gap: 10px;
    width: 100%;
}

.chat-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--chat-glass);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: white;
}

.chat-btn-confirm {
    background: var(--chat-primary);
    border-color: var(--chat-accent);
}

.chat-btn-confirm:hover {
    background: var(--chat-accent);
    color: var(--chat-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(3, 191, 203, 0.3);
}

.chat-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.chat-btn-cancel:hover {
    background: rgba(255, 87, 87, 0.2);
    border-color: #ff5757;
    color: #ff5757;
    transform: translateY(-2px);
}
