/* Athena AI Agent Frontend Styles - SpaceX/NASA inspired */
:root {
    --aa-bg: #0b0f19;
    --aa-surface: #1a1f35;
    --aa-surface-light: #252b48;
    --aa-primary: #3b82f6;
    --aa-primary-hover: #2563eb;
    --aa-accent: #00d4ff;
    --aa-text: #f8fafc;
    --aa-text-secondary: #cbd5e1;
    --aa-border: #334155;
    --aa-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --aa-radius: 16px;
    --aa-radius-sm: 8px;
    --aa-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Root container */
.aa-root {
    font-family: var(--aa-font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--aa-text);
}

/* Launcher button - vertical edge "CHAT" pill (desktop) */
.aa-launcher {
    position: fixed;
    bottom: 90px;              /* adjust up/down as you like */
    right: 0;                   /* hug right edge */
    width: 30px;                /* thickness from edge */
    height: 100px;              /* length along edge */
    padding: 0;
    border: none;
    border-radius: 10px 0 0 10px;
    background: #000;
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    transition:
        transform 0.26s cubic-bezier(0.33, 1, 0.68, 1),
        box-shadow 0.26s cubic-bezier(0.33, 1, 0.68, 1),
        background 0.26s ease,
        opacity 0.26s ease;
}

.aa-launcher:hover {
    transform: translateX(-1px);  /* slide slightly into the page on hover */
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
}

/* Inner core: rotated "CHAT" label */
.aa-launcher-core {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    border-radius: 0;
    font-family: var(--aa-font);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #e5e7eb;
    text-shadow: 0 0 6px rgba(15, 23, 42, 0.9);
    white-space: nowrap;

    /* Rotate just the text so it reads along the pill */
    transform: rotate(-90deg);
}

.aa-launcher-core::before {
    content: "AI CHAT";
}

/* Subtle tech accent line under the rotated text */
.aa-launcher-core::after {
    content: "";
    position: absolute;
    left: -10px;
    right: -10px;
    bottom: -4px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(148, 163, 253, 0.9),
        transparent
    );
    opacity: 0.8;
    box-shadow: 0 0 8px rgba(148, 163, 253, 0.9);
}




/* Floating chat window */
.aa-chat {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 450px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--aa-bg);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    box-shadow: var(--aa-shadow);
    z-index: 9999;
    /* IMPORTANT: hidden by default to prevent flash */
    display: none;
    opacity: 0;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
    transition: opacity 0.3s ease;
}

/* Desktop-only: make chat taller and wider */
@media (min-width: 769px) {
  .aa-chat {
    width: 480px;
    height: 80vh;
    max-height: 80vh;
    bottom: 24px; /* adjust if you want it higher/lower */
  }
}

/* Extra large screens: even wider */
@media (min-width: 1400px) {
  .aa-chat {
    width: 520px;
  }
}


/* Visible state controlled by JS */
.aa-chat.aa-open {
    display: flex;
    opacity: 1;
}

.aa-chat-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* Header */
.aa-chat-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--aa-surface);
    border-bottom: 1px solid var(--aa-border);
    cursor: move;
    user-select: none;
    gap: 8px;
    min-height: 70px;
}

.aa-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.aa-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.aa-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.aa-titles {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.aa-titles strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aa-titles span {
    font-size: 11px;
    color: var(--aa-text-secondary);
}

.aa-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aa-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: aa-pulse 2s infinite;
}

@keyframes aa-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.aa-controls {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.aa-iconbtn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--aa-text-secondary);
    border-radius: var(--aa-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.aa-iconbtn:hover {
    background: var(--aa-surface-light);
    color: var(--aa-text);
}

.aa-iconbtn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    color: var(--aa-text);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
}

/* Chat log */
.aa-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aa-message {
    max-width: 85%;
    display: flex;
    gap: 12px;
    animation: aa-message-appear 0.3s ease-out;
}

.aa-message-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.aa-message-bubble {
    padding: 12px 16px;
    border-radius: var(--aa-radius-sm);
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    /* Glassmorphism base */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: all 0.3s ease;
}

@keyframes aa-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aa-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.aa-message-user .aa-message-bubble {
    background: rgba(59, 130, 246, 0.25);
    color: white;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 32px 0 rgba(59, 130, 246, 0.3);
}

.aa-message-assistant {
    align-self: flex-start;
}

