/* Global variables & Reset */
:root {
    --bg-color: #FAFAFA;
    --surface-color: #FFFFFF;
    --primary-color: #111827;
    --primary-hover: #374151;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --accent-color: #6366F1;
    /* Indigo-500ish for subtle accents */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--primary-color);
}

button,
input,
textarea,
select {
    font-family: var(--font-body);
}

/* Layout Classes */
.hidden {
    display: none !important;
}

.view {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    /* Default flex but hidden overrides */
    flex-direction: column;
}

.view.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    z-index: 50;
    /* backdrop-filter: blur(8px); */
    /* background: rgba(250, 250, 250, 0.8); */
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--primary-color);
}

/* Landing Page - Modern Design */
#view-landing {
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    position: relative;
    overflow: hidden;
}

/* Animated gradient orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    bottom: -10%;
    right: -10%;
    animation-delay: 7s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 14s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.landing-content {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    padding: 2rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.landing-content h1 {
    font-size: 4.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.04em;
    color: white;
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #f093fb 50%, #4facfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    display: inline-block;
    animation: gradientShift 3s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.landing-content .subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 3rem;
    font-weight: 400;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    animation: fadeInUp 0.8s ease 0.4s backwards;
}

/* Card Group */
.card-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease 0.6s backwards;
}

.feature-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.feature-card-primary {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-color: rgba(102, 126, 234, 0.3);
}

.feature-card-primary:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.feature-card h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.feature-card p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.card-arrow {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    transition: all 0.3s ease;
    display: inline-block;
}

.feature-card:hover .card-arrow {
    color: white;
    transform: translateX(5px);
}

/* Features List */
.features-list {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease 0.8s backwards;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.feature-item svg {
    color: #4facfe;
    flex-shrink: 0;
}



/* Buttons */
.btn {
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 1.05rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
}

.btn-text:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.03);
}


/* Modal form */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.modal-card {
    background: white;
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 101;
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-card h2 {
    margin-bottom: 0.5rem;
}

.modal-desc {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border 0.2s;
    outline: none;
    background: #f9fafb;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    background: white;
}

.form-group textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Chat Interface */
#view-chat {
    background: white;
    flex-direction: row;
}

aside {
    width: 300px;
    border-right: 1px solid var(--border-color);
    background: #F9FAFB;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: absolute;
    left: 0;
    top: 60px;
    /* Below header if header persists, or full height */
    bottom: 0;
    z-index: 20;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

aside.hidden {
    transform: translateX(-100%);
    display: flex !important;
    /* Keep display flex for transition, toggle class hides visuals */
    visibility: hidden;
}

/* If header is fixed, we need to account for it inside view-chat or have view-chat top-padded */
#view-chat {
    padding-top: 60px;
}

.chat-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: white;
    height: 100%;
}

.chat-header-bar {
    display: none;
    /* Hidden as per user request */
}

.btn-back {
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-back:hover {
    color: var(--primary-color);
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--primary-color);
}

#chat-mode-indicator {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    scroll-behavior: smooth;
    background: linear-gradient(to bottom, #fafafa 0%, #ffffff 100%);
}

/* Centered message layout - unique to Lumina */
.message {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.bubble {
    max-width: 680px;
    width: 100%;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    font-size: 1rem;
    line-height: 1.7;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.bubble:hover {
    box-shadow: var(--shadow-md);
}

/* User messages - distinct card style */
.message.user .bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Assistant messages - clean academic style */
.message.assistant .bubble {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
}

/* System welcome message */
.message.system-welcome .bubble {
    background: transparent;
    color: var(--text-muted);
    font-style: italic;
    border: 1px dashed var(--border-color);
    text-align: center;
    max-width: 500px;
    box-shadow: none;
}

/* Markdown styling within bubbles */
.bubble h1,
.bubble h2,
.bubble h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.bubble h1 {
    font-size: 1.5rem;
}

.bubble h2 {
    font-size: 1.3rem;
}

.bubble h3 {
    font-size: 1.1rem;
}

.bubble strong {
    font-weight: 600;
    color: inherit;
}

.bubble em {
    font-style: italic;
}

.bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message.user .bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.bubble pre {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.bubble pre code {
    background: transparent;
    padding: 0;
}

/* Markdown tables */
.bubble .md-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.bubble .md-table th,
.bubble .md-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.bubble .md-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-main);
}

.bubble .md-table tr:hover {
    background: #fafafa;
}

/* Markdown lists */
.bubble ul,
.bubble ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.bubble li {
    margin: 0.25rem 0;
}

/* Message action buttons */
.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bubble:hover .message-actions {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: #f9fafb;
    color: var(--text-main);
    border-color: var(--text-muted);
}

.action-btn svg {
    display: block;
}


/* Input Area */
.chat-input-area {
    padding: 1.5rem 2rem;
    /* border-top: 1px solid var(--border-color); */
    background: white;
}

.input-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.input-wrapper textarea {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background: #F9FAFB;
    resize: none;
    outline: none;
    max-height: 150px;
    box-shadow: var(--shadow-sm);
    font-size: 1rem;
    transition: box-shadow 0.2s;
}

.input-wrapper textarea:focus {
    box-shadow: var(--shadow-md);
    background: white;
    border-color: #D1D5DB;
}

.btn-send {
    position: absolute;
    right: 12px;
    bottom: 12px;
    /* align appropriately based on padding */
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-send:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Panel Content */
.panel-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-content {
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.9rem;
}

.info-item {
    margin-bottom: 1rem;
}

.info-label {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.info-value {
    color: var(--text-main);
}