/* Presupuesto 2026 AI Chat - Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #10a37f;
    --primary-hover: #0d8f6f;
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f8;
    --bg-tertiary: #ececf1;
    --text-primary: #1f1f1f;
    --text-secondary: #6b6b6b;
    --border-color: #e5e5e5;
    --user-message-bg: #ffffff;
    --assistant-message-bg: #f7f7f8;
    --input-bg: #ffffff;
    --shadow: rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px var(--shadow);
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.new-chat-btn {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 1px 2px var(--shadow);
}

.new-chat-btn:hover {
    background-color: var(--bg-secondary);
    box-shadow: 0 2px 4px var(--shadow);
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

/* Welcome Message */
.welcome-message {
    max-width: 700px;
    margin: 60px auto;
    text-align: center;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.welcome-message h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.example-questions {
    margin-top: 40px;
}

.example-questions h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.example-btn {
    display: block;
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 15px 20px;
    margin-bottom: 12px;
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-size: 0.95rem;
    box-shadow: 0 1px 3px var(--shadow);
}

.example-btn:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px var(--shadow);
    transform: translateY(-1px);
}

/* Message Styles */
.message {
    padding: 24px 30px;
    margin-bottom: 0;
    animation: fadeIn 0.3s ease-in;
}

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

.message.user {
    background-color: var(--user-message-bg);
}

.message.assistant {
    background-color: var(--assistant-message-bg);
}

.message-content {
    max-width: 800px;
    margin: 0 auto;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.message-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.message.user .message-icon {
    background-color: var(--primary-color);
}

.message.assistant .message-icon {
    background-color: var(--bg-tertiary);
}

.message-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.message-text {
    font-size: 1rem;
    line-height: 1.7;
}

.message-text p {
    margin-bottom: 16px;
}

.message-text ul,
.message-text ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.message-text li {
    margin-bottom: 8px;
}

.message-text code {
    background-color: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
}

.message-text pre {
    background-color: var(--bg-tertiary);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.message-text pre code {
    background-color: transparent;
    padding: 0;
}

.message-text strong {
    font-weight: 600;
}

.message-sources {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.source-tag {
    display: inline-block;
    background-color: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: 4px;
    margin-right: 8px;
    margin-bottom: 6px;
}

/* Chart Container */
.chart-container {
    margin: 20px 0;
    padding: 20px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 4px var(--shadow);
}

.chart-container canvas {
    max-height: 400px;
    width: 100% !important;
    height: auto !important;
}

/* Loading Animation */
.loading {
    display: flex;
    gap: 6px;
    padding: 8px 0;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    animation: pulse 1.4s ease-in-out infinite;
}

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

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

@keyframes pulse {
    0%, 80%, 100% {
        opacity: 0.4;
    }
    40% {
        opacity: 1;
    }
}

/* Input Area */
.input-container {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 20px 30px;
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#userInput {
    flex: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    min-height: 24px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px var(--shadow);
}

#userInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px var(--shadow);
}

#userInput::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    padding: 12px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.send-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

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

.send-btn svg {
    stroke: white;
}

.input-footer {
    max-width: 800px;
    margin: 12px auto 0;
    display: flex;
    justify-content: center;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Scrollbar */
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }

    .header-content h1 {
        font-size: 1.2rem;
    }

    .new-chat-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .chat-container {
        padding: 15px;
    }

    .message {
        padding: 20px 15px;
    }

    .welcome-message {
        margin: 40px auto;
    }

    .welcome-icon {
        font-size: 3rem;
    }

    .welcome-message h2 {
        font-size: 1.5rem;
    }

    .input-container {
        padding: 15px 20px;
    }
}

/* Error Message */
.error-message {
    background-color: #f44336;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 0.9rem;
}


/* Header Buttons */
.header-buttons {
    display: flex;
    gap: 10px;
}

.info-btn {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.info-btn:hover {
    background-color: var(--bg-tertiary);
    transform: translateY(-1px);
}

/* Project Info (shown on startup) */
.project-info {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
}

.project-info h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 24px;
}

.project-info h3 {
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 18px;
}

.project-info h4 {
    color: var(--text-secondary);
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.project-info p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.project-info strong {
    color: var(--primary-color);
}

.why-tiktok {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.why-tiktok ul {
    list-style: none;
    padding-left: 0;
}

.why-tiktok li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.why-tiktok li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.suggestions {
    margin-top: 25px;
}

.suggestion-group {
    margin-bottom: 20px;
}

.suggestion-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-primary);
}

.suggestion-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-primary);
    padding: 40px;
    border-radius: 12px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s;
}

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

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Modal content styling (same as project-info) */
.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 24px;
}

.modal-content h3 {
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 18px;
}

.modal-content h4 {
    color: var(--text-secondary);
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.modal-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-content strong {
    color: var(--primary-color);
}

.modal-content .why-tiktok {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.modal-content .suggestions {
    margin-top: 25px;
}

.modal-content .suggestion-group {
    margin-bottom: 20px;
}

/* Scientific Rigor Highlight */
.scientific-rigor {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 10px;
    margin: 25px 0;
    text-align: center;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(102, 126, 234, 0.5);
    }
}

.scientific-rigor strong {
    color: white;
    font-size: 18px;
    display: block;
    margin-bottom: 5px;
}

.modal-content .scientific-rigor {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Header Logo */
.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
