/* Professional styles for Source Stack */

/* Corporate typography */
body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-weight: 400;
    letter-spacing: -0.003em;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

h1 { font-size: 2.25rem; font-weight: 600; }
h2 { font-size: 1.875rem; font-weight: 600; }
h3 { font-size: 1.5rem; font-weight: 500; }
h4 { font-size: 1.25rem; font-weight: 500; }
h5 { font-size: 1.125rem; font-weight: 500; }
h6 { font-size: 1rem; font-weight: 500; }

.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-weight: 500;
    letter-spacing: -0.03em;
}

.lead {
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: -0.01em;
}

.card-title {
    font-weight: 500;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
}

/* Additional typography refinements */
small, .small {
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
}

.text-muted {
    opacity: 0.7;
    font-weight: 400;
}

.fw-bold {
    font-weight: 600 !important;
}

.fw-medium {
    font-weight: 500 !important;
}

/* Corporate spacing */
.card-body {
    padding: 1.5rem;
}

.card-header {
    padding: 1rem 1.5rem;
}

/* Professional list items */
.list-group-item {
    font-size: 0.9rem;
    padding: 1rem 1.25rem;
}

/* Professional navbar styling */
.navbar {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.125rem;
    letter-spacing: -0.015em;
    text-transform: uppercase;
    font-family: "Inter", system-ui, sans-serif;
}

/* Professional card styling */
.card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
}

.card-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

/* Corporate button styling */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: 4px;
    padding: 0.6rem 1.25rem;
    transition: all 0.15s ease;
    font-family: "Inter", system-ui, sans-serif;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #0066cc, #004499);
    border: none;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0052a3, #003366);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    border: none;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #117a8b);
    border: none;
    box-shadow: 0 2px 4px rgba(23, 162, 184, 0.2);
}

/* Step numbers for how it works section */
.step-number {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #0066cc, #004499);
    border: none;
}

/* Chat interface styles */
.message {
    animation: fadeIn 0.3s ease-in-out;
}

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

.message-content {
    max-width: calc(100% - 60px);
}

.message-text {
    word-wrap: break-word;
    line-height: 1.6;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Professional chat message styling */
.user-message .message-text {
    background: linear-gradient(135deg, #0066cc, #004499);
    color: white;
    margin-left: auto;
    margin-right: 0;
    max-width: 85%;
    border: 1px solid rgba(0, 102, 204, 0.3);
    font-weight: 500;
}

/* Assistant message styling */
.assistant-message .message-text {
    background: rgba(255, 255, 255, 0.05);
    color: var(--bs-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
    backdrop-filter: blur(10px);
}

/* Error message styling */
.error-message .message-text {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    max-width: 85%;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.message-text code {
    background-color: rgba(0, 0, 0, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.assistant-message .message-text code {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Corporate form styling */
.form-control {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--bs-light);
    font-weight: 400;
    font-size: 0.9rem;
    border-radius: 4px;
    padding: 0.6rem 0.75rem;
    transition: all 0.15s ease;
    font-family: "Inter", system-ui, sans-serif;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: #0066cc;
    box-shadow: 0 0 0 0.15rem rgba(0, 102, 204, 0.1);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--bs-light);
    margin-bottom: 0.4rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-family: "Inter", system-ui, sans-serif;
}

/* Professional list styling */
.list-group-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--bs-light);
}

.list-group-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Professional badge styling */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
}

.badge.bg-success {
    background: linear-gradient(135deg, #28a745, #1e7e34) !important;
}

.badge.bg-secondary {
    background: linear-gradient(135deg, #6c757d, #495057) !important;
}

/* Professional alert styling */
.alert {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 8px;
}

/* Professional table styling */
.table-dark {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Professional footer styling */
footer {
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Professional icon styling */
.fa-2x {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Professional dropdown styling */
.dropdown-menu {
    background: rgba(33, 37, 41, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dropdown-item {
    color: var(--bs-light);
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.message-text strong {
    font-weight: 600;
}

.message-meta {
    font-size: 0.8rem;
    margin-top: 8px;
}

/* Source item hover effects */
.source-item {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.source-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Chat input styling */
#chat-input {
    border: 2px solid var(--bs-border-color);
    transition: border-color 0.2s ease-in-out;
    resize: none;
    min-height: 45px;
    max-height: 120px;
}

#chat-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Hero section styling */
.hero-section {
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.1), rgba(var(--bs-info-rgb), 0.1));
    border-radius: 15px;
    padding: 3rem;
    margin: 2rem 0;
}

/* Card hover effects */
.card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Badge styling */
.badge {
    font-size: 0.75em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .message-content {
        max-width: calc(100% - 50px);
    }
    
    .avatar {
        width: 35px !important;
        height: 35px !important;
    }
    
    .user-message {
        margin-left: 5%;
    }
    
    .assistant-message {
        margin-right: 5%;
    }
    
    #chat-messages {
        padding: 1rem;
    }
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Focus styles for accessibility */
.btn:focus,
.form-control:focus,
.source-item:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Custom scrollbar for chat messages */
#chat-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--bs-secondary) transparent;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--bs-secondary);
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: var(--bs-primary);
}

/* Source reference highlighting */
.badge.bg-secondary {
    background-color: var(--bs-info) !important;
}

/* Chat message spacing improvements */
.message {
    margin-bottom: 1.5rem;
}

.user-message {
    margin-left: 20%;
}

.assistant-message {
    margin-right: 10%;
}

/* Better message bubble styling */
.message-text p {
    margin-bottom: 0.75rem;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text ul, .message-text ol {
    margin-bottom: 0.75rem;
    padding-left: 1.25rem;
}

.message-text li {
    margin-bottom: 0.25rem;
}

/* Source metadata styling */
.message-meta {
    opacity: 0.8;
    font-size: 0.75rem;
}

.message-meta .badge {
    font-size: 0.7rem;
    margin-right: 0.25rem;
}

/* Improve chat container */
#chat-messages {
    padding: 1.5rem;
    background: linear-gradient(to bottom, rgba(var(--bs-light-rgb), 0.3), rgba(var(--bs-light-rgb), 0.1));
}

/* Welcome message special styling */
.message:first-child .message-text {
    background: linear-gradient(135deg, var(--bs-info), var(--bs-primary));
    color: white;
    border: none;
}

.message:first-child .message-text code {
    background-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* File upload styling */
.form-control[type="file"] {
    border: 2px dashed var(--bs-border-color);
    padding: 0.75rem;
    transition: border-color 0.2s ease-in-out;
}

.form-control[type="file"]:hover {
    border-color: var(--bs-primary);
}

/* Success/error states */
.alert {
    border-radius: 10px;
}

/* Navigation enhancements */
.navbar-brand {
    font-size: 1.5rem;
}

.nav-link {
    border-radius: 5px;
    margin: 0 2px;
    transition: background-color 0.2s ease-in-out;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Footer styling */
footer {
    background-color: var(--bs-dark);
    color: var(--bs-light);
}

/* Button group spacing */
.btn-group .btn {
    margin-right: 0.25rem;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* Table styling for document lists */
.table {
    border-radius: 10px;
    overflow: hidden;
}

/* Custom tooltip styling */
[title] {
    cursor: help;
}

/* Error state styling */
.is-invalid {
    border-color: var(--bs-danger);
}

.invalid-feedback {
    display: block;
}

/* Success state styling */
.is-valid {
    border-color: var(--bs-success);
}

/* Loading state for buttons */
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Source library grid improvements */
.source-list .source-item {
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
}

.source-list .source-item:hover {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
}
