/* NEET Study Assistant - Premium Dark Theme */

:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(30, 30, 45, 0.6);
    --bg-card-hover: rgba(40, 40, 60, 0.8);

    /* Subject Colors */
    --biology-primary: #10b981;
    --biology-secondary: #059669;
    --biology-bg: rgba(16, 185, 129, 0.1);

    --chemistry-primary: #8b5cf6;
    --chemistry-secondary: #7c3aed;
    --chemistry-bg: rgba(139, 92, 246, 0.1);

    --physics-primary: #f59e0b;
    --physics-secondary: #d97706;
    --physics-bg: rgba(245, 158, 11, 0.1);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Accent Colors */
    --accent-primary: #3b82f6;
    --accent-secondary: #2563eb;
    --accent-success: #22c55e;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(59, 130, 246, 0.5);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);

    /* Spacing */
    --header-height: 72px;
    --sidebar-width: 320px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* App Container */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--chemistry-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--chemistry-primary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.nav-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Main Content */
.main-content {
    margin-top: var(--header-height);
    flex: 1;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    position: sticky;
    top: var(--header-height);
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Subject Cards */
.subject-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subject-card {
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
}

.subject-card:hover {
    transform: translateX(4px);
    border-color: var(--border-default);
}

.subject-card.active.biology {
    border-color: var(--biology-primary);
    background: var(--biology-bg);
}

.subject-card.active.chemistry {
    border-color: var(--chemistry-primary);
    background: var(--chemistry-bg);
}

.subject-card.active.physics {
    border-color: var(--physics-primary);
    background: var(--physics-bg);
}

.subject-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.subject-icon.biology {
    background: var(--biology-bg);
}

.subject-icon.chemistry {
    background: var(--chemistry-bg);
}

.subject-icon.physics {
    background: var(--physics-bg);
}

.subject-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.subject-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Class Toggle */
.class-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
}

.class-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-fast);
}

.class-btn:hover {
    color: var(--text-primary);
}

.class-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Search Input */
.search-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* Chapter List */
.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 400px;
    overflow-y: auto;
}

.chapter-item {
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.chapter-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.chapter-item.active {
    background: var(--accent-primary);
    color: white;
}

.chapter-number {
    min-width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.chapter-item.active .chapter-number {
    background: rgba(255, 255, 255, 0.2);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 24px 32px;
    max-width: 900px;
}

/* Welcome Screen */
.welcome-screen {
    text-align: center;
    padding: 60px 40px;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 24px;
}

.welcome-screen h2 {
    font-size: 2rem;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-screen>p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 32px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.api-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 32px;
    text-align: center;
}

.api-warning p:first-child {
    color: #f59e0b;
    margin-bottom: 8px;
}

.api-warning p:last-of-type {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.api-warning button {
    padding: 10px 24px;
    background: #f59e0b;
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    font-weight: 500;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.quick-action {
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.95rem;
}

.quick-action:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* Chapter Content */
.chapter-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chapter-header {
    margin-bottom: 24px;
}

.chapter-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.badge {
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.subject-badge.biology {
    background: var(--biology-bg);
    color: var(--biology-primary);
}

.subject-badge.chemistry {
    background: var(--chemistry-bg);
    color: var(--chemistry-primary);
}

.subject-badge.physics {
    background: var(--physics-bg);
    color: var(--physics-primary);
}

.chapter-header h2 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.chapter-header p {
    color: var(--text-muted);
}

/* AI Container */
.ai-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.ai-header {
    padding: 20px 24px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.ai-header h3 {
    font-size: 1.1rem;
}

.ai-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-action-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.ai-action-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.ai-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-content {
    padding: 24px;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
}

.ai-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.ai-placeholder span {
    font-size: 2.5rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 16px;
}

.ai-placeholder .small {
    font-size: 0.85rem;
    margin-top: 8px;
}

.ai-message {
    margin-bottom: 20px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    line-height: 1.7;
    animation: fadeIn 0.3s ease;
}

.ai-message .provider-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.ai-message .provider-badge.claude {
    background: rgba(216, 153, 82, 0.15);
    color: #d89952;
}

.ai-message .provider-badge.gemini {
    background: rgba(66, 133, 244, 0.15);
    color: #4285f4;
}

.ai-input-container {
    padding: 20px 24px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 12px;
}

.ai-input {
    flex: 1;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}

.ai-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.ai-send-btn {
    padding: 14px 24px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-fast);
}

.ai-send-btn:hover {
    background: var(--accent-secondary);
}

.ai-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* NCERT Card */
.ncert-card {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-card));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.ncert-card h4 {
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.ncert-card p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.ncert-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--accent-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition-fast);
}

.ncert-link:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.mcq-modal {
    max-width: 700px;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.modal-body {
    padding: 24px;
}

.info-box {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
}

.info-box h4 {
    margin-bottom: 8px;
    color: var(--accent-primary);
}

.info-box p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-group small a {
    color: var(--accent-primary);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.btn-primary:hover {
    background: var(--accent-secondary);
}

.settings-info {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.settings-info h4 {
    margin-bottom: 12px;
}

.settings-info ul {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 20px;
}

.settings-info li {
    margin-bottom: 8px;
}

/* Saved Content */
.saved-content,
.history-content {
    padding: 20px 0;
}

.saved-content h2,
.history-content h2 {
    margin-bottom: 8px;
}

.saved-content>p,
.history-content>p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.saved-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saved-item {
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saved-item h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.saved-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.saved-item button {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
}

.saved-item button:hover {
    border-color: var(--accent-error);
    color: var(--accent-error);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state span {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* MCQ Styles */
.mcq-question {
    margin-bottom: 24px;
}

.mcq-question h4 {
    margin-bottom: 16px;
    line-height: 1.6;
}

.mcq-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mcq-option {
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: left;
    color: var(--text-secondary);
    width: 100%;
}

.mcq-option:hover:not(:disabled) {
    border-color: var(--accent-primary);
    background: var(--bg-card-hover);
}

.mcq-option.correct {
    border-color: var(--accent-success);
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-success);
}

.mcq-option.incorrect {
    border-color: var(--accent-error);
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-error);
}

.mcq-explanation {
    margin-top: 16px;
    padding: 16px;
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.mcq-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.mcq-navigation button {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
}

.mcq-nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.mcq-nav-btn:hover:not(:disabled) {
    color: var(--text-primary);
    border-color: var(--border-default);
}

.mcq-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mcq-next-btn {
    background: var(--accent-primary);
    border: none;
    color: white;
}

.mcq-next-btn:hover {
    background: var(--accent-secondary);
}

.mcq-score {
    padding: 6px 16px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }

    .content-area {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }

    .header-logo h1 {
        font-size: 1.1rem;
    }

    .header-nav {
        gap: 4px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
    }

    .content-area {
        max-width: 100%;
        padding: 16px;
    }

    .ai-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .welcome-screen {
        padding: 30px 20px;
    }

    .welcome-icon {
        font-size: 3rem;
    }

    .welcome-screen h2 {
        font-size: 1.5rem;
    }
}