/* =============================================================================
 * Global Styles - RAG Chatbot System
 * =============================================================================
 * Shared styles for both user chat and admin dashboard.
 * Uses Bootstrap 5.3 via CDN as the base framework.
 * ============================================================================= */

/* ---------------------------------------------------------------------------
   CSS Variables (Theme)
   --------------------------------------------------------------------------- */
:root {
    --sidebar-bg: #1e1e2e;
    --sidebar-hover: #313145;
    --chat-bg: #f8f9fa;
    --bubble-user: #0d6efd;
    --bubble-user-text: #ffffff;
    --bubble-bot: #f1f3f5;
    --bubble-bot-text: #212529;
    --code-bg: #1e1e1e;
    --code-text: #e0e0e0;
    --toast-success: #198754;
    --toast-error: #dc3545;
    --toast-warning: #ffc107;
    --navbar-bg: #212529;
    --card-hover-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    --transition-speed: 0.2s;
}

/* ---------------------------------------------------------------------------
   Typography
   --------------------------------------------------------------------------- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    font-size: 15px;
    line-height: 1.6;
}

pre, code {
    font-family: "Fira Code", "Consolas", "Monaco", monospace;
}

/* ---------------------------------------------------------------------------
   Navbar
   --------------------------------------------------------------------------- */
.navbar-dark {
    background-color: var(--navbar-bg) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ---------------------------------------------------------------------------
   Toast Notifications
   --------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1060;
}

.toast-custom {
    border-left: 4px solid;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-custom.success {
    border-left-color: var(--toast-success);
}

.toast-custom.error {
    border-left-color: var(--toast-error);
}

.toast-custom.warning {
    border-left-color: var(--toast-warning);
}

/* ---------------------------------------------------------------------------
   Loading Spinner
   --------------------------------------------------------------------------- */
.spinner-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6c757d;
}

.spinner-overlay .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
}

/* ---------------------------------------------------------------------------
   Skeleton Loading
   --------------------------------------------------------------------------- */
.skeleton {
    background: linear-gradient(90deg, #e9ecef 25%, #dee2e6 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
    height: 1rem;
    margin-bottom: 0.5rem;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-row {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
}

.skeleton-cell {
    background: linear-gradient(90deg, #e9ecef 25%, #dee2e6 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    height: 1rem;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.btn-primary {
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.4);
    transform: translateY(-1px);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* ---------------------------------------------------------------------------
   Form Controls
   --------------------------------------------------------------------------- */
.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* ---------------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------------- */
.card {
    border-radius: 10px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow var(--transition-speed);
}

.card:hover {
    box-shadow: var(--card-hover-shadow);
}

/* ---------------------------------------------------------------------------
   Modal
   --------------------------------------------------------------------------- */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

/* ---------------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------------- */
.badge {
    font-weight: 500;
    padding: 0.35em 0.6em;
    border-radius: 5px;
}

/* ---------------------------------------------------------------------------
   Scrollbar Styling (Webkit)
   --------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ---------------------------------------------------------------------------
   Utility Classes
   --------------------------------------------------------------------------- */
.cursor-pointer {
    cursor: pointer;
}

.text-muted-light {
    color: #adb5bd !important;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    body {
        font-size: 14px;
    }

    .card {
        border-radius: 8px;
    }

    .modal-content {
        border-radius: 10px;
    }
}