/* Chat Interface Styles for mex.guide */
/* Using mex.guide color scheme from color tokens */

:root {
    /* Primary Colors - Maya Blue */
    --maya-blue: #0096C7;
    --maya-blue-light: #2EA9D1;
    --maya-blue-dark: #007BA3;

    /* Secondary Colors - Terracotta Clay */
    --terracotta-clay: #C75C36;
    --terracotta-clay-light: #D1795A;
    --terracotta-clay-dark: #A34B2C;

    /* Accent Colors - Golden Agave */
    --golden-agave: #E1B12C;
    --golden-agave-light: #E6BF52;
    --golden-agave-dark: #B89124;

    /* Neutral Colors */
    --neutral-light: #F5EBDD;
    --neutral-dark: #2E2E2E;

    /* Feedback Colors */
    --success-verdant: #5BA46A;
    --warning-amber: #E67E22;
    --error-cochineal: #B22222;
}

/* Navigation Bar */
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-item {
    background: none;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.auth-button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.auth-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Container Layout */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    /* Account for smaller fixed header */
    margin-top: 0;
    /* No margin since header is fixed */
    background: white;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    top: 50px;
    /* Position below smaller fixed header */
}


/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    max-width: 80%;
    padding: 1rem 1.2rem;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    background: var(--golden-agave-light);
    color: var(--neutral-dark);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    background: var(--maya-blue-light);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.system {
    background: var(--terracotta-clay-light);
    color: white;
    align-self: center;
    max-width: 90%;
    font-style: italic;
    text-align: center;
    font-size: 0.9rem;
}

.chat-message.error {
    background: var(--error-cochineal);
    color: white;
    align-self: center;
    max-width: 90%;
}

.chat-message.warning {
    background: var(--warning-amber);
    color: white;
    align-self: center;
    max-width: 90%;
}

/* Message Content Styling */
.message-content {
    line-height: 1.6;
}

.message-content h1 {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0.5rem 0;
    color: inherit;
}

.message-content h2 {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0.4rem 0;
    color: inherit;
}

.message-content h3 {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0.3rem 0;
    color: inherit;
}

.message-content p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.3rem 0;
    line-height: 1.5;
}

.message-content strong {
    font-weight: bold;
    color: inherit;
}

.message-content em {
    font-style: italic;
    color: inherit;
}

.message-content br {
    line-height: 1.2;
}

/* Special styling for assistant messages */
.chat-message.assistant .message-content h1,
.chat-message.assistant .message-content h2,
.chat-message.assistant .message-content h3 {
    color: rgba(255, 255, 255, 0.95);
}

.chat-message.assistant .message-content strong {
    color: rgba(255, 255, 255, 0.95);
}

/* Special styling for user messages */
.chat-message.user .message-content h1,
.chat-message.user .message-content h2,
.chat-message.user .message-content h3 {
    color: var(--neutral-dark);
}

.chat-message.user .message-content strong {
    color: var(--neutral-dark);
}

/* Message Controls */
.message-controls {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-message {
    position: relative;
}

.chat-message:hover .message-controls {
    opacity: 1;
}

.copy-button {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: rgba(0, 0, 0, 0.6);
    padding: 0.375rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.copy-button:hover {
    background: rgba(0, 0, 0, 0.15);
    color: rgba(0, 0, 0, 0.8);
}

.copy-button svg {
    width: 16px;
    height: 16px;
}

.chat-message.assistant .copy-button {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.chat-message.assistant .copy-button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* Message Timestamp */
.message-timestamp {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* Chat Input Area */
.chat-input-container {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 22px;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.4;
    transition: border-color 0.3s ease;
}

#chat-input:focus {
    outline: none;
    border-color: var(--maya-blue);
    box-shadow: 0 0 0 3px rgba(0, 150, 199, 0.1);
}

#send-button {
    background: var(--maya-blue);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 22px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 80px;
}

#send-button:hover:not(:disabled) {
    background: var(--maya-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 150, 199, 0.3);
}

#send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--maya-blue-dark);
    font-style: italic;
    padding: 1rem;
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

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

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

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

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Rate Limit Warning */
.rate-limit-warning {
    background: var(--warning-amber);
    color: white;
    padding: 0.75rem 1rem;
    margin: 0.5rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
}

/* Authentication Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.auth-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.auth-modal h3 {
    color: var(--neutral-dark);
    margin-bottom: 1rem;
}

.auth-provider-button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.auth-provider-button:hover {
    border-color: var(--maya-blue);
    background: var(--maya-blue-light);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }

    .nav-menu {
        gap: 0.5rem;
    }

    .nav-item {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    .chat-container {
        margin-left: 1rem;
        margin-right: 1rem;
        height: calc(100vh - 40px);
        /* Smaller header on mobile */
        top: 40px;
    }

    .chat-message {
        max-width: 90%;
    }

    .chat-input-container {
        padding: 0.75rem 1rem;
    }

    #chat-input {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--maya-blue-light);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--maya-blue-dark);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {

    .chat-message,
    #send-button,
    .typing-dots span {
        animation: none;
    }
}

/* Focus indicators for keyboard navigation */
#auth-button:focus,
#send-button:focus,
#chat-input:focus,
.auth-provider-button:focus {
    outline: 2px solid var(--maya-blue);
    outline-offset: 2px;
}