/* AI Assistant Component Styles */

.ai-section {
    background: white;
    border: 3px solid #383838;
    box-shadow: 4px 4px 0px rgba(56, 56, 56, 1);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    animation: fadeInUp 0.6s ease-out;
}

.ai-header {
    margin-bottom: 1.5rem;
}

.ai-header h3 {
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #383838;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-header p {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: #666;
    margin-top: 0.5rem;
}

/* AI Report Content */
.ai-report-content {
    background: #ffffff;
    border: 3px solid #383838;
    border-radius: 12px;
    padding: 1.5rem;
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'DM Sans', sans-serif;
    color: #383838;
    line-height: 1.7;
}

/* Markdown styling within report */
.ai-report-content h1,
.ai-report-content h2,
.ai-report-content h3,
.ai-report-content h4 {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: #383838;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.ai-report-content h1 {
    font-size: 1.5rem;
}

.ai-report-content h2 {
    font-size: 1.3rem;
}

.ai-report-content h3 {
    font-size: 1.15rem;
}

.ai-report-content h4 {
    font-size: 1rem;
}

.ai-report-content p {
    margin-bottom: 1rem;
}

.ai-report-content ul,
.ai-report-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.ai-report-content li {
    margin-bottom: 0.5rem;
}

.ai-report-content strong {
    font-weight: 700;
    color: #383838;
}

.ai-report-content em {
    font-style: italic;
}

.ai-report-content code {
    background: rgba(255, 222, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9em;
}

.ai-report-content blockquote {
    border-left: 4px solid #ffde00;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #555;
    font-style: italic;
}

/* Loading Animation */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 160px;
    color: #888;
    gap: 15px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ffde00;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Chat Container */
.chat-container {
    margin-top: 2rem;
    border-top: 2px dashed #383838;
    padding-top: 1.5rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.1);
}

.chat-intro {
    background: #e8f4fd;
    border: 2px solid #6fc2ff;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.chat-intro p {
    margin: 0;
    font-family: 'DM Sans', sans-serif;
    color: #383838;
    line-height: 1.6;
}

.chat-intro p:first-child {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.chat-intro p:last-child {
    font-size: 0.9rem;
    color: #555;
}

.chat-box {
    height: 300px;
    overflow-y: auto;
    padding: 20px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Chat Messages */
.chat-message {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
    gap: 10px;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message.ai {
    flex-direction: row;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 2px solid #383838;
    flex-shrink: 0;
    background: white;
}

.ai-avatar {
    background: #e8f4fd;
    color: #6fc2ff;
}

.user-avatar {
    background: #fff9c4;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.chat-message.user .message-content {
    background: var(--color-primary, #ffde00);
    color: #383838;
    border: 2px solid #383838;
    border-top-right-radius: 2px;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
}

.chat-message.ai .message-content {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
    border-top-left-radius: 2px;
}

/* Typing Animation */
.typing-dots span {
    animation: typing 1.4s infinite ease-in-out both;
    margin: 0 1px;
    display: inline-block;
}

.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);
    }

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

/* Input Area */
.chat-input-area {
    display: flex;
    border-top: 2px solid #383838;
    background: #f9f9f9;
    padding: 10px;
    gap: 10px;
    align-items: center;
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    padding: 5px 15px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: #383838;
}

.input-icon {
    color: #999;
    margin-right: 8px;
    font-size: 1.1rem;
}

.chat-input-area input {
    flex: 1;
    padding: 8px 0;
    border: none;
    outline: none;
    font-family: inherit;
    background: transparent;
    font-size: 0.95rem;
}

.chat-input-area button {
    padding: 10px 20px;
    background: var(--color-primary, #ffde00);
    border: 2px solid #383838;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #383838;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
}

.chat-input-area button:hover {
    background: #e6c800;
    transform: translateY(-1px);
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.1);
}

.chat-input-area button:active {
    transform: translateY(1px);
    box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.1);
}

.chat-input-area button i {
    font-size: 1rem;
}

.send-text {
    font-size: 0.9rem;
}

/* Utilities */
.hidden {
    display: none;
}

.opacity-50 {
    opacity: 0.5;
}

.pointer-events-none {
    pointer-events: none;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ai-section {
        padding: 1rem;
        margin-top: 1.5rem;
    }

    .ai-report-content {
        padding: 1rem;
    }

    .chat-box {
        padding: 10px;
    }

    .chat-intro {
        padding: 0.75rem 1rem;
    }

    .ai-header h3 {
        font-size: 1.25rem;
    }
}