/* ==========================================================================
   Baykusoftware — Codex Monochrome AI Widget
   Architecture: High-Contrast Black & White, Zero Emoji, Minimalist
   ========================================================================== */

:root {
    --ai-primary: #ffffff;
    --ai-bg-dark: #0a0a0a;
    --ai-surface-dark: #121212;
    --ai-surface-hover: #181818;
    --ai-border-dark: rgba(255, 255, 255, 0.12);
    --ai-text-dark: #ffffff;
    --ai-muted-dark: #a1a1aa;
    --ai-radius-lg: 12px;
    --ai-radius-md: 8px;
    --ai-radius-sm: 6px;
    --ai-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ai-font-mono: 'JetBrains Mono', monospace;
}

/* Chat Trigger Button - Sleek Dark Button with Crisp White Border */
#ai-chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    height: 44px;
    padding: 0 18px;
    border-radius: 9999px;
    background: #0a0a0a;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--ai-font-mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    z-index: 9990;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#ai-chat-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.4);
    background: #141414;
    box-shadow: 0 12px 35px rgba(255, 255, 255, 0.08);
}

#ai-online-dot {
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    animation: codex-pulse 2s infinite ease-in-out;
}

@media (max-width: 500px) {
    #ai-chat-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
    #ai-chat-btn-label {
        display: none;
    }
}

/* Chat Dialog Window */
#ai-chat-window {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100dvh - 100px);
    background: #0a0a0a;
    color: #ffffff;
    border: 1px solid var(--ai-border-dark);
    border-radius: var(--ai-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9995;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--ai-font);
}

#ai-chat-window.open {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Chat Header */
#ai-chat-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--ai-border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0d0d0d;
}

.ai-hdr-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-hdr-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.ai-hdr-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.ai-hdr-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--ai-muted-dark);
    font-family: var(--ai-font-mono);
}

.ai-hdr-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-hdr-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--ai-muted-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-hdr-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

/* Name Capture Form */
#ai-name-form {
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex: 1;
}

.ai-nf-badge {
    font-family: var(--ai-font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ai-muted-dark);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ai-border-dark);
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.ai-nf-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #ffffff;
    letter-spacing: -0.4px;
}

.ai-nf-sub {
    font-size: 13px;
    color: var(--ai-muted-dark);
    line-height: 1.5;
    margin: 0 0 24px 0;
    max-width: 280px;
}

#ai-name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: var(--ai-radius-md);
    background: #141414;
    border: 1px solid var(--ai-border-dark);
    color: #ffffff;
    font-family: var(--ai-font);
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}

#ai-name-input:focus {
    border-color: rgba(255, 255, 255, 0.4);
}

#ai-name-submit {
    width: 100%;
    padding: 12px;
    border-radius: var(--ai-radius-md);
    background: #ffffff;
    color: #000000;
    border: none;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: -0.2px;
    cursor: pointer;
    transition: background 0.15s;
}

#ai-name-submit:hover {
    background: #e4e4e7;
}

/* Chat Messages Area */
#ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 84%;
    font-size: 13.5px;
    line-height: 1.55;
}

/* User Message: Koyu Mavi Baloncuk */
.ai-msg.user,
.ai-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}

.ai-msg.user .ai-msg-bubble,
.ai-msg-user {
    background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);
    color: #ffffff;
    padding: 11px 16px;
    border-radius: 14px 14px 3px 14px;
    font-weight: 500;
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.5);
    word-break: break-word;
}

/* Assistant Message: Koyu Gri Baloncuk */
.ai-msg.assistant,
.ai-msg-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.ai-msg.assistant .ai-msg-bubble,
.ai-msg-assistant {
    background: #18191e;
    color: #f4f4f5;
    border: 1px solid rgba(255, 255, 255, 0.11);
    padding: 12px 16px;
    border-radius: 14px 14px 14px 3px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    word-break: break-word;
}

.ai-msg-time {
    font-family: var(--ai-font-mono);
    font-size: 10px;
    color: #71717a;
    margin-top: 4px;
    padding: 0 4px;
}

/* Quick Action Buttons - Streamlined */
#ai-quick-btns {
    padding: 10px 14px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: #0d0d0f;
    scrollbar-width: none;
}

#ai-quick-btns::-webkit-scrollbar {
    display: none;
}

.ai-qbtn {
    flex-shrink: 0;
    font-size: 11.5px;
    font-family: var(--ai-font-mono);
    padding: 7px 14px;
    border-radius: 20px;
    background: #16171b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #d4d4d8;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ai-qbtn:hover {
    background: #22242a;
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Chat Footer / Input */
#ai-chat-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--ai-border-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    background: #0d0d0d;
}

#ai-chat-input {
    flex: 1;
    background: #141414;
    border: 1px solid var(--ai-border-dark);
    border-radius: var(--ai-radius-md);
    padding: 10px 14px;
    color: #ffffff;
    font-family: var(--ai-font);
    font-size: 13.5px;
    outline: none;
    resize: none;
    max-height: 80px;
    transition: border-color 0.15s;
}

#ai-chat-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
}

#ai-chat-send {
    width: 36px;
    height: 36px;
    border-radius: var(--ai-radius-md);
    background: #ffffff;
    color: #000000;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

#ai-chat-send:hover {
    background: #e4e4e7;
}

#ai-chat-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Toast Container */
#ai-toast-container {
    position: absolute;
    top: 60px;
    left: 16px;
    right: 16px;
    z-index: 10;
    pointer-events: none;
}

.ai-toast {
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}
