  /* Base styles for the entire page */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        /* Variables */
        :root {
            --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
            --warning-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
            --card-bg: rgba(255, 255, 255, 0.95);
            --text-primary: #2c3e50;
            --text-secondary: #7f8c8d;
            --border-color: #e9ecef;
        }

        body {
            font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--primary-gradient);
            min-height: 100vh;
            color: var(--text-primary);
            line-height: 1.6;
            display: flex;
            flex-direction: column;
            /* Fixed height for the entire body (page) */
            height: 75vh; /* Set to 75% of viewport height as requested */
            overflow: hidden; /* Hide scrollbar for the body */
        }

        .container {
            max-width: 1600px;
            margin: 0 auto;
            padding: 20px;
            flex-grow: 1; /* Allows container to take available vertical space */
            display: flex;
            flex-direction: column;
            height: 100%; /* Take 100% of parent's (body's) 75vh height */
            overflow: hidden; /* Hide scrollbar for the container */
        }

        .header {
            text-align: center;
            margin-bottom: 20px; /* Reduced margin to save space */
            color: white;
            padding: 15px 0; /* Reduced padding to save space */
            background: transparent; /* Slightly transparent header */
            border-radius: 15px;
            box-shadow: 0 ;
            flex-shrink: 0; /* Prevent header from shrinking */
        }

        .logo {
            font-size: 2.5rem; /* Slightly smaller font size */
            margin-bottom: 5px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .header h1 {
            font-size: 2.2rem; /* Slightly smaller font size */
            margin-bottom: 10px;
            font-weight: 700;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .tagline {
            font-size: 1.1rem; /* Slightly smaller font size */
            opacity: 0.95;
            margin-bottom: 5px;
        }

        .subtitle {
            font-size: 0.85rem; /* Slightly smaller font size */
            opacity: 0.8;
        }

        .main-layout-columns {
            display: flex;
            flex-grow: 1; /* Allows columns to take remaining vertical space */
            gap: 20px; /* Reduced gap to save space */
            margin-bottom: 20px; /* Reduced margin to save space */
            overflow: hidden; /* Hide scrollbar for main columns wrapper */
        }

        .left-column, .right-column {
            display: flex;
            flex-direction: column;
            gap: 20px; /* Reduced gap between cards */
            border-radius: 15px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
            background: transparent; /* Columns themselves are transparent, cards have background */
            padding: 0; /* Padding moved to cards */
            box-sizing: border-box;
            overflow-y: auto; /* Allow internal scrolling for columns */
            /* Hide scrollbar for these columns */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none;  /* IE and Edge */
        }
        .left-column::-webkit-scrollbar, .right-column::-webkit-scrollbar {
            display: none; /* Chrome, Safari */
        }

        .left-column {
            flex: 1;
            min-width: 280px; /* Slightly reduced min-width */
        }

        .right-column {
            flex: 2;
            min-width: 380px; /* Slightly reduced min-width */
        }

        /* Card Styling */
        .card {
            background: var(--card-bg); /* Card background from root variables */
            border-radius: 20px;
            padding: 20px; /* Reduced padding to save space */
            box-shadow: 0 10px 25px rgba(0,0,0,0.1); /* Slightly reduced shadow for compactness */
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255,255,255,0.2);
            display: flex;
            flex-direction: column;
            flex-shrink: 0; /* Default to not growing */
        }

        /* Specific cards that should grow */
        .left-column .card:last-child { /* The Document Library card */
            flex-grow: 1;
        }
        .right-column .qa-section { /* The AI Q&A section */
            flex-grow: 1;
        }


        .card-title {
            font-size: 1.2rem; /* Slightly smaller font size */
            font-weight: 600;
            margin-bottom: 15px; /* Reduced margin */
            color: var(--text-primary);
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced gap */
            flex-shrink: 0;
        }

        /* Department Selector */
        .department-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Adjusted minmax for smaller cards */
            gap: 10px;
            max-height: 150px; /* Further reduced height for departments */
            overflow-y: auto;
            padding-right: 5px;
            /* Hide scrollbar */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none;  /* IE and Edge */
        }
        .department-grid::-webkit-scrollbar {
            display: none; /* Chrome, Safari */
        }

        .department-card {
            background: linear-gradient(135deg, #f8f9ff, #f0f4ff);
            border: 2px solid transparent;
            border-radius: 15px;
            padding: 15px; /* Reduced padding */
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .department-card:hover {
            transform: translateY(-3px); /* Slightly reduced hover effect */
            box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2); /* Slightly reduced shadow */
            border-color: #667eea;
        }

        .department-card.active {
            background: var(--primary-gradient);
            color: white;
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
        }

        .department-icon {
            font-size: 2rem; /* Slightly smaller icon size */
            margin-bottom: 5px;
            opacity: 0.8;
        }

        .department-name {
            font-weight: 600;
            margin-bottom: 3px; /* Reduced margin */
            font-size: 0.95rem; /* Slightly smaller font size */
        }

        .department-desc {
            font-size: 0.75rem; /* Slightly smaller font size */
            opacity: 0.8;
        }

        /* Upload Zone */
        .upload-zone {
            border: 3px dashed #667eea;
            border-radius: 15px;
            padding: 30px 20px; /* Reduced padding */
            text-align: center;
            background: linear-gradient(45deg, #f8f9ff, #f0f4ff);
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            flex-shrink: 0;
        }

        .upload-zone:hover {
            border-color: #764ba2;
            background: linear-gradient(45deg, #f0f4ff, #e8f0ff);
            transform: translateY(-2px);
        }

        .upload-zone.dragover {
            border-color: #4CAF50;
            background: var(--warning-gradient);
            color: white;
        }

        .upload-icon {
            font-size: 3rem; /* Slightly smaller icon size */
            margin-bottom: 15px;
            opacity: 0.8;
        }

        .upload-text {
            font-size: 1.1rem;
            font-weight: 500;
            margin-bottom: 8px;
        }

        .upload-subtext {
            font-size: 0.85rem;
            opacity: 0.7;
            margin-bottom: 15px;
        }

        .file-types {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 10px;
        }

        .file-type {
            background: rgba(102, 126, 234, 0.1);
            padding: 4px 8px; /* Reduced padding */
            border-radius: 20px;
            font-size: 0.75rem; /* Slightly smaller font size */
            color: #667eea;
            font-weight: 500;
        }

        .btn {
            background: var(--primary-gradient);
            color: white;
            border: none;
            padding: 12px 25px; /* Adjusted padding for smaller buttons */
            border-radius: 25px; /* Adjusted border-radius */
            cursor: pointer;
            font-size: 0.95rem; /* Slightly smaller font size */
            font-weight: 500;
            transition: all 0.3s ease;
            margin: 4px; /* Reduced margin */
            position: relative;
            overflow: hidden;
            box-shadow: 0 6px 15px rgba(102, 126, 234, 0.3); /* Pop effect */
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 20px rgba(102, 126, 234, 0.5); /* Enhanced pop effect on hover */
        }

        .btn:active {
            transform: translateY(0);
        }

        .btn-secondary {
            background: var(--secondary-gradient);
            box-shadow: 0 6px 15px rgba(240, 147, 251, 0.3);
        }

        .btn-secondary:hover {
            box-shadow: 0 10px 20px rgba(240, 147, 251, 0.5);
        }

        .btn-success {
            background: var(--success-gradient);
            box-shadow: 0 6px 15px rgba(79, 172, 254, 0.3);
        }

        .btn-success:hover {
            box-shadow: 0 10px 20px rgba(79, 172, 254, 0.5);
        }

        .btn-small {
            padding: 7px 14px;
            font-size: 0.8rem;
        }

        .file-list {
            max-height: 120px; /* Further reduced height for uploaded files list */
            overflow-y: auto;
            margin: 15px 0; /* Reduced margin */
            flex-grow: 1; /* Allows file list to take available space within its card */
            padding-right: 5px;
            /* Hide scrollbar */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none;  /* IE and Edge */
        }
        .file-list::-webkit-scrollbar {
            display: none; /* Chrome, Safari */
        }

        .file-item {
            display: flex;
            align-items: center;
            padding: 10px; /* Reduced padding */
            margin: 8px 0; /* Reduced margin */
            background: #f8f9fa;
            border-radius: 10px; /* Slightly smaller border-radius */
            border-left: 4px solid #667eea; /* Slightly smaller border */
            transition: all 0.3s ease;
            position: relative;
        }

        .file-item:hover {
            background: #e9ecef;
            transform: translateX(3px); /* Slightly reduced hover effect */
            box-shadow: 0 3px 10px rgba(0,0,0,0.08); /* Slightly reduced shadow */
        }

        .file-icon {
            font-size: 1.8rem; /* Slightly smaller icon size */
            margin-right: 10px;
            opacity: 0.8;
        }

        .file-info {
            flex: 1;
        }

        .file-name {
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 3px;
            font-size: 0.9rem; /* Slightly smaller font size */
        }

        .file-meta {
            font-size: 0.75rem; /* Slightly smaller font size */
            color: var(--text-secondary);
            display: flex;
            gap: 10px;
        }

        .file-actions {
            display: flex;
            gap: 6px;
        }

        .qa-section {
            flex-grow: 1; /* Allows Q&A section to take remaining vertical space in right column */
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .search-container {
            display: flex;
            gap: 10px; /* Reduced gap */
            margin-top: 15px; /* Reduced margin */
            align-items: center;
            flex-shrink: 0;
        }

        .search-input {
            flex: 1;
            padding: 12px 18px; /* Reduced padding */
            border: 2px solid var(--border-color);
            border-radius: 25px; /* Adjusted border-radius */
            font-size: 1rem; /* Slightly smaller font size */
            outline: none;
            transition: all 0.3s ease;
            background: white;
        }

        .search-input:focus {
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); /* Slightly reduced shadow */
        }

        /* Answer Section (main chat history container) */
        .answer-section {
            background: linear-gradient(135deg, #f8f9ff, #f0f4ff);
            border-radius: 20px;
            padding: 20px; /* Reduced padding */
            margin-bottom: 15px; /* Reduced margin */
            border-left: 6px solid #667eea;
            flex-grow: 1; /* Allows chat history to take available space */
            overflow-y: auto; /* Enable scrolling for chat history - THIS SCROLLBAR WILL BE VISIBLE */
            padding-right: 5px; /* Add padding for scrollbar */
            display: flex;
            flex-direction: column;
        }

        .chat-history {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            width: 100%;
            /* Removed flex-grow: 1 here to ensure answer-section handles its own scrolling */
        }

        /* AI message: aligned to the left */
        .ai-message {
            align-self: flex-start;
            background-color: #e0e0e0;
            max-width: 70%;
            padding: 10px;
            border-radius: 10px;
            margin: 8px 0; /* Reduced margin */
            word-wrap: break-word; /* Ensure long words break */
            /* Removed max-height and overflow-y from here, as the parent .answer-section handles scrolling */
        }

        /* User message: aligned to the right */
        .user-message {
            align-self: flex-end;
            background-color: #d1e7dd;
            max-width: 70%;
            padding: 10px;
            border-radius: 10px;
            margin: 8px 0; /* Reduced margin */
            word-wrap: break-word; /* Ensure long words break */
            /* Removed max-height and overflow-y from here, as the parent .answer-section handles scrolling */
        }
        .code-block-container {
            position: relative;
            margin-top: 8px;
            margin-bottom: 8px;
            background-color: #2d2d2d;
            border-radius: 5px;
            padding: 8px;
            overflow-x: auto;
        }

        .code-block-container pre {
            margin: 0;
            padding: 0;
            white-space: pre-wrap;
            word-wrap: break-word;
        }

        .code-block-container code {
            display: block;
            color: #f8f8f2;
            font-family: 'Fira Code', 'Cascadia Code', monospace;
            font-size: 0.85em; /* Slightly smaller font size */
        }

        .copy-code-btn {
            position: absolute;
            top: 5px;
            right: 5px;
            background-color: #007bff;
            color: white;
            border: none;
            padding: 4px 8px; /* Reduced padding */
            border-radius: 3px;
            cursor: pointer;
            font-size: 0.75em; /* Slightly smaller font size */
            z-index: 10;
            transition: background-color 0.2s ease;
        }

        .copy-code-btn:hover {
            background-color: #0056b3;
        }

        .copy-code-btn:active {
            background-color: #004085;
        }

        .message-content p {
            margin: 0;
        }

        .message-header {
            font-weight: bold;
            margin-bottom: 4px; /* Reduced margin */
            display: flex;
            align-items: center;
            gap: 4px; /* Reduced gap */
            font-size: 0.95em; /* Slightly smaller font size */
        }

        .message-content {
            line-height: 1.5; /* Slightly reduced line height */
            font-size: 0.9em; /* Slightly smaller font size */
        }
        
        /* Markdown specific styles */
        .message-content ul, .message-content ol {
            margin: 10px 0;
            padding-left: 20px;
        }
        .message-content li {
            margin-bottom: 5px;
        }
        .message-content h1, .message-content h2, .message-content h3, .message-content h4, .message-content h5, .message-content h6 {
            margin-top: 1em;
            margin-bottom: 0.5em;
            font-weight: bold;
            line-height: 1.2;
        }
        .message-content h1 { font-size: 1.5em; }
        .message-content h2 { font-size: 1.4em; }
        .message-content h3 { font-size: 1.3em; }
        .message-content h4 { font-size: 1.2em; }
        .message-content h5 { font-size: 1.1em; }
        .message-content h6 { font-size: 1em; }

        .message-content pre {
            background-color: #2d2d2d;
            color: #f8f8f2;
            padding: 10px;
            border-radius: 5px;
            overflow-x: auto;
            margin: 10px 0;
        }
        .message-content code {
            font-family: 'Fira Code', 'Cascadia Code', monospace;
            font-size: 0.9em;
        }
        .message-content p > code { /* Inline code */
            background-color: rgba(102, 126, 234, 0.1);
            color: #667eea;
            padding: 2px 4px;
            border-radius: 3px;
        }


        .loading {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 80px; /* Reduced height */
        }

        .spinner {
            width: 40px; /* Reduced size */
            height: 40px; /* Reduced size */
            border: 3px solid #f3f3f3; /* Reduced border thickness */
            border-top: 3px solid #667eea; /* Reduced border thickness */
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .progress-bar {
            width: 100%;
            height: 6px; /* Reduced height */
            background: var(--border-color);
            border-radius: 3px; /* Reduced border-radius */
            margin: 10px 0; /* Reduced margin */
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: var(--primary-gradient);
            width: 0%;
            transition: width 0.3s ease;
            border-radius: 3px;
        }

        .status-message {
            padding: 10px 15px; /* Reduced padding */
            border-radius: 8px; /* Reduced border-radius */
            margin: 10px 0; /* Reduced margin */
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced gap */
            font-size: 0.9em; /* Slightly smaller font size */
        }

        .status-success {
            background: linear-gradient(135deg, #d4edda, #c3e6cb);
            color: #155724;
            border: 1px solid #c3e6cb;
        }

        .status-error {
            background: linear-gradient(135deg, #f8d7da, #f5c6cb);
            color: #721c24;
            border: 1px solid #f5c6cb;
        }

        .status-info {
            background: linear-gradient(135deg, #cce7ff, #b8daff);
            color: #004085;
            border: 1px solid #b8daff;
        }

        .resource-library {
            margin-top: 20px; /* Reduced margin */
            flex-grow: 1;
            display: flex;
            flex-direction: column;
        }

        .resource-categories {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Adjusted minmax */
            gap: 15px; /* Reduced gap */
            margin-top: 15px; /* Reduced margin */
            flex-grow: 1;
            overflow-y: auto;
            padding-right: 5px;
            /* Hide scrollbar */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none;  /* IE and Edge */
        }
        .resource-categories::-webkit-scrollbar {
            display: none; /* Chrome, Safari */
        }

        .resource-category {
            background: linear-gradient(135deg, #fff9e6, #fff3cd);
            border-radius: 15px;
            padding: 15px; /* Reduced padding */
            border: 1px solid #ffeaa7;
            transition: all 0.3s ease;
        }

        .resource-category:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 15px rgba(255, 234, 167, 0.3);
        }

        .category-header {
            display: flex;
            align-items: center;
            gap: 8px; /* Reduced gap */
            margin-bottom: 10px; /* Reduced margin */
        }

        .category-icon {
            font-size: 1.5rem; /* Reduced font size */
        }

        .category-title {
            font-weight: 600;
            color: var(--text-primary);
            font-size: 1.05rem; /* Slightly smaller font size */
        }

        .resource-list {
            list-style: none;
        }

        .resource-item {
            padding: 6px 0; /* Reduced padding */
            color: var(--text-secondary);
            cursor: pointer;
            transition: color 0.2s ease;
            font-size: 0.85rem; /* Slightly smaller font size */
        }

        .resource-item:hover {
            color: var(--text-primary);
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjusted minmax */
            gap: 15px; /* Reduced gap */
            margin-bottom: 20px; /* Reduced margin */
            flex-shrink: 0;
        }

        .stat-card {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            padding: 15px; /* Reduced padding */
            border-radius: 15px;
            text-align: center;
        }

        .stat-number {
            font-size: 1.8rem; /* Reduced font size */
            font-weight: 700;
        }

        .stat-label {
            opacity: 0.9;
            margin-top: 3px; /* Reduced margin */
            font-size: 0.85rem; /* Slightly smaller font size */
        }

        @media (max-width: 1024px) {
            .main-layout-columns {
                flex-direction: column;
                overflow-y: auto; /* Allow scrolling for the entire column section */
                /* Hide scrollbar */
                scrollbar-width: none; /* Firefox */
                -ms-overflow-style: none;  /* IE and Edge */
            }
            .main-layout-columns::-webkit-scrollbar {
                display: none; /* Chrome, Safari */
            }

            .left-column, .right-column {
                min-width: unset;
                width: 100%;
                overflow-y: visible; /* Let the parent handle scrolling */
                padding-right: 0;
            }
            .stats-grid {
                grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Adjusted for smaller screens */
            }
        }
        .footer {
            text-align: center;
            padding: 1rem; /* Reduced padding */
            background: transparent;
            flex-shrink: 0;
            font-size: 0.8rem; /* Slightly smaller font size */
            color: rgba(255, 255, 255, 0.8); /* Lighter color for footer text */
        }

        @media (max-width: 768px) {
            .container {
                padding: 10px;
            }
            .header h1 {
                font-size: 1.8rem;
            }
            .tagline {
                font-size: 0.9rem;
            }
            .card {
                padding: 15px;
            }
            .card-title {
                font-size: 1.05rem;
            }
            .department-grid {
                grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); /* Further adjusted for very small screens */
                max-height: 120px; /* Further reduced height */
            }
            .file-list, .resource-categories {
                max-height: 80px; /* Further reduced height */
            }
            .search-container {
                flex-direction: column;
            }
            .search-input, .btn {
                width: 100%;
                margin: 4px 0;
            }
        }

        @media (max-width: 480px) {
            .header h1 {
                font-size: 1.5rem;
            }
            .department-grid {
                grid-template-columns: 1fr;
            }
            .stats-grid {
                grid-template-columns: 1fr;
            }
        }
