/* Custom font and base styles */
body, html {
    font-family: 'Inter', 'Helvetica Neue', 'Arial', 'sans-serif';
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent scrolling on the body */
}

/* Custom scrollbar for webkit browsers */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9; /* bg-slate-100 */
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* bg-slate-300 */
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; /* bg-slate-400 */
}

/* Custom scrollbar for sidebar lists (on red background) */
#projects-list::-webkit-scrollbar,
#tools-list::-webkit-scrollbar {
    width: 6px;
}

#projects-list::-webkit-scrollbar-track,
#tools-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1); /* semi-transparent for red background */
    border-radius: 3px;
}

#projects-list::-webkit-scrollbar-thumb,
#tools-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3); /* semi-transparent for red background */
    border-radius: 3px;
}

#projects-list::-webkit-scrollbar-thumb:hover,
#tools-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5); /* darker on hover */
}

/* Selected items in sidebar projects and tools lists */
#projects-list a.font-bold,
#tools-list a.font-bold {
    color: #ffffff; /* white text for selected items */
    font-size: 1.125rem; /* 18px - larger font size (2 sizes up from base) */
    font-weight: 700; /* extra bold */
    /*background: rgba(255, 255, 255, 0.1); !* subtle background highlight *!*/
    /*box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3),*/
    /*            0 2px 4px -1px rgba(0, 0, 0, 0.2),*/
    /*            0 0 0 1px rgba(255, 255, 255, 0.1); !* layered shadow for 3D effect *!*/
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.3); /* text shadow for depth */
    /*transform: translateX(4px); !* slight push out for elevated effect *!*/
    border-radius: 6px; /* rounded corners for modern look */
    padding: 0.625rem 0.75rem; /* slightly more padding */
    transition: all 0.2s ease; /* smooth transition */
}

/*#projects-list a.font-bold:hover,*/
/*#tools-list a.font-bold:hover {*/
/*    background: rgba(255, 255, 255, 0.15); !* slightly brighter on hover *!*/
/*    transform: translateX(6px); !* more elevation on hover *!*/
/*    box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.35),*/
/*                0 3px 5px -1px rgba(0, 0, 0, 0.25),*/
/*                0 0 0 1px rgba(255, 255, 255, 0.15); !* enhanced shadow on hover *!*/
/*}*/

/* Sidebar height management for proper zoom behavior */
#sidebar {
    max-height: 100vh; /* Ensure sidebar never exceeds viewport height */
}

#sidebar-nav {
    overflow-y: auto; /* Allow navigation to scroll if needed */
}

/* Modal backdrop */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.6);
}

/* Toast notification animation */
@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

/* Toast slide in from right animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

/* Chat bubble style */
.chat-bubble {
    max-width: 90%;
}

/* Style for disabled form elements */
input:disabled, textarea:disabled, select:disabled {
    background-color: #f3f4f6; /* bg-gray-100 */
    cursor: not-allowed;
}

/* Styles for markdown rendering in chatbot */
.chatbot-message-content h1, .chatbot-message-content h2, .chatbot-message-content h3 {
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 0.5em;
    margin-bottom: 0.25em;
}

.chatbot-message-content p {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

.chatbot-message-content ul, .chatbot-message-content ol {
    padding-left: 2em;
    margin-bottom: 0.75em;
    margin-top: 0.5em;
}

/* Restore list styles (removed by Tailwind CSS reset) */
.chatbot-message-content ul {
    list-style-type: disc;
}

.chatbot-message-content ol {
    list-style-type: decimal;
}

.chatbot-message-content li {
    margin-bottom: 0.35em;
    line-height: 1.6;
    display: list-item; /* Ensure list-item display */
}

/* Nested lists */
.chatbot-message-content li > ul,
.chatbot-message-content li > ol {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
    padding-left: 2em;
}

/* List item content spacing */
.chatbot-message-content li > p {
    margin-bottom: 0.25em;
}

/* Strong/bold text in lists */
.chatbot-message-content li strong {
    font-weight: 600;
    color: #1f2937;
}

.chatbot-message-content code {
    background-color: #e5e7eb;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    font-family: monospace;
}

.chatbot-message-content pre {
    background-color: #e5e7eb;
    padding: 0.5em;
    border-radius: 4px;
    overflow-x: auto;
}

/* Ensure prose styles apply to markdown table */
.chatbot-message-content table {
    width: 100%;
    border-collapse: collapse;
    min-width: max-content; /* Allow table to expand beyond container */
    table-layout: auto; /* Auto layout for better column width distribution */
}

.chatbot-message-content th, .chatbot-message-content td {
    border: 1px solid #e5e7eb; /* border-gray-200 */
    padding: 0.75rem 1.5rem; /* px-6 py-3 for th, px-6 py-4 for td */
    text-align: left;
    vertical-align: top;
    white-space: normal; /* Allow text wrapping */
    min-width: 120px; /* Minimum column width for readability */
    max-width: 400px; /* Maximum column width to prevent overly wide columns */
}

.chatbot-message-content th {
    background-color: #f9fafb; /* bg-gray-50 */
    font-size: 0.75rem; /* text-xs */
    font-weight: 500; /* font-medium */
    color: #6b7280; /* text-gray-500 */
    text-transform: uppercase;
    letter-spacing: 0.05em; /* tracking-wider */
}

/* Sticky first column in table header */
.chatbot-message-content thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #f9fafb; /* bg-gray-50 */
}

