:root {
    /* Gemini-like Vibrant Palette */
    --bg-dark: #0f0c29;
    --bg-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --primary: #8a2be2; /* Blue Violet */
    --primary-gradient: linear-gradient(90deg, #ff00cc, #333399);
    --secondary: #00c6ff;
    --secondary-gradient: linear-gradient(90deg, #00c6ff, #0072ff);
    
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    
    --radius: 16px;
    --radius-sm: 8px;
    
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
}

/* Utilities */
.view-hidden { display: none !important; }
.view-active { display: flex !important; }
.w-full { width: 100%; }
.text-red { color: #ff4757; }
.text-blue { color: #1e90ff; }
.text-green { color: #2ed573; }

.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.subject-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subject-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.subject-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.subject-item.active {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px rgba(255, 0, 204, 0.3);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Welcome View */
#welcomeView {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.welcome-hero h1 {
    font-size: 3rem;
    margin-bottom: 16px;
}

.welcome-hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Chat View */
#chatView {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.chat-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.source-panel {
    width: 300px;
    border-right: 1px solid var(--glass-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: var(--transition);
}

.source-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.source-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.source-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.source-btn i {
    font-size: 1.5rem;
}

.active-sources {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.source-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    border-left: 3px solid var(--secondary);
}

.source-item i {
    margin-right: 8px;
}

.chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-messages {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    display: flex;
    gap: 16px;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user .msg-avatar { background: var(--secondary-gradient); }
.ai .msg-avatar { background: var(--primary-gradient); }

.msg-bubble {
    background: var(--glass-bg);
    padding: 16px 20px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    line-height: 1.5;
}

.user .msg-bubble {
    background: rgba(0, 198, 255, 0.1);
    border-bottom-right-radius: 4px;
}

.ai .msg-bubble {
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    margin: 24px;
    border-radius: 24px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#chatInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    resize: none;
    padding: 12px 0;
    outline: none;
    max-height: 150px;
}

/* Buttons */
.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.glow-effect:hover {
    box-shadow: 0 0 20px rgba(255, 0, 204, 0.5);
    transform: translateY(-2px);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    padding: 40px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    position: relative;
    animation: slideUp 0.4s ease-out;
}

.close-modal, .close-modal-url {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.input-field {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 20px 0;
    outline: none;
}

.input-field:focus {
    border-color: var(--primary);
}

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Markdown parsing classes */
.msg-bubble pre {
    background: #1e1e1e;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}
.msg-bubble code {
    font-family: monospace;
    background: rgba(255,255,255,0.1);
    padding: 2px 4px;
    border-radius: 4px;
}
.msg-bubble pre code {
    background: transparent;
    padding: 0;
}