.aa-message-assistant .aa-message-bubble {
    background: rgba(37, 43, 72, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-bottom-left-radius: 4px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.aa-message-thinking {
    opacity: 0.95;
}

.aa-message-thinking .aa-message-avatar {
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.aa-message-thinking .aa-message-bubble {
    background: var(--aa-brand-thinking-bubble-bg, rgba(15, 23, 42, 0.55));
    color: var(--aa-brand-thinking-bubble-text, var(--aa-brand-ai-bubble-text, #f8fafc));
    border: 1px solid var(--aa-brand-thinking-bubble-border, rgba(96, 165, 250, 0.35));
    box-shadow: 0 15px 45px rgba(15, 23, 42, 0.45);
    position: relative;
    overflow: hidden;
    animation: aaThinkingPulse 4s ease-in-out infinite;
}

.aa-message-thinking .aa-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aa-message-thinking .aa-content,
.aa-thinking-bubble .aa-typing-status {
    color: var(--aa-brand-thinking-bubble-text, var(--aa-brand-ai-bubble-text, #f8fafc));
}

.aa-thinking-bubble .aa-typing-status {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    animation: aaThinkingText 2.6s ease-in-out infinite;
}

.aa-thinking-bubble .aa-typing-dots {
    position: relative;
    width: 60px;
    height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    gap: 0;
}

.aa-thinking-bubble .aa-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--aa-brand-thinking-bubble-dots, var(--aa-accent, #00d4ff));
    border-radius: 50%;
    display: inline-block;
    position: relative;
    animation: aaThinkingDotMove 1.8s infinite ease-in-out;
    will-change: transform, opacity;
    box-shadow: 0 0 8px var(--aa-brand-thinking-bubble-dots, rgba(0, 212, 255, 0.8)), 0 0 12px rgba(0, 0, 0, 0.2);
}
.aa-thinking-bubble .aa-typing-dot:nth-child(1) {
    animation-delay: 0s;
}
.aa-thinking-bubble .aa-typing-dot:nth-child(2) {
    animation-delay: 0.3s;
}
.aa-thinking-bubble .aa-typing-dot:nth-child(3) {
    animation-delay: 0.6s;
}

.aa-thinking-bubble::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 10% 20%, var(--aa-brand-thinking-bubble-overlay, rgba(148, 163, 253, 0.25)), transparent 45%),
                radial-gradient(circle at 80% 0%, var(--aa-brand-thinking-bubble-overlay, rgba(96, 165, 250, 0.25)), transparent 55%);
    mix-blend-mode: screen;
    animation: aaThinkingGlow 6s linear infinite;
    pointer-events: none;
}

@keyframes aaThinkingPulse {
    0%, 100% { transform: translateY(0); box-shadow: 0 15px 45px rgba(15, 23, 42, 0.45); }
    50% { transform: translateY(-3px); box-shadow: 0 20px 55px rgba(15, 23, 42, 0.55); }
}

@keyframes aaThinkingGlow {
    0% { transform: translateX(-20%); opacity: 0.4; }
    50% { transform: translateX(10%); opacity: 0.8; }
    100% { transform: translateX(40%); opacity: 0.4; }
}

@keyframes aaThinkingText {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; }
}

@keyframes aaThinkingDotMove {
    0% {
        transform: translateX(-20px) scale(0.6);
        opacity: 0.3;
    }
    20% {
        opacity: 1;
        transform: translateX(-10px) scale(0.8);
    }
    50% {
        transform: translateX(0px) scale(1);
        opacity: 1;
    }
    80% {
        opacity: 1;
        transform: translateX(10px) scale(0.8);
    }
    100% {
        transform: translateX(20px) scale(0.6);
        opacity: 0.3;
    }
}

/* Message Avatar */
.aa-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}

.aa-message-user .aa-message-avatar {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.aa-message-assistant .aa-message-avatar {
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-accent));
}

/* Message Meta (timestamp + actions) */
.aa-message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 11px;
    color: #64748b;
    flex-wrap: wrap;
}

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

.aa-message-timestamp {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.7;
}

/* Message Action Buttons */
.aa-message-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.aa-message:hover .aa-message-actions {
    opacity: 1;
}

.aa-message-action-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 4px 8px;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}

.aa-message-action-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--aa-text);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.aa-message-action-btn.active {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.aa-message-action-btn.negative {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.aa-message-action-btn.copied {
    background: var(--aa-primary);
    color: white;
    border-color: var(--aa-primary);
}

/* Copy button in assistant messages */
.aa-copy {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 2px 8px;
  font-size: 10px;
  border-radius: 999px;
  border: 1px solid var(--aa-border);
  background: rgba(15,23,42,0.98);
  color: var(--aa-text-secondary);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.aa-message-assistant:hover .aa-copy {
  opacity: 1;
  pointer-events: auto;
}


/* Message labels */
.aa-message-label {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aa-message-user .aa-message-label {
    text-align: right;
    color: var(--aa-accent);
}

.aa-message-assistant .aa-message-label {
    color: var(--aa-accent);
}

.aa-message-assistant .aa-citations {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--aa-border);
    font-size: 12px;
    color: var(--aa-text-secondary);
}

.aa-message-assistant .aa-citations a {
    color: var(--aa-accent);
    text-decoration: none;
}

.aa-message-assistant .aa-citations a:hover {
    text-decoration: underline;
}

.aa-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--aa-border);
}

.aa-actions-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--aa-accent);
    margin-bottom: 8px;
}