.chatbot-message-content td {
    background-color: #ffffff; /* bg-white */
    font-size: 0.875rem; /* text-sm */
    color: #4b5563; /* text-gray-600 */
}

/* First column in table body should be bold and darker (like renderInformationTable) */
/* Also make it sticky for horizontal scrolling */
.chatbot-message-content tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    font-weight: 500; /* font-medium */
    color: #111827; /* text-gray-900 */
    background-color: #ffffff; /* bg-white - important for sticky */
}

.chatbot-message-content tbody {
    background-color: #ffffff;
}

.chatbot-message-content tbody tr {
    border-bottom: 1px solid #e5e7eb;
}

/* Horizontal scrolling support for tables */
.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #d1d5db #f3f4f6; /* Firefox: thumb track */
}

/* Webkit browsers scrollbar styling */
.overflow-x-auto::-webkit-scrollbar {
    height: 8px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Fullscreen modal style for table */
.table-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: white;
    z-index: 100 !important;
    overflow-y: auto !important;
    padding: 2rem !important;
    border-radius: 0 !important; /* Override rounded-lg */
    margin-bottom: 0 !important; /* Override mb-8 */
}

.table-fullscreen .table-fullscreen-header {
    /* Optional: make header sticky if needed */
}

/* Attachment preview styles */
.attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    max-width: 200px;
}

.attachment-item-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.attachment-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-item-remove {
    flex-shrink: 0;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
}

.attachment-item-remove:hover {
    color: #ef4444;
}

/* Attachment display in messages */
.message-attachments {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    max-width: 180px;
}

.message-attachment-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.message-attachment-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* PDF Export Styles */
.pdf-export-content {
    font-family: 'Inter', 'Helvetica Neue', 'Arial', 'sans-serif';
    line-height: 1.5;
    color: #1f2937;
    font-size: 11px; /* Reduced base font size */
}

.pdf-export-content h1 {
    font-size: 20px; /* Reduced from text-3xl (30px) */
    font-weight: 700;
    margin-bottom: 12px;
    page-break-after: avoid;
}

.pdf-export-content h2 {
    font-size: 16px; /* Reduced from text-2xl (24px) */
    font-weight: 700;
    margin-bottom: 10px;
    margin-top: 16px;
    page-break-after: avoid;
}

.pdf-export-content h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    page-break-after: avoid;
}

.pdf-export-content .page-break {
    page-break-before: always;
    margin-top: 1rem;
}

.pdf-export-content .prose {
    max-width: 100%;
}

.pdf-export-content .prose p {
    margin-bottom: 0.75rem;
    font-size: 11px;
    line-height: 1.5;
}

.pdf-export-content .prose ul,
.pdf-export-content .prose ol {
    margin-left: 1.25rem;
    margin-bottom: 0.75rem;
    font-size: 11px;
}

.pdf-export-content .prose li {
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

.pdf-export-content .prose table {
    table-layout: fixed;
    width: 100%;
}

/* PDF Table Styles - Match project page table styles */
.pdf-export-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 10px; /* Smaller font for tables */
    page-break-inside: auto;
    page-break-before: auto;
}

.pdf-export-content thead {
    display: table-header-group; /* Repeat header on each page */
    page-break-inside: avoid;
    page-break-after: avoid;
}

.pdf-export-content tbody {
    display: table-row-group;
}

.pdf-export-content th,
.pdf-export-content td {
    border: 1px solid #e5e7eb;
    padding: 0.4rem 0.6rem; /* Reduced padding */
    text-align: left;
    vertical-align: top;
    word-wrap: break-word;
    page-break-inside: avoid;
}

.pdf-export-content th {
    background-color: #f9fafb;
    font-size: 9px; /* Even smaller for headers */
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pdf-export-content td {
    background-color: #ffffff;
    font-size: 10px;
    color: #4b5563;
    line-height: 1.4;
}

.pdf-export-content tbody td:first-child {
    font-weight: 600;
    color: #111827;
    background-color: #ffffff;
}

.pdf-export-content tbody tr {
    border-bottom: 1px solid #e5e7eb;
    page-break-inside: avoid;
    page-break-after: auto;
}

/* Avoid breaking inside sections */
.pdf-export-content > div {
    page-break-inside: avoid;
}

/* Allow breaking between sections but not within */
.pdf-export-content > div[style*="page-break-before"] {
    page-break-before: auto;
}

/* Prevent widows and orphans */
.pdf-export-content p,
.pdf-export-content li {
    orphans: 3;
    widows: 3;
}

/* Header spacing */
.pdf-export-content .section-header {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

@media print {
    .page-break {
        page-break-before: always;
    }

    .pdf-export-content {
        font-size: 10pt;
    }

    .pdf-export-content h1 {
        font-size: 18pt;
    }

    .pdf-export-content h2 {
        font-size: 14pt;
    }

    .pdf-export-content table {
        font-size: 9pt;
    }
}

