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

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --glass-blur: blur(12px);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
                      radial-gradient(circle at 0% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

textarea, select {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

button {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.results-area {
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
    scroll-behavior: smooth;
}

.input-area {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.input-area:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
    background: rgba(15, 23, 42, 0.6);
}

.input-area textarea {
    background: transparent;
    border: none;
    padding: 0;
    resize: none;
}

.input-area textarea:focus {
    box-shadow: none;
}

.input-area button {
    align-self: flex-end;
    width: auto;
    padding: 0.6rem 1.5rem;
    border-radius: 0.5rem;
}


.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.message {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    max-width: 90%;
    animation: slideIn 0.4s ease-out;
}

.message.user {
    background: rgba(99, 102, 241, 0.2);
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 0;
}

.message.assistant {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 0;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.report-output {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 1rem;
    padding: 1.5rem;
    font-size: 0.95rem;
    color: #e2e8f0;
    overflow-x: auto;
    border: 1px dashed var(--border-color);
}

.report-output h1, .report-output h2, .report-output h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
    -webkit-text-fill-color: initial;
    background: none;
}

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

.report-output ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    margin-bottom: 1rem;
}