.aa-actions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aa-action-item {
    font-size: 12px;
    color: var(--aa-text-secondary);
    padding-left: 12px;
    position: relative;
}

.aa-action-item:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--aa-accent);
}

/* Enhanced Typing Indicator */
.aa-typing-indicator {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: 85%;
    animation: aa-message-appear 0.3s ease-out;
}

.aa-typing-bubble {
    background: var(--aa-surface-light);
    border: 1px solid var(--aa-border);
    padding: 12px 16px;
    border-radius: var(--aa-radius-sm);
    border-bottom-left-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aa-typing-status {
    font-size: 12px;
    color: var(--aa-accent);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aa-typing-dots {
    display: flex;
    gap: 4px;
}

.aa-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    animation: aa-typing-bounce 1.4s infinite;
}

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

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

@keyframes aa-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Quick Actions Bar */
.aa-quick-actions {
    padding: 10px 12px;
    background: var(--aa-surface);
    border-top: 1px solid var(--aa-border);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.aa-quick-actions::-webkit-scrollbar {
    display: none;
}

.aa-quick-action {
    padding: 6px 10px;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    flex-shrink: 0;
}

.aa-quick-action span {
    font-size: 13px;
}

.aa-quick-action:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.aa-quick-action:active {
    transform: translateY(0);
}

/* Suggestions - Hidden to save space */
.aa-chat-suggestions {
    display: none !important;
}

/* Chip styles removed - using quick actions instead */

/* AI Disclaimer - above input area */
.aa-ai-disclaimer {
    padding: 8px 16px;
    background: var(--aa-surface);
    border-top: 1px solid var(--aa-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--aa-text-secondary);
    flex-shrink: 0;
}

/* Phone call button styling */
.aa-phone-call {
    margin-top: 12px;
    text-align: center;
}

.aa-phone-call-btn {
    display: inline-block !important;
    padding: 12px 24px !important;
    background: var(--aa-primary, #3b82f6) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    font-size: 14px !important;
    text-decoration: none !important;
    transition: all 0.2s !important;
}

.aa-phone-call-btn:hover {
    opacity: 0.9 !important;
    transform: scale(1.02) !important;
}

.aa-phone-call-btn:visited,
.aa-phone-call-btn:active,
.aa-phone-call-btn:link {
    color: #ffffff !important;
}

.aa-disclaimer-icon {
    font-size: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

.aa-disclaimer-text {
    flex: 1;
    color: var(--aa-text-secondary);
}

/* Input area - full-width pill with sleek inline buttons */
.aa-chat-input {
    padding: 12px 16px 8px;
    border-top: 1px solid var(--aa-border);
    background: var(--aa-surface);
    position: relative;
}

/* Chat footer - "Powered by Athena SEO AI ©" */
.aa-chat-footer {
    padding: 6px 16px !important;
    font-size: 9px !important;
    color: var(--aa-text-secondary);
    border-top: 1px solid var(--aa-border);
    flex-shrink: 0;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    box-sizing: border-box;
    margin: 0 !important;
    text-align: center !important;
    line-height: 1.4 !important;
}

.aa-chat-footer,
.aa-chat-footer * {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.aa-chat-footer strong {
    color: var(--aa-text);
    font-weight: 600;
    display: inline;
}

.aa-chat-footer strong {
    color: var(--aa-text);
    font-weight: 600;
}

.aa-chat-footer a {
    color: inherit !important;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-bottom-color 0.2s ease;
}

.aa-chat-footer a:hover {
    color: var(--aa-text, #f8fafc) !important;
    border-bottom-color: currentColor;
}

/* Full-width rounded input */
.aa-chat-input textarea {
    width: 100%;
    box-sizing: border-box;
    background: var(--aa-bg);
    border: 1px solid var(--aa-border);
    border-radius: 999px;
    color: var(--aa-text);
    padding: 10px 120px 10px 14px; /* room for mic + send pills */
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    min-height: 42px;
    max-height: 140px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.aa-chat-input textarea:focus {
    outline: none;
    border-color: var(--aa-primary);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
    background: #020817;
}

/* Shared pill style for mic + send */
.aa-voice-btn,
.aa-send {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 30px;
    padding: 0 14px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.5);
}

/* Voice pill (subtle/ghost) */
.aa-voice-btn {
    right: 78px;
    background: rgba(10, 16, 30, 0.98);
    color: var(--aa-text-secondary);
    border: 1px solid rgba(148, 163, 253, 0.35);
    backdrop-filter: blur(10px);
}

.aa-voice-btn:hover {
    color: #e5e7eb;
    border-color: var(--aa-primary);
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.45);
    transform: translateY(-50%) translateX(-1px);
}

/* Send pill (primary gradient) */
.aa-send {
    right: 24px;
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-accent));
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.aa-send:hover {
    background: linear-gradient(135deg, var(--aa-primary-hover), var(--aa-accent));
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    transform: translateY(-50%) translateX(-1px);
}

/* Helper text */
.aa-mini {
    padding: 2px 16px 10px;
    font-size: 11px;
    color: var(--aa-text-secondary);
    text-align: center;
}

.aa-mini kbd {
    background: var(--aa-surface-light);
    border: 1px solid var(--aa-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
}




/* Quote Request Overlay */
.aa-quote-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 8, 23, 0.86);
    backdrop-filter: blur(8px);
    z-index: 50;
}

.aa-quote-overlay.is-visible {
    display: flex;
}

.aa-quote-panel {
    position: relative;
    width: min(540px, 100%);
    max-height: 92%;
    background: linear-gradient(180deg, rgba(3, 7, 18, 0.95), rgba(3, 7, 18, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(2, 8, 23, 0.7);
    padding: 28px;
    overflow-y: auto;
}

.aa-quote-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.6);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.aa-quote-close:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}

.aa-quote-header {
    margin-bottom: 20px;
}

.aa-quote-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: rgba(209, 213, 219, 0.9);
    margin-bottom: 10px;
}

.aa-quote-header h3 {
    margin: 0 0 6px 0;
    font-size: 26px;
    color: white;
    letter-spacing: -0.01em;
}

.aa-quote-summary {
    margin: 0;
    color: rgba(229, 231, 235, 0.85);
    font-size: 14px;
    line-height: 1.6;
}

.aa-quote-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.aa-quote-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.aa-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: rgba(229, 231, 235, 0.9);
}

.aa-field input,
.aa-field textarea,
.aa-field select {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.58);
    color: white;
    padding: 12px 14px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.aa-field textarea {
    min-height: 90px;
    resize: vertical;
    line-height: 1.5;
}

.aa-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbd5e1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

.aa-field input:focus,
.aa-field textarea:focus,
.aa-field select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.8);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    background: rgba(15, 23, 42, 0.85);
}

