/* static/styles.css */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================================================
   CHAT MESSAGES - PROFESSIONAL PORTFOLIO STYLE
   ============================================================================= */

.chat-messages {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.message {
    margin-bottom: 24px;
    animation: fadeInUp 0.3s ease-out;
}

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

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

.user-message .message-content {
    background: #3b82f6;
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    font-size: 14px;
}

.ai-message {
    display: flex;
    justify-content: flex-start;
}

.ai-message .message-content {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 18px 18px 18px 4px;
    padding: 24px 28px;
    /* Keep content readable ~80–90 characters per line */
    max-width: 80ch;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    font-size: 15px;
    line-height: 1.6;
    color: #1f2937;
    
    /* PORTFOLIO TYPOGRAPHY */
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    letter-spacing: -0.01em;
}

/* =============================================================================
   PROFESSIONAL TYPOGRAPHY FOR AI RESPONSES
   ============================================================================= */

.ai-message .message-content h1,
.ai-message .message-content h2,
.ai-message .message-content h3 {
    color: #1e293b;
    font-weight: 700;
    margin: 24px 0 16px 0;
    letter-spacing: -0.02em;
}

.ai-message .message-content h1 {
    font-size: 24px;
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 8px;
    margin-bottom: 20px;
}

.ai-message .message-content h2 {
    font-size: 20px;
    color: #2563eb;
    margin-top: 28px;
}

.ai-message .message-content h3 {
    font-size: 17px;
    color: #1e40af;
    margin-top: 20px;
}

.ai-message .message-content p {
    margin: 16px 0;
    text-align: justify;
    hyphens: auto;
}

.ai-message .message-content strong {
    font-weight: 600;
    color: #0f172a;
    background: #f1f5f9;
    padding: 2px 4px;
    border-radius: 3px;
}

/* =============================================================================
   LISTS AND STRUCTURE - PORTFOLIO STYLE
   ============================================================================= */

.ai-message .message-content ul,
.ai-message .message-content ol {
    margin: 16px 0;
    padding-left: 0;
}

.ai-message .message-content li {
    margin: 8px 0;
    padding-left: 24px;
    position: relative;
    line-height: 1.6;
}

.ai-message .message-content ul li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #3b82f6;
    font-weight: bold;
}

.ai-message .message-content ol {
    counter-reset: item;
}

.ai-message .message-content ol li {
    counter-increment: item;
}

.ai-message .message-content ol li::before {
    content: counter(item) ".";
    position: absolute;
    left: 0;
    color: #3b82f6;
    font-weight: 600;
}

/* =============================================================================
   MATHEMATICAL NOTATION ENHANCEMENT
   ============================================================================= */

.ai-message .message-content .MathJax {
    display: inline-block !important;
    margin: 2px 4px;
}

.ai-message .message-content .MathJax_Display {
    margin: 16px 0 !important;
    text-align: center !important;
}

/* =============================================================================
   SECTIONS AND DIVIDERS
   ============================================================================= */

.ai-message .message-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, transparent);
    margin: 24px 0;
}

/* CODE AND SPECIAL ELEMENTS */
.ai-message .message-content code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    color: #4338ca;
}

/* Custom class for the generated plan content for better typography control */
.prose {
    line-height: 1.6;
}

.prose h1, .prose h2, .prose h3 {
    font-weight: 700;
    margin-bottom: 0.5em;
}

.prose p {
    margin-bottom: 1em;
}

.prose ul {
    list-style-position: inside;
    padding-left: 1em;
}

.prose li {
    margin-bottom: 0.5em;
}

/* Mobile-specific view switching */
@media (max-width: 767px) {
    #form-panel.hidden, #right-panel.hidden {
        display: none;
    }
}

/* Acknowledgment */
.acknowledgment {
    text-align: center;
    margin-top: 12px;
    opacity: 0.7;
}

.acknowledgment small {
    font-size: 11px;
    color: #666;
    font-style: italic;
}

/* Attachment chips inside message bubble */
.attached-chips { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.file-chip { background: #e2e8f0; color: #111827; padding: 2px 8px; border-radius: 999px; font-size: 12px; }

/* CTA bar below AI messages */
.cta-bar { margin-top: 12px; display: flex; gap: 8px; }
.apply-btn, .follow-btn, .retry-btn {
  background: #3b82f6; color: #fff; border: none; border-radius: 6px; padding: 6px 10px; cursor: pointer; font-weight: 600; font-size: 12px;
}
.follow-btn { background: #10b981; }
.retry-btn { background: #ef4444; }

/* -------------------------------------------------------------------------- */
/* Chat contrast hotfix                                                       */
/* -------------------------------------------------------------------------- */

.section-b,
.chat-container,
.chat-messages {
    background: #0f172a !important;
    box-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
}

.section-b::before,
.section-b::after,
.chat-container::before,
.chat-container::after,
.chat-messages::before,
.chat-messages::after {
    content: none !important;
    display: none !important;
}

.chat-messages {
    border: none !important;
    padding: 24px !important;
    gap: 18px !important;
}

.chat-messages .message {
    max-width: 85%;
    background: transparent !important;
}

.message-content {
    opacity: 1 !important;
    backdrop-filter: none !important;
    filter: none !important;
}

.ai-message .message-content {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
    border: 1px solid #475569 !important;
    border-bottom-left-radius: 6px !important;
    color: #e2e8f0 !important;
    box-shadow: none !important;
}

.user-message .message-content {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    border-bottom-right-radius: 6px !important;
    box-shadow: none !important;
}

.ai-message .message-content h1,
.ai-message .message-content h2,
.ai-message .message-content h3,
.ai-message .message-content p,
.ai-message .message-content li,
.ai-message .message-content strong {
    color: inherit !important;
}

.ai-message .message-content ul {
    padding-left: 1.25rem !important;
    list-style: disc outside !important;
}

.ai-message .message-content ol {
    padding-left: 1.25rem !important;
    list-style: decimal outside !important;
}

.ai-message .message-content ul li::before,
.ai-message .message-content ol li::before {
    display: none !important;
}
