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

:root {
    --bg-color: #030014;
    --card-bg: rgba(255, 255, 255, 0.03);
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.4);
    --secondary: #06b6d4;
    --secondary-glow: rgba(6, 182, 212, 0.4);
    --accent: #f43f5e;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.08);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

body.dash-active {
    overflow: hidden;
    height: 100%;
}

/* Background Animated Gradient Mesh */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.mesh-blob {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: rotate 30s infinite linear;
}

.blob-1 {
    background: var(--primary);
    top: -200px;
    right: -100px;
}

.blob-2 {
    background: var(--secondary);
    bottom: -200px;
    left: -100px;
    animation-delay: -15s;
}

@keyframes rotate {
    from { transform: rotate(0deg) scale(1); }
    33% { transform: rotate(120deg) scale(1.2); }
    66% { transform: rotate(240deg) scale(0.8); }
    to { transform: rotate(360deg) scale(1); }
}

/* Nav Styles */
nav {
    display: flex;
    justify-content: space-between;
    padding: 2rem 5%;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(3, 0, 20, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dim);
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-main);
}

/* Button Component */
.btn {
    padding: 0.8rem 1.8rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-glass {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Card Component */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s forwards;
}

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: white;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

/* Grid System */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 768px) {
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ChatGPT Dashboard Layout */
.dash-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    height: 100%;
    transition: var(--transition);
}

.chat-surface {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.05), transparent 40%),
                radial-gradient(circle at bottom left, rgba(6, 182, 212, 0.05), transparent 40%);
    position: relative;
}

/* Sidebar Elements */
.new-chat-btn {
    width: 100%;
    margin-bottom: 2rem;
    justify-content: flex-start !important;
}

.side-history {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.history-item {
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dim);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.user-profile {
    padding-top: 1rem;
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Chat Area */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem 15% 10rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    scroll-behavior: smooth;
}

.msg-row {
    display: flex;
    gap: 1.5rem;
    width: 100%;
}

.msg-ai { background: rgba(255, 255, 255, 0.02); border-radius: 12px; padding: 1.5rem; }
.msg-user { padding: 1.5rem; }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.ai-avatar { background: var(--primary); color: white; }
.user-avatar { background: #34d399; color: white; }

.msg-content {
    line-height: 1.7;
    font-size: 1.05rem;
    color: var(--text-main);
}

/* Input Area */
.chat-input-wrapper {
    position: absolute;
    bottom: 2rem;
    left: 0;
    width: 100%;
    padding: 0 15%;
}

.chat-input-container {
    background: #212121;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    resize: none;
    max-height: 200px;
    min-height: 24px;
    padding: 0.5rem 0;
    outline: none;
}

.send-btn {
    background: var(--primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.5;
}

.send-btn.active { opacity: 1; transform: scale(1.05); }

@media (max-width: 1024px) {
    .chat-messages, .chat-input-wrapper { padding-left: 5%; padding-right: 5%; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        z-index: 1000;
        height: 100%;
    }
    .sidebar.open { left: 0; }
}