/* Date/Time input styling */
.aa-field input[type="date"],
.aa-field input[type="time"],
.aa-field input[type="datetime-local"] {
    color-scheme: dark;
    cursor: pointer;
    position: relative;
}

.aa-field input[type="date"]::-webkit-calendar-picker-indicator,
.aa-field input[type="time"]::-webkit-calendar-picker-indicator,
.aa-field input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(1);
    opacity: 0.8;
    padding: 4px;
    margin-left: 4px;
}

.aa-field input[type="date"]::-webkit-calendar-picker-indicator:hover,
.aa-field input[type="time"]::-webkit-calendar-picker-indicator:hover,
.aa-field input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Ensure datetime-local inputs are clickable */
.aa-field input[type="datetime-local"] {
    min-height: 44px;
    -webkit-appearance: none;
    appearance: none;
}

.aa-quote-status {
    min-height: 20px;
    font-size: 13px;
    color: rgba(229, 231, 235, 0.8);
}

.aa-quote-status.success {
    color: #6ee7b7;
}

.aa-quote-status.error {
    color: #fca5a5;
}

.aa-quote-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.aa-quote-cancel,
.aa-quote-submit {
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aa-quote-cancel {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: rgba(226, 232, 240, 0.8);
}

.aa-quote-cancel:hover {
    border-color: rgba(148, 163, 184, 0.5);
    transform: translateY(-1px);
}

.aa-quote-submit {
    background: linear-gradient(135deg, var(--aa-primary), var(--aa-accent));
    color: white;
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.35);
}

.aa-quote-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 38px rgba(59, 130, 246, 0.45);
}

.aa-quote-submit:active {
    transform: translateY(0);
}

.aa-quote-open .aa-chat-log,
.aa-quote-open .aa-chat-input {
    filter: blur(2px);
    pointer-events: none;
}

