/* ============================================
   OpenGov AI Assistant - Custom Styles
   Modern Government Professional Theme
   ============================================ */

/* CSS Variables */
:root {
    --primary-color: #1a365d;
    --secondary-color: #2c5282;
    --accent-color: #3182ce;
    --light-blue: #ebf8ff;
    --gradient-start: #1a365d;
    --gradient-end: #2b6cb0;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #2d3748;
    line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%) !important;
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
}

.navbar-brand {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-brand i {
    font-size: 1.8rem;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.5s ease;
}

.section.active {
    display: block;
}

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

/* Hero Header */
.hero-header {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    padding: 2rem 0;
}

.hero-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* Chat Container */
.chat-container {
    max-width: 900px;
    margin: 0 auto;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    max-height: 450px;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.5);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

/* Message Styles */
.message {
    display: flex;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.message-content {
    flex: 1;
}

.message-bubble {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    position: relative;
}

.ai-bubble {
    background: white;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.user-bubble {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-top-right-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* Sources Section */
.sources-section {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.sources-section h6 {
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-item {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: white;
    border-radius: 20px;
    font-size: 0.8rem;
    margin: 0.25rem;
    border: 1px solid #e2e8f0;
    color: #4a5568;
}

.source-item i {
    margin-right: 0.25rem;
    color: var(--accent-color);
}

/* Loading Animation */
.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    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;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Chat Input Area */
.chat-input-area {
    background: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border-top: 1px solid #e2e8f0;
}

.form-select, .form-control {
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    padding: 0.75rem 1rem;
    transition: var(--transition);
}

.form-select:focus, .form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
    height: 100%;
    min-height: 42px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--gradient-start) 100%);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Quick Actions */
.quick-actions .btn-outline-secondary {
    border-radius: 20px;
    padding: 0.5rem 1rem;
}

/* Admin Section */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #f7fafc;
}

.upload-area:hover {
    border-color: var(--accent-color);
    background: var(--light-blue);
}

.upload-area.dragover {
    border-color: var(--accent-color);
    background: rgba(66, 153, 225, 0.1);
}

/* About Section */
.feature-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.tech-badges .badge {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-header h1 {
        font-size: 1.8rem;
    }
    
    .hero-header p {
        font-size: 1rem;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
    
    .chat-container {
        min-height: 400px;
    }
    
    .chat-messages {
        max-height: 350px;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
}

@media (max-width: 576px) {
    .message {
        flex-direction: column;
    }
    
    .message-avatar {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .chat-input-area .row {
        flex-direction: column;
    }
    
    .chat-input-area .col-md-3,
    .chat-input-area .col-md-7,
    .chat-input-area .col-md-2 {
        width: 100%;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Typing Animation */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: typing 1s infinite;
}

@keyframes typing {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Copy Button */
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
    font-size: 0.9rem;
}

.copy-btn:hover {
    color: var(--accent-color);
}

/* Alert Styling */
.alert {
    border-radius: 8px;
    border: none;
}

/* Progress Bar */
.progress {
    border-radius: 10px;
    height: 8px;
}

.progress-bar {
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--secondary-color) 100%);
}

/* Result Messages */
.result-success {
    color: #38a169;
    background: #f0fff4;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #48bb78;
}

.result-error {
    color: #c53030;
    background: #fff5f5;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #f56565;
}

/* File Preview */
.file-preview {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-top: 1rem;
}

.file-preview i {
    font-size: 1.5rem;
    color: #e53e3e;
    margin-right: 0.75rem;
}

.file-preview .file-info {
    flex: 1;
}

.file-preview .file-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.file-preview .file-size {
    color: #718096;
    font-size: 0.8rem;
}

.file-preview .remove-file {
    color: #e53e3e;
    cursor: pointer;
    padding: 0.25rem;
}

/* Example Questions */
.example-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.example-btn {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #4a5568;
    cursor: pointer;
    transition: var(--transition);
}

.example-btn:hover {
    background: var(--light-blue);
    border-color: var(--accent-color);
    color: var(--accent-color);
}