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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* Navigation Tabs */
.nav-tabs {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    padding: 0.5rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px var(--shadow);
    backdrop-filter: blur(10px);
}

.nav-tabs .tab {
    padding: 0.875rem 2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
    position: relative;
    letter-spacing: 0.3px;
}

.nav-tabs .tab:hover {
    color: var(--text);
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.nav-tabs .tab.active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

header h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

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

/* Main Layout */
main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

section {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px var(--shadow);
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

/* Upload Section */
.subject-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.subject-selector label {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

#subjectSelect {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#subjectSelect:focus {
    outline: none;
    border-color: var(--primary);
}

#subjectSelect option {
    background: var(--surface);
    color: var(--text);
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--background);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--primary);
    stroke-width: 2;
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.upload-subtext {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.file-types {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Uploaded Files */
.uploaded-files {
    margin-top: 2rem;
}

.uploaded-files h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--background);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.file-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.file-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.75rem;
    color: white;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: var(--text);
    display: block;
    margin-bottom: 0.25rem;
}

.file-size {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.delete-button {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.delete-button:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Gallery Section */
.gallery-section {
    width: 100%;
}

.gallery-header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.subject-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 2rem;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.gallery-card {
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.gallery-card.hidden {
    display: none;
}

.gallery-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.gallery-file-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    color: white;
}

.subject-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Subject-specific colors */
.mathematics { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.science { background: linear-gradient(135deg, #10b981, #059669); }
.history { background: linear-gradient(135deg, #f59e0b, #d97706); }
.literature { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.computer-science { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.languages { background: linear-gradient(135deg, #ec4899, #db2777); }
.arts { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.other { background: linear-gradient(135deg, #64748b, #475569); }

.gallery-card-body {
    margin-bottom: 1rem;
}

.gallery-card-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.gallery-card-footer {
    display: flex;
    gap: 0.5rem;
}

.gallery-action-btn {
    flex: 1;
    padding: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.gallery-action-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.gallery-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* Q&A Section */
.question-input-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

#questionInput {
    flex: 1;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    background: var(--background);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#questionInput:focus {
    outline: none;
    border-color: var(--primary);
}

#questionInput::placeholder {
    color: var(--text-muted);
}

.ask-button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ask-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.ask-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Conversation */
.conversation {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.conversation::-webkit-scrollbar {
    width: 8px;
}

.conversation::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.conversation::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.conversation::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--text-muted);
    stroke-width: 1.5;
}

.message {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    animation: slideIn 0.3s ease;
}

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

.message.user {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    margin-left: 2rem;
    border-bottom-right-radius: 0.25rem;
}

.message.ai {
    background: var(--background);
    border: 1px solid var(--border);
    margin-right: 2rem;
    border-bottom-left-radius: 0.25rem;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.message-header.user {
    color: rgba(255, 255, 255, 0.9);
}

.message-header.ai {
    color: var(--primary);
}

.message-content {
    line-height: 1.6;
}

.message.user .message-content {
    color: white;
}

.message.ai .message-content {
    color: var(--text);
}

.typing-indicator {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    margin-right: 2rem;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 968px) {
    main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    section {
        padding: 1.5rem;
    }

    .question-input-container {
        flex-direction: column;
    }

    .ask-button {
        width: 100%;
        justify-content: center;
    }

    .message.user,
    .message.ai {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Landing Page Styles */
.hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    z-index: 2;
    max-width: 800px;
}

.hero-title {
    font-size: 4.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary), #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero-subtitle {
    font-size: 1.8rem;
    color: var(--text);
    margin-bottom: 1rem;
    font-weight: 600;
}

.hero-description {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 1rem 2.5rem;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-3px);
}

.btn-large {
    padding: 1.25rem 3rem;
    font-size: 1.2rem;
}

.hero-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.floating-card {
    position: absolute;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 8px 24px var(--shadow);
    animation: float 6s ease-in-out infinite;
}

.card-icon {
    font-size: 2.5rem;
}

.card-text {
    font-weight: 600;
    color: var(--text);
}

.card-1 {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
}

.card-2 {
    top: 20%;
    right: 15%;
    animation-delay: 1.5s;
}

.card-3 {
    bottom: 25%;
    left: 15%;
    animation-delay: 3s;
}

.card-4 {
    bottom: 20%;
    right: 10%;
    animation-delay: 4.5s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.features {
    padding: 6rem 2rem;
    background: var(--surface);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 4rem;
    color: var(--text);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 1.25rem;
    padding: 2.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px var(--shadow);
    border-color: var(--primary);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon svg {
    width: 40px;
    height: 40px;
    stroke-width: 2;
    color: white;
}

.feature-card h3 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 1rem;
}

.cta {
    padding: 6rem 2rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.cta-content {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.cta-content h2 {
    font-size: 2.5rem;
    color: var(--text);
    margin-bottom: 1rem;
}

.cta-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.4rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .floating-card {
        display: none;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

/* Upload Success Styles */
.upload-success {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--background);
    border-radius: 1rem;
    border: 2px solid var(--success);
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--success);
    stroke-width: 2;
}

.upload-success h3 {
    font-size: 1.8rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

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

/* Copilot-like Chatbot Styles */
.copilot-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--background);
}

.copilot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 2px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.copilot-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copilot-icon svg {
    width: 28px;
    height: 28px;
    color: white;
    stroke-width: 2;
}

.header-info h2 {
    font-size: 1.3rem;
    color: var(--text);
    margin: 0;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.icon-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    color: var(--text);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.copilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.copilot-messages::-webkit-scrollbar {
    width: 8px;
}

.copilot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.copilot-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.welcome-message {
    text-align: center;
    max-width: 600px;
    margin: auto;
    padding: 3rem 2rem;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.welcome-icon svg {
    width: 48px;
    height: 48px;
    color: white;
    stroke-width: 2;
}

.welcome-message h3 {
    font-size: 2rem;
    color: var(--text);
    margin-bottom: 1rem;
}

.welcome-message p {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.chip {
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 2rem;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chip:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.chat-message {
    display: flex;
    gap: 1rem;
    max-width: 800px;
    animation: slideUp 0.3s ease;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar.user {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.message-avatar.ai {
    background: var(--surface);
    border: 2px solid var(--border);
}

.message-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
    stroke-width: 2;
}

.message-avatar.ai svg {
    color: var(--primary);
}

.message-content {
    flex: 1;
}

.message-bubble {
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    line-height: 1.6;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message.ai .message-bubble {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 0.25rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}

.copilot-input-wrapper {
    background: var(--surface);
    border-top: 2px solid var(--border);
    padding: 1.5rem 2rem;
}

.copilot-input-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.75rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    transition: border-color 0.3s ease;
}

.copilot-input-container:focus-within {
    border-color: var(--primary);
}

.copilot-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    line-height: 1.5;
}

.copilot-input:focus {
    outline: none;
}

.copilot-input::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.send-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.send-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.input-footer {
    max-width: 900px;
    margin: 0.75rem auto 0;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.model-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.model-info.warning {
    color: var(--warning, #f4c430);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quota-info {
    font-size: 0.75rem;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-muted);
    font-weight: 500;
}

.char-counter {
    font-size: 0.75rem;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-muted);
}

.char-counter.over-limit {
    color: var(--danger, #ff6b6b);
    font-weight: 600;
}

/* Gallery Styles */
.gallery-controls {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-container {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    stroke-width: 2;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 3rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.clear-search {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.clear-search:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.clear-search svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sort-container label {
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.sort-select {
    padding: 0.875rem 1rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary);
}

.results-info {
    margin-bottom: 1.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--background);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.results-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.results-info span {
    color: var(--primary);
    font-weight: 600;
}

/* Notes Panel */
.notes-panel {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    max-height: 300px;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 300px;
        opacity: 1;
    }
}

.notes-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.notes-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text);
}

.close-panel {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.close-panel:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.notes-panel-content {
    padding: 1rem 1.5rem;
}

.loading-notes, .empty-notes {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

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

.subject-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.note-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--background);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.note-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.note-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.mini-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Logout Button */
.logout-btn {
    margin-left: auto !important;
    background: transparent !important;
    color: var(--danger) !important;
    border: 2px solid var(--danger) !important;
}

.logout-btn:hover {
    background: var(--danger) !important;
    color: white !important;
}

/* Spinning animation for loading states */
.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Chatbot Access Section */