@media (max-width: 640px) {
    .aa-quote-overlay {
        padding: 0;
    }

    .aa-quote-panel {
        width: 100%;
        height: 100%;
        border-radius: 0;
        padding: 20px 16px !important; /* Reduced padding for mobile */
        max-height: 100vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .aa-quote-header h3 {
        font-size: 22px !important; /* Smaller title on mobile */
    }

    .aa-quote-grid {
        grid-template-columns: 1fr;
    }
}

.aa-form-message {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: var(--aa-radius-sm);
    font-size: 12px;
    text-align: center;
}

.aa-form-message.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.aa-form-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Responsive */
@media (max-width: 768px) {
.aa-launcher {
    bottom: 90px;              /* adjust so it doesn't clash with full-screen chat */
    right: 0;
    width: 30px;
    height: 100px;
    padding: 0;
    border-radius: 10px 0 0 10px;
    background: #000;
    box-shadow: 0 5px 5px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.aa-launcher-core {
    font-size: 10px;
}


  .aa-chat {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;

    /* Use the *visible* viewport height so the header never ends up above the screen */
    height: 100dvh;
    max-height: 100dvh;

    border-radius: 18px 18px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    overflow: hidden; /* prevent whole container from scrolling */
  }

  /* Fallback for browsers that don't support 100dvh */
  @supports not (height: 100dvh) {
    .aa-chat {
      height: calc(100vh - env(safe-area-inset-top, 0px));
      max-height: calc(100vh - env(safe-area-inset-top, 0px));
    }
  }

  .aa-chat-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100vw;
    overflow: hidden;
    padding-top: env(safe-area-inset-top, 6px);
  }
  
  /* Ensure input is always visible on mobile */
  .aa-chat-log {
    /* Allow chat log to shrink if needed to keep input visible */
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .aa-chat-header {
    padding: 12px 14px;
    cursor: default;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--aa-surface);
    border-bottom: 1px solid var(--aa-border);
  }

  .aa-logo {
    width: 28px;
    height: 28px;
    margin-right: 8px;
  }

  .aa-titles strong {
    font-size: 15px;
  }

  .aa-titles span {
    font-size: 11px;
  }

  /* Hide less-used controls on mobile */
  .aa-chat-header .aa-iconbtn[data-act="export"],
  .aa-chat-header .aa-iconbtn[data-act="clear"] {
    display: none;
  }

  .aa-chat-log {
    flex: 1;
    padding: 12px;
    padding-bottom: 20px; /* Extra padding to ensure input is visible on initial load */
    gap: 10px;
    overflow-y: auto;                /* key: only this scrolls */
    -webkit-overflow-scrolling: touch;
  }

  .aa-message {
    max-width: 92%;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.6;
  }

  .aa-copy {
    top: 4px;
    right: 6px;
    padding: 1px 6px;
    font-size: 9px;
  }

  .aa-ai-disclaimer {
    padding: 6px 12px;
    font-size: 10px;
    gap: 6px;
  }

  .aa-disclaimer-icon {
    font-size: 12px;
  }

  .aa-chat-input {
    padding: 8px 10px 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0; /* keep input bar fixed at bottom */
    background: var(--aa-surface);
    border-top: 1px solid var(--aa-border);
  }

  /* iOS-safe textarea: 16px stops zoom & layout jump */
  .aa-chat-input textarea {
    border-radius: 14px;
    padding: 10px 96px 10px 12px;
    min-height: 42px;
    font-size: 16px;
    line-height: 1.5;
  }

  .aa-voice-btn,
  .aa-send {
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
    top: 50%;
    transform: translateY(-50%);
  }

  .aa-voice-btn {
    right: 64px;
  }

  .aa-send {
    right: 16px;
  }

  .aa-mini {
    font-size: 10px;
    padding: 2px 10px 6px;
    flex-shrink: 0;
  }

  .aa-helper-tooltip {
    right: 16px;
    bottom: 90px;
    max-width: 70vw;
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* Ensure Athena chat always stays above all site elements */
.aa-chat,
.aa-launcher,
.aa-helper-tooltip {
  z-index: 999999 !important;
}




/* Drag state */
.aa-chat-shell[data-aa-dragging] {
    cursor: grabbing;
    user-select: none;
}

/* Collapsed state */
.aa-chat[data-aa-collapsed] {
    height: auto;
    max-height: 44px;
    overflow: hidden;
}

.aa-chat[data-aa-collapsed] .aa-chat-log,
.aa-chat[data-aa-collapsed] .aa-chat-suggestions,
.aa-chat[data-aa-collapsed] .aa-chat-input,
.aa-chat[data-aa-collapsed] .aa-mini {
    display: none;
}

/* Loading animation */
.aa-typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.aa-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--aa-text-secondary);
    border-radius: 50%;
    animation: aa-typing 1.4s infinite ease-in-out;
}

.aa-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.aa-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes aa-typing {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Fix for citations and contact form */
.aa-content {
  margin-bottom: 12px;
  /* Glassmorphism enhancement for content */
  position: relative;
}

.aa-message-bubble .aa-content {
  position: relative;
  z-index: 1;
}

/* Glassmorphism hover effect */
.aa-message-bubble:hover {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.5);
  transform: translateY(-1px);
}

/* Rich content bullet lists inside assistant messages */
.aa-message-assistant .aa-list {
  margin: 4px 0 0;
  padding-left: 18px;
  list-style: disc;
}

.aa-message-assistant .aa-list li {
  margin: 2px 0;
  color: var(--aa-text-secondary);
}

.aa-citations {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--aa-border);
  font-size: 12px;
}


