/**
 * chat.css - Chat Interface Styles
 *
 * PURPOSE:
 * Styles specific to the chat interface (/chat route).
 * These styles are ONLY used on the chat page.
 *
 * BEFORE ADDING NEW STYLES:
 * 1. Check if the style exists in layout.css (shared across pages)
 * 2. If reused in email-client or other pages, move to layout.css instead
 * 3. Search this file for similar existing styles before creating new ones
 *
 * ORGANIZATION:
 * - Navigation and layout
 * - Chat container and messages
 * - Markdown rendering
 * - File upload status
 *
 * @author William Callahan
 * @since 2025-11-02
 */

/* ============================================================================
   NAVIGATION & LAYOUT
   Chat-specific navigation and page layout
   ============================================================================ */

/**
 * App Nav: Top navigation bar for chat interface
 * Used by: chat.html only
 *
 * Design: Translucent white bar with soft shadow and backdrop blur
 */
.app-nav {
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 18px 45px -28px rgba(15, 23, 42, 0.28);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/**
 * Chat Shell: Main container for the chat interface
 * Used by: chat.html only
 *
 * Design: Card-style container with rounded corners and soft shadow
 */
.chat-shell {
    display: flex;
    flex-direction: column;
    border-radius: 26px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 35px 65px -40px rgba(15, 23, 42, 0.38);
    min-height: 0;
    overflow: hidden;
}

/**
 * Chat Input: Bottom input area for message composition
 * Used by: chat.html only
 *
 * Design: Fixed input area with backdrop blur
 */
.chat-input {
    margin-top: auto;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}


/* ============================================================================
   MESSAGES & USER CONTENT
   Styles for user and assistant message bubbles
   ============================================================================ */

/**
 * Message User: User message bubble
 * Used by: chat.html only
 *
 * Design: Dark rounded bubble aligned to the right
 */
.message-user {
    max-width: 64%;
}


/* ============================================================================
   MARKDOWN RENDERING
   Styles for rendering markdown content in chat messages
   ============================================================================ */

/**
 * Chat Markdown: Base container for markdown content
 * Used by: chat.html only
 *
 * Design: Flexible column layout with consistent spacing
 */
.chat-markdown {
    color: #0f172a;
    font-size: 0.88rem;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.chat-markdown > :first-child {
    margin-top: 0;
}

.chat-markdown > :last-child {
    margin-bottom: 0;
}

.chat-markdown p {
    margin: 0;
}

.chat-markdown ul,
.chat-markdown ol {
    margin: 0;
    padding-left: 1.05rem;
}

.chat-markdown li {
    margin-bottom: 0.35rem;
}

/**
 * Chat Markdown Links: Link styles within markdown content
 * Used by: chat.html only
 *
 * Design: Underlined links with subtle decoration
 */
.chat-markdown a {
    color: #0f172a;
    text-decoration: underline;
    text-decoration-color: rgba(15, 23, 42, 0.35);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.chat-markdown a:hover {
    text-decoration-color: rgba(15, 23, 42, 0.6);
}

/**
 * Chat Blockquote: Blockquote styles within markdown
 * Used by: chat.html only
 *
 * Design: Left-bordered card with subtle background
 */
.chat-blockquote,
.chat-markdown blockquote {
    border-left: 3px solid rgba(15, 23, 42, 0.25);
    background: rgba(226, 232, 240, 0.35);
    border-radius: 14px;
    padding: 0.7rem 1.05rem;
    margin: 0;
    color: #1f2937;
}

/**
 * Chat Code Block: Multi-line code blocks
 * Used by: chat.html only
 *
 * Design: Dark background with monospace font
 */
.chat-code-block,
.chat-markdown pre {
    background: rgba(15, 23, 42, 0.96);
    color: rgba(248, 250, 252, 0.95);
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(71, 85, 105, 0.4);
    overflow-x: auto;
    margin: 0;
    font-family: "SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
    font-size: 0.8rem;
    line-height: 1.52;
}

/**
 * Chat Inline Code: Inline code snippets
 * Used by: chat.html only
 *
 * Design: Light background with monospace font
 */
.chat-markdown code,
.chat-inline-code {
    background: rgba(226, 232, 240, 0.6);
    border-radius: 6px;
    padding: 0.1rem 0.3rem;
    font-family: "SFMono-Regular", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
    font-size: 0.88em;
}

.chat-markdown pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}


/* ============================================================================
   TABLE RENDERING
   Styles for markdown tables
   ============================================================================ */

/**
 * Chat Table Wrapper: Scrollable container for tables
 * Used by: chat.html only
 *
 * Design: Rounded container with horizontal scroll
 */
.chat-table-wrapper {
    margin: 0.5rem -0.35rem 0.85rem;
    padding: 0.45rem 0.65rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(248, 250, 252, 0.82);
    overflow-x: auto;
}

.chat-table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.chat-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.5);
    border-radius: 9999px;
}

.chat-table-wrapper::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.4);
    border-radius: 9999px;
}

/**
 * Chat Table: Table base styles
 * Used by: chat.html only
 *
 * Design: Full-width table with compact styling
 */
.chat-table,
.chat-markdown table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    color: #0f172a;
    font-size: 0.86rem;
}

.chat-table th,
.chat-markdown th {
    text-align: left;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.48rem 0.65rem;
    background: rgba(226, 232, 240, 0.65);
    color: #1f2937;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.chat-table td,
.chat-markdown td {
    padding: 0.48rem 0.65rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.55);
    vertical-align: top;
}

.chat-table tr:last-child td,
.chat-markdown tr:last-child td {
    border-bottom: none;
}

@media (max-width: 640px) {
    .chat-table,
    .chat-markdown table {
        min-width: 360px;
    }
    .chat-table-wrapper {
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
}


/* ============================================================================
   FILE UPLOAD STATUS
   Feedback messages for file upload operations
   ============================================================================ */

/**
 * Upload Status: Base container for upload feedback
 * Used by: chat.html only
 *
 * Design: Rounded notification banner with status-specific colors
 */
.upload-status {
    margin-bottom: 0.75rem;
    border-radius: 12px;
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    display: none;
}

.upload-status.upload-status--info {
    display: block;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #1d4ed8;
}

.upload-status.upload-status--success {
    display: block;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #166534;
}

.upload-status.upload-status--error {
    display: block;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #b91c1c;
}
