/* Custom CSS for School Q&A System */

:root {
    --primary-color: 210 91% 52%; /* #1B82F7 */
    --success-color: 137 72% 47%; /* #2FB76F */
    --warning-color: 39 100% 57%; /* #FFB81C */
    --danger-color: 356 75% 53%; /* #E53E3E */
    --info-color: 195 91% 55%; /* #0BC5EA */
    --dark-color: 210 11% 15%; /* #242731 */
    --light-color: 210 11% 98%; /* #F5F7FA */
    --border-radius: 8px;
    --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* General Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

.main-content {
    min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, hsl(var(--primary-color)) 0%, hsl(var(--info-color)) 100%);
    color: white;
    padding: 2rem 0;
}

.hero-section h1 {
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.hero-section .lead {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.feature-icon i {
    width: 28px;
    height: 28px;
    color: white;
}

.feature-card h5 {
    color: white;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Stats Section */
.stats-section {
    background: var(--bs-gray-100);
    padding: 4rem 0;
}

.stat-card {
    text-align: center;
    padding: 2rem 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    color: hsl(var(--primary-color));
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    color: hsl(var(--primary-color));
}

.stat-label {
    color: var(--bs-gray-600);
    font-size: 0.9rem;
    margin: 0;
}

/* Question Cards */
.question-item {
    transition: all 0.3s ease;
    background: var(--bs-body-bg);
}

.question-item:hover {
    box-shadow: var(--box-shadow);
    transform: translateY(-2px);
}

.question-title a {
    color: hsl(var(--primary-color));
    font-weight: 600;
}

.question-title a:hover {
    color: hsl(var(--primary-color) / 0.8);
}

.question-preview {
    font-size: 0.9rem;
    line-height: 1.5;
}

.question-meta {
    font-size: 0.8rem;
}

.question-card {
    transition: all 0.3s ease;
}

.question-card:hover {
    box-shadow: var(--box-shadow);
}

/* Chatbot Styles */
.chatbot-section {
    background: var(--bs-gray-50);
}

.chatbot-messages {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bs-body-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--bs-border-color);
}

.chat-message {
    max-width: 75%;
    padding: 12px 16px;
    margin: 10px;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-message.user {
    background-color: #3498db; /* bright blue */
    color: white;
    align-self: flex-end;
    text-align: right;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
}

.chat-message.bot {
    background: var(--bs-gray-100);
    color: var(--bs-body-color);
    border-bottom-left-radius: 0.25rem;
}

.chat-message.ai {
    background-color: #2c2c2c; /* dark gray for AI */
    color: #f1f1f1;
    align-self: flex-start;
    text-align: left;
    border-left: 4px solid #f39c12; /* gold stripe for flair */
    animation: fadeIn 0.3s ease-in-out;
    opacity: 1 !important;
    visibility: visible !important;
}

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

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

.chat-avatar.user {
    background: hsl(var(--primary-color));
    color: white;
}

.chat-avatar.bot {
    background: hsl(var(--success-color));
    color: white;
}

.chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-bubble.user {
    background: hsl(var(--primary-color));
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-bubble.bot {
    background: var(--bs-gray-100);
    color: var(--bs-body-color);
    border-bottom-left-radius: 0.25rem;
}

.chat-timestamp {
    font-size: 0.7rem;
    color: var(--bs-gray-500);
    margin-top: 0.25rem;
}

/* Loading Animation */
.loading-dots {
    display: inline-block;
}

.loading-dots:after {
    content: '...';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% {
        color: transparent;
        text-shadow: .25em 0 0 transparent, .5em 0 0 transparent;
    }
    40% {
        color: var(--bs-body-color);
        text-shadow: .25em 0 0 transparent, .5em 0 0 transparent;
    }
    60% {
        text-shadow: .25em 0 0 var(--bs-body-color), .5em 0 0 transparent;
    }
    80%, 100% {
        text-shadow: .25em 0 0 var(--bs-body-color), .5em 0 0 var(--bs-body-color);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-section {
        padding: 1rem 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .chat-bubble {
        max-width: 90%;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* Navigation Enhancements */
.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

.nav-link {
    font-weight: 500;
}

/* Button Enhancements */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: hsl(var(--primary-color));
    border-color: hsl(var(--primary-color));
}

.btn-primary:hover {
    background: hsl(var(--primary-color) / 0.9);
    border-color: hsl(var(--primary-color) / 0.9);
    transform: translateY(-1px);
}

/* Form Enhancements */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid var(--bs-border-color);
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: hsl(var(--primary-color));
    box-shadow: 0 0 0 0.2rem hsl(var(--primary-color) / 0.25);
}

/* Card Enhancements */
.card {
    border-radius: var(--border-radius);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card-header {
    background: var(--bs-gray-50);
    border-bottom: 1px solid var(--bs-border-color);
    font-weight: 600;
}

/* Badge Enhancements */
.badge {
    font-weight: 500;
    border-radius: calc(var(--border-radius) / 2);
}

/* Alert Enhancements */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Footer */
.footer {
    background: var(--bs-gray-100);
    border-top: 1px solid var(--bs-border-color);
    margin-top: auto;
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.min-vh-100 {
    min-height: 100vh;
}

/* Dark theme adjustments */
[data-bs-theme="dark"] .hero-section {
    background: linear-gradient(135deg, hsl(var(--primary-color)) 0%, hsl(var(--info-color)) 100%);
}

[data-bs-theme="dark"] .stats-section {
    background: var(--bs-gray-900);
}

[data-bs-theme="dark"] .chatbot-section {
    background: var(--bs-gray-900);
}

[data-bs-theme="dark"] .footer {
    background: var(--bs-gray-900);
    border-top-color: var(--bs-gray-700);
}