.aa-citations-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--aa-text-secondary);
}

.aa-citations ul {
  margin: 0;
  padding-left: 16px;
  list-style: none;
}

.aa-citations li {
  margin-bottom: 4px;
}

.aa-citations a {
  color: var(--aa-accent);
  text-decoration: none;
}

.aa-citations a:hover {
  text-decoration: underline;
}

/* ============================================
   MOBILE OPTIMIZATIONS - Complete Rebuild
   ============================================ */
@media (max-width: 768px) {
    /* Chat container - Full screen, fixed position */
    /* Account for browser UI (navigation bar) at bottom */
    .aa-chat {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        /* Use dynamic viewport height - adjusts when browser UI shows/hides */
        /* JavaScript will trigger browser UI to hide on initial open */
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important; /* Account for device safe area */
        border: none !important;
        border-radius: 0 !important;
        z-index: 999999 !important;
        box-sizing: border-box !important;
    }
    
    /* Fallback for browsers that don't support 100dvh */
    @supports not (height: 100dvh) {
        .aa-chat {
            height: 100vh !important;
            max-height: 100vh !important;
        }
    }
    
    /* Show chat only when open */
    .aa-chat.aa-open {
        display: flex !important;
    }
    
    /* Chat shell - Full height flex container */
    .aa-chat-shell {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        position: relative !important;
    }
    
    /* Header - Fixed at top, never scrolls */
    .aa-chat-header {
        flex: 0 0 auto !important; /* Don't grow or shrink */
        width: 100% !important;
        padding: 10px 12px !important; /* Reduced for compact mobile */
        background: var(--aa-surface) !important;
        border-bottom: 1px solid var(--aa-border) !important;
        z-index: 10 !important;
    }
    
    /* Chat log - Scrollable middle section - MUST shrink to fit other elements */
    .aa-chat-log {
        flex: 1 1 0 !important; /* Grow to fill space, shrink if needed, base 0 */
        min-height: 0 !important; /* Critical: allows flex item to shrink below content size */
        width: 100% !important;
        padding: 10px !important; /* Reduced padding for compact mobile feel */
        gap: 10px !important; /* Reduced gap between messages */
        overflow-y: auto !important; /* Always show scrollbar behavior */
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important; /* Prevent pull-to-refresh */
        position: relative !important;
    }
    
    /* Quick actions - Sleek horizontal scrollable bar for mobile */
    .aa-quick-actions {
        flex: 0 0 auto !important; /* Don't grow or shrink */
        width: 100% !important;
        padding: 6px 0 !important; /* Reduced vertical padding */
        background: var(--aa-surface) !important;
        border-top: 1px solid var(--aa-border) !important;
        display: flex !important;
        flex-wrap: nowrap !important; /* Single line, no wrapping */
        overflow-x: auto !important; /* Horizontal scroll if needed */
        overflow-y: hidden !important;
        gap: 6px !important; /* Reduced gap between buttons */
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important; /* Hide scrollbar on Firefox */
        -ms-overflow-style: none !important; /* Hide scrollbar on IE/Edge */
        padding-left: 10px !important; /* Reduced side padding */
        padding-right: 10px !important;
    }
    
    /* Suggestions and disclaimer - also fixed size */
    .aa-chat-suggestions,
    .aa-ai-disclaimer {
        flex: 0 0 auto !important; /* Don't grow or shrink */
    }
    
    /* Hide scrollbar on webkit browsers */
    .aa-quick-actions::-webkit-scrollbar {
        display: none !important;
    }
    
    /* Input area - Fixed at bottom, never scrolls */
    /* Add extra bottom padding to account for browser navigation bar (typically 44-50px) */
    .aa-chat-input {
        flex: 0 0 auto !important;
        width: 100% !important;
        padding: 6px 10px !important; /* Reduced padding */
        padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px)) !important; /* Extra space for browser UI */
        background: var(--aa-surface) !important;
        border-top: 1px solid var(--aa-border) !important;
        position: relative !important;
        z-index: 100 !important; /* Ensure input stays above other content */
    }
    
    /* Footer on mobile - full width, fixed size */
    /* Footer is after input, so it also needs bottom padding for browser UI */
    .aa-chat-footer {
        flex: 0 0 auto !important; /* Don't grow or shrink */
        width: 100% !important;
        padding: 5px 10px !important;
        padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px)) !important; /* Extra space for browser UI */
        margin: 0 !important;
        font-size: 8px !important;
    }
    
    /* Messages - Proper width constraints */
    .aa-message {
        max-width: 85% !important;
        width: fit-content !important;
        margin-bottom: 0 !important; /* Remove extra bottom margin */
    }
    
    /* Message meta (timestamps/actions) - tighter spacing */
    .aa-message-meta {
        margin-top: 4px !important; /* Reduced from default */
        font-size: 10px !important;
    }
    
    /* Message avatars - slightly smaller on mobile */
    .aa-message-avatar {
        width: 30px !important;
        height: 30px !important;
        font-size: 11px !important;
    }
    
    /* Message bubbles - Proper text wrapping */
    .aa-message-bubble {
        word-wrap: break-word !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important; /* Changed from pre-wrap to collapse whitespace */
        max-width: 100% !important;
        padding: 10px 12px !important; /* Reduced padding inside bubbles */
        line-height: 1.5 !important; /* Slightly increased for better readability */
    }
    
    /* Reduce spacing in message content */
    .aa-message-bubble p {
        margin: 0 0 8px 0 !important; /* Tighter paragraph spacing */
    }
    
    .aa-message-bubble p:last-child {
        margin-bottom: 0 !important;
    }
    
    .aa-message-bubble ul,
    .aa-message-bubble ol {
        margin: 8px 0 !important;
        padding-left: 20px !important;
    }
    
    .aa-message-bubble li {
        margin-bottom: 4px !important;
    }
    
    /* Message avatars */
    .aa-message-avatar {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
    }
    
    /* Logo */
    .aa-logo {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
    
    /* Titles */
    .aa-titles strong {
        font-size: 14px !important;
    }
    
    .aa-titles span {
        font-size: 11px !important;
    }
    
    /* Quick action buttons - EMOJI ONLY on mobile */
    .aa-quick-action {
        flex: 0 0 auto !important; /* Don't shrink or grow */
        padding: 10px !important; /* Square padding for emoji-only buttons */
        font-size: 0 !important; /* Hide text labels, show only emoji */
        min-height: 44px !important; /* iOS recommended touch target */
        min-width: 44px !important; /* Square buttons */
        border-radius: 50% !important; /* Circular buttons */
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: 500 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
        transition: all 0.2s ease !important;
        position: relative !important; /* For tooltip positioning */
    }
    
    .aa-quick-action span {
        font-size: 20px !important; /* Show emoji at normal size */
    }
    
    /* Quick action button hover/active states */
    .aa-quick-action:active {
        transform: scale(0.92) !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Input textarea - Prevent zoom on iOS */
    .aa-chat-input textarea {
        font-size: 16px !important;
        padding: 10px 90px 10px 12px !important;
        min-height: 44px !important;
    }
    
    /* Message meta */
    .aa-message-meta {
        font-size: 10px !important;
    }
    
    /* Message action buttons */
    .aa-message-action-btn {
        padding: 4px 8px !important;
        font-size: 10px !important;
        min-height: 32px !important;
    }
    
    /* Typing indicator */
    .aa-typing-indicator {
        max-width: 85% !important;
    }
    
    /* Mobile-specific thinking bubble sizing */
    .aa-thinking-bubble .aa-typing-dots {
        width: 50px !important; /* Slightly smaller on mobile */
    }
    
    .aa-thinking-bubble .aa-typing-dot {
        width: 6px !important;
        height: 6px !important;
    }
    
    .aa-thinking-bubble .aa-typing-status {
        font-size: 11px !important;
    }
    
    /* Tooltips for emoji-only quick actions on mobile */
    /* Show tooltip on touch/active state */
    .aa-quick-action[title]:active::after,
    .aa-quick-action[title]:focus::after {
        content: attr(title);
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.95);
        color: white;
        padding: 8px 12px;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
        pointer-events: none;
        z-index: 10000;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        animation: tooltipFadeIn 0.15s ease-out;
    }
    
    /* Tooltip arrow */
    .aa-quick-action[title]:active::before,
    .aa-quick-action[title]:focus::before {
        content: '';
        position: absolute;
        bottom: calc(100% + 2px);
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        height: 0;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 6px solid rgba(0, 0, 0, 0.95);
        pointer-events: none;
        z-index: 10001;
    }
    
    @keyframes tooltipFadeIn {
        from {
            opacity: 0;
            transform: translateX(-50%) translateY(4px);
        }
        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
    }
    
}

/* Extra small screen optimizations */
@media (max-width: 480px) {
    .aa-message {
        max-width: 90% !important;
        padding: 10px 12px !important;
    }
    
    .aa-chat-log {
        padding: 8px !important;
        gap: 8px !important;
    }
    
    .aa-message-bubble {
        padding: 8px 10px !important;
        font-size: 14px !important;
    }
    
    .aa-chat-header {
        padding: 8px 10px !important;
    }
    
    .aa-quick-action {
        min-width: 40px !important;
        min-height: 40px !important;
        padding: 8px !important;
    }
    
    .aa-quick-action span {
        font-size: 18px !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .aa-message-actions {
        opacity: 1; /* Always show on touch devices */
    }

    .aa-iconbtn,
    .aa-quick-action,
    .aa-message-action-btn {
        min-height: 44px; /* iOS recommended touch target size */
        min-width: 44px;
    }
}

/* Accessibility improvements */
.aa-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
.aa-iconbtn:focus-visible,
.aa-quick-action:focus-visible,
.aa-message-action-btn:focus-visible {
    outline: 2px solid var(--aa-accent);
    outline-offset: 2px;
}

.aa-chat-input textarea:focus-visible {
    outline: 2px solid var(--aa-primary);
    outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .aa-message-assistant .aa-message-bubble {
        border-width: 2px;
    }

    .aa-message-action-btn {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .aa-message,
    .aa-typing-indicator,
    .aa-iconbtn,
    .aa-quick-action,
    .aa-message-action-btn {
        animation: none !important;
        transition: none !important;
    }

    .aa-status-dot {
        animation: none !important;
    }

    .aa-typing-dot {
        animation: none !important;
    }
}

/* Contact form styles - Professional global company styling */


/* Typing animation */
.aa-typing-dots {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.aa-typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--aa-text-secondary);
  border-radius: 50%;
  animation: aa-typing 1.4s infinite ease-in-out;
}

.aa-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.aa-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes aa-typing {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Ensure chat maintains its visual state */
.aa-chat {
    transition: opacity 0.3s ease;
}

.aa-chat.aa-open {
    opacity: 1;
}

/* Smooth transitions for all interactive elements */
.aa-launcher,
.aa-message {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Floating "How can I help?" tooltip */
.aa-helper-tooltip {
  position: fixed;
  bottom: 100px;
  right: 100px;
  background: rgba(26, 31, 53, 0.9);
  color: #f8fafc;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-family: var(--aa-font);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(59, 130, 246, 0.3);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease;
  z-index: 9999;
  pointer-events: none;
}

/* Show state */
.aa-helper-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

/* Tooltip glow pulse */
@keyframes aa-tooltip-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(0,212,255,0.2); }
  50% { box-shadow: 0 0 20px rgba(0,212,255,0.4); }
}
.aa-helper-tooltip.show {
  animation: aa-tooltip-glow 3s infinite ease-in-out;
}

/* Pulse effect when listening */
.aa-voice-btn.aa-voice-listening {
  background: radial-gradient(circle at center, rgba(59,130,246,0.8) 0%, rgba(15,23,42,0.95) 60%);
  box-shadow: 0 0 0 0 rgba(59,130,246,0.6);
  animation: aaPulse 1.5s infinite;
  color: #fff;
}

@keyframes aaPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59,130,246,0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59,130,246,0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59,130,246,0);
  }
}

