/* ==========================================================================
   AETHEL COPILOT — State-of-the-Art Architecture & Scoping Assistant
   ========================================================================== */

/* --- Floating Launcher Button --- */
.aethel-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-teaser-bubble {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.09);
    padding: 8px 16px;
    border-radius: 100px;
    box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-primary, #141312);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: teaserFloat 3s ease-in-out infinite alternate;
}

.chat-teaser-bubble:hover {
    transform: translateY(-2px);
    border-color: var(--accent-warm, #c17d3c);
    color: var(--accent-warm, #c17d3c);
}

.teaser-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite ease-out;
}

.chat-launcher-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1c1a18 0%, #100f0e 100%);
    border: 1px solid rgba(193, 125, 60, 0.4);
    box-shadow: 0 12px 36px -6px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(193, 125, 60, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    font-size: 1.35rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.chat-launcher-btn:hover {
    transform: scale(1.08) translateY(-2px);
    border-color: rgba(193, 125, 60, 0.8);
    box-shadow: 0 16px 42px -6px rgba(193, 125, 60, 0.35), 0 0 0 3px rgba(193, 125, 60, 0.25);
}

.launcher-icon-chat,
.launcher-icon-close {
    transition: all 0.25s ease;
}

.chat-launcher-btn.active .launcher-icon-chat {
    display: none;
}

.chat-launcher-btn:not(.active) .launcher-icon-close {
    display: none;
}

.launcher-pulse-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid rgba(193, 125, 60, 0.5);
    animation: launcherPulse 2.4s infinite ease-out;
    pointer-events: none;
}

@keyframes launcherPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

@keyframes teaserFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-4px); }
}

/* --- Chatbot Modal Window --- */
.aethel-chat-modal {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: min(calc(100vw - 36px), 430px);
    height: 640px;
    max-height: calc(100vh - 120px);
    background: #141312;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 28px 80px -16px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(193, 125, 60, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transform-origin: bottom right;
    transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.aethel-chat-modal.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chat-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-header-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #1c1a18;
    border: 1px solid rgba(193, 125, 60, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chat-header-text h4 {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-copilot-tag {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(193, 125, 60, 0.2);
    color: var(--accent-warm, #c17d3c);
    padding: 2px 6px;
    border-radius: 4px;
}

.chat-status-sub {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.chat-status-sub .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-tool-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.chat-tool-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

/* Quick Prompts Bar */
.chat-quick-prompts {
    display: flex;
    gap: 8px;
    padding: 12px 18px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-quick-prompts::-webkit-scrollbar {
    display: none;
}

.quick-prompt-pill {
    white-space: nowrap;
    padding: 5px 12px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.quick-prompt-pill:hover {
    background: rgba(193, 125, 60, 0.18);
    border-color: rgba(193, 125, 60, 0.4);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Messages Stream */
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(193, 125, 60, 0.3) transparent;
}

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

.chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: rgba(193, 125, 60, 0.3);
    border-radius: 10px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(193, 125, 60, 0.6);
}

.chat-msg {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: msgFadeIn 0.25s ease-out;
}

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

.chat-msg.bot {
    align-self: flex-start;
}

.chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #1c1a18;
    border: 1px solid rgba(193, 125, 60, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.84rem;
    line-height: 1.6;
}

.chat-msg.bot .msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e2e2;
    border-top-left-radius: 4px;
}

.chat-msg.user .msg-bubble {
    background: var(--accent-warm, #c17d3c);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(193, 125, 60, 0.25);
}

.msg-bubble p {
    color: inherit;
    font-size: inherit;
    line-height: inherit;
    margin-bottom: 8px;
}

.msg-bubble p:last-child {
    margin-bottom: 0;
}

.msg-bubble ul {
    margin: 8px 0 8px 18px;
    padding: 0;
}

.msg-bubble li {
    margin-bottom: 4px;
}

.msg-bubble strong {
    color: #ffffff;
    font-weight: 600;
}

.msg-bubble code {
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.78rem;
    color: #f7a950;
}

/* Rich Cards inside Chatbot */
.chat-brief-card {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(193, 125, 60, 0.3);
    border-radius: 12px;
    padding: 14px 16px;
}

.brief-card-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-warm, #c17d3c);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.brief-card-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.76rem;
    color: #cccccc;
}

.brief-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.brief-row-lbl {
    color: rgba(255, 255, 255, 0.5);
}

.brief-row-val {
    color: #ffffff;
    font-weight: 500;
    text-align: right;
}

.chat-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.chat-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 100px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.chat-action-btn.primary {
    background: var(--accent-warm, #c17d3c);
    color: #ffffff !important;
    border: none;
}

.chat-action-btn.primary:hover {
    background: #a8692c;
    transform: translateY(-1px);
}

.chat-action-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff !important;
}

.chat-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Typing Indicator */
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    border-top-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Footer Input Bar */
.chat-modal-footer {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px 8px 6px 14px;
    transition: border-color 0.2s;
}

.chat-input-form:focus-within {
    border-color: rgba(193, 125, 60, 0.6);
    box-shadow: 0 0 0 2px rgba(193, 125, 60, 0.15);
}

.chat-textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.84rem;
    line-height: 1.4;
    resize: none;
    outline: none;
    max-height: 80px;
    padding: 4px 0;
}

.chat-textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.chat-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent-warm, #c17d3c);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: #a8692c;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-privacy-hint {
    font-size: 0.66rem;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    margin-top: 8px;
}

.chat-privacy-hint a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .aethel-chat-launcher {
        bottom: 16px;
        right: 16px;
    }

    .chat-teaser-bubble {
        display: none;
    }

    .aethel-chat-modal {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }
}