/* === Athena Status Indicator (Hybrid Version) === */
.aa-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aa-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #00ff8c; /* Calm green (idle/online) */
  box-shadow: 0 0 8px rgba(0, 255, 140, 0.6);
  transition: all 0.4s ease;
}

/* Pulse animation for "thinking" */
@keyframes aaPulseBlue {
  0%, 100% {
    transform: scale(1);
    opacity: 0.9;
    box-shadow: 0 0 8px rgba(0, 186, 255, 0.8);
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
    box-shadow: 0 0 14px rgba(0, 186, 255, 1);
  }
}

/* Active (AI typing) state */
.aa-status-indicator[data-state="thinking"] {
  background-color: #00baff;
  animation: aaPulseBlue 2s ease-in-out infinite;
}

/* Error (offline or server issue) */
.aa-status-indicator[data-state="error"] {
  background-color: #ff4444;
  box-shadow: 0 0 8px rgba(255, 68, 68, 0.8);
  animation: none;
}

/* Mute button visual states */
.aa-iconbtn[data-act="mute"] {
  font-size: 16px;
  transition: color 0.2s ease;
}

.aa-iconbtn[data-act="mute"].muted {
  color: #ff4444;
}

/* Ensure Athena chat UI always stays above sticky headers, menus, modals, etc. */
.aa-chat,
.aa-launcher,
.aa-helper-tooltip {
  z-index: 2147483647 !important; /* max int style, beats most theme values */
}

/* Force Athena Agent link colors inside chat */
.aa-chat a,
.aa-message a,
.aa-citations a {
  color: var(--aa-accent) !important;
  text-decoration: none !important;
}

.aa-chat a:hover,
.aa-message a:hover,
.aa-citations a:hover {
  color: var(--aa-primary-hover) !important;
  text-decoration: underline !important;
}
