
        /* Prefix all selectors with the wrapper ID */
        #library-content-wrapper {
            padding: 20px; /* Apply padding to the wrapper */
            height: 100%; /* Allow content to scroll if needed */
            overflow-y: auto;
        }
        #library-content-wrapper body { /* This will likely have no effect as it's inside #chat_content, but keep for structure */
            font-family: sans-serif;
             /* Remove margin/background from body style, apply to wrapper */
        }
        #library-content-wrapper h1 {
            text-align: center;
            color: var(--text-100); /* Use CSS variables if available */
            margin-bottom: 20px;
        }
        #library-content-wrapper .image-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Slightly smaller min size */
            gap: 15px; /* Spacing between images */
            /* Remove padding/background from grid, applied to wrapper */
            border-radius: 8px;
            /* Remove box-shadow from grid if desired */
            padding: 10px;
        }
        #library-content-wrapper .image-grid img {
            width: 100%;
            height: auto; /* Maintain aspect ratio */
            aspect-ratio: 1 / 1; /* Force square aspect ratio */
            object-fit: cover; /* Ensure image covers the square */
            border-radius: 4px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            cursor: pointer; /* Indicate clickable */
            transition: transform 0.2s ease-in-out;
            border: 1px solid var(--border-100); /* Add subtle border */
        }
        #library-content-wrapper .image-grid img:hover {
             transform: scale(1.03); /* Slight zoom on hover */
             opacity: 0.9;
        }
        #library-content-wrapper .no-images {
            text-align: center;
            padding: 50px;
            color: var(--text-300); /* Use CSS variable */
            grid-column: 1 / -1; /* Make it span all columns if grid is empty */
        }
         /* Basic Modal Styles (These are likely fine as they are positioned fixed/absolute) */
         /* You might want to scope them too just in case, but less critical */
        #library-content-wrapper .modal { /* Scoped just in case */
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: var(--bg-100);
        }
        #library-content-wrapper .modal-content { /* Scoped */
            margin: auto;
            display: block;
            width: auto;
            max-height: 80%;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            border-radius: 8px;
        }
        #library-content-wrapper .close-modal { /* Scoped */
            position: absolute;
            top: 15px;
            right: 35px;
            color: inherit !important;
            font-size: 40px;
            font-weight: bold;
            transition: 0.3s;
            cursor: pointer;
            z-index: 1001; /* Ensure it's above the image */
        }
        #library-content-wrapper .close-modal:hover,
        #library-content-wrapper .close-modal:focus { /* Scoped */
            color: #bbb;
            text-decoration: none;
        }

        /* Library Modal Styles */
        .library-modal-overlay {
            position: fixed;
            z-index: 1050; /* Ensure it's above most other content */
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: hidden; /* Prevent body scroll */
            background-color: rgba(0, 0, 0, 0.6); /* Dim background */
            display: flex; /* For centering */
            align-items: center;
            justify-content: center;
        }

        .library-modal-content {
            background-color: var(--bg-100); /* Use your theme variable */
            color: var(--text-100);
            margin: auto;
            padding: 20px;
            border: 1px solid var(--border-100);
            width: 80%;
            max-width: 900px; /* Adjust max width as needed */
            height: 80%;
            max-height: 700px; /* Adjust max height */
            border-radius: 8px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            position: relative;
            display: flex;
            flex-direction: column;
        }

        .library-modal-close {
            color: var(--text-200);
            position: absolute;
            top: 10px;
            right: 20px;
            font-size: 28px;
            font-weight: bold;
            cursor: pointer;
            line-height: 1;
        }

        .library-modal-close:hover,
        .library-modal-close:focus {
            color: var(--text-100);
            text-decoration: none;
        }

        #libraryModalBody {
            overflow-y: auto; /* Allow scrolling within the modal body */
            height: 100%; /* Take remaining height */
        }

         /* Styles for content inside the library modal body */
         #libraryModalBody h1 {
            text-align: center;
            margin-bottom: 20px;
            font-size: 1.5em;
            color: var(--text-100);
         }

        #libraryModalBody .image-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 15px;
            padding-top: 10px;
            padding: 10px;
        }

        #libraryModalBody .image-grid img {
            width: 100%;
            height: auto;
            aspect-ratio: 1 / 1;
            object-fit: cover;
            border-radius: 18px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            cursor: pointer;
            transition: transform 0.15s ease-in-out !important;
            border: 1px solid var(--border-100);
        }

        #libraryModalBody .image-grid img:hover {
            transform: scale(1.03); /* Ensure this scale effect is present */
            /* opacity: 0.9; */
        }

        #libraryModalBody .no-images {
            text-align: center;
            padding: 20px;
            color: var(--text-300);
            grid-column: 1 / -1; /* Span all columns */
            font-style: italic;
        }

        /* Feedback Modal */
        #feedbackModal,
        #reportAgentModal {
            position: fixed;
            inset: 0;
            z-index: 1070;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 18px;
            background: rgba(0, 0, 0, 0.62);
            backdrop-filter: blur(6px);
            -webkit-backdrop-filter: blur(6px);
        }

        .feedback-modal-content {
            width: min(100%, 520px);
            background: var(--bg-100);
            color: var(--text-100);
            border: 1px solid var(--border-100);
            border-radius: 18px;
            box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
            padding: 22px;
            position: relative;
        }

        .feedback-modal-close {
            position: absolute;
            top: 13px;
            right: 17px;
            color: var(--text-300);
            cursor: pointer;
            font-size: 26px;
            line-height: 1;
        }

        .feedback-modal-close:hover {
            color: var(--text-100);
        }

        .feedback-modal-content h2 {
            margin: 0 34px 8px 0;
            font-size: 20px;
            color: var(--text-100);
        }

        .feedback-modal-content p {
            margin: 0 0 16px;
            color: var(--text-300);
            font-size: 14px;
            line-height: 1.45;
        }

        .feedback-field {
            margin-bottom: 12px;
        }

        .feedback-field label {
            display: block;
            margin-bottom: 6px;
            color: var(--text-200);
            font-size: 13px;
            font-weight: 600;
        }

        .feedback-field input,
        .feedback-field textarea {
            width: 100%;
            box-sizing: border-box;
            border: 1px solid var(--border-200);
            background: var(--bg-200);
            color: var(--text-100);
            border-radius: 12px;
            padding: 11px 12px;
            outline: none;
            font-size: 14px;
        }

        .feedback-field textarea {
            min-height: 130px;
            resize: vertical;
        }

        .feedback-field input:focus,
        .feedback-field textarea:focus {
            border-color: #1abc9c;
        }

        #feedbackSubmitBtn,
        #reportAgentSubmitBtn {
            width: 100%;
            border: 0;
            border-radius: 999px;
            padding: 11px 16px;
            background: #1abc9c;
            color: #fff;
            font-weight: 700;
            cursor: pointer;
        }

        #feedbackSubmitBtn:disabled,
        #reportAgentSubmitBtn:disabled {
            opacity: 0.65;
            cursor: not-allowed;
        }

        #feedbackStatus,
        #reportAgentStatus {
            min-height: 18px;
            margin-top: 10px;
            font-size: 13px;
            color: var(--text-300);
        }

         /* Image Viewer Modal Styles (can be kept separate) */
        #imageModal {
            display: none;
            position: fixed;
            z-index: 1060; /* Higher than library modal */
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            /* background-color: rgba(0,0,0,0.85); */ /* Remove old background */
            background-color: var(--bg-100); /* Use theme background */
            align-items: center; /* Vertical center (Added for flex) */
            justify-content: center; /* Horizontal center (Added for flex) */
        }
        .image-viewer-content {
            margin: auto;
            display: block;
            /* Remove fixed width/height */
            /* width: auto; */
            /* height: auto; */
            max-width: 90%; /* Limit size relative to viewport */
            max-height: 90%;
            position: absolute; /* Keep positioning */
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            border-radius: 5px;
        }
        .image-viewer-close {
            position: absolute;
            top: 15px;
            right: 35px;
            /* color: #f1f1f1; */ /* Remove fixed color */
            color: var(--text-100); /* Use theme text color */
            font-size: 40px;
            font-weight: bold;
            transition: 0.3s;
            cursor: pointer;
            z-index: 1061;
        }
        .image-viewer-close:hover,
        .image-viewer-close:focus {
            /* color: #bbb; */ /* Remove fixed color */
            color: var(--text-300); /* Use dimmer theme text color on hover */
            text-decoration: none;
            cursor: pointer;
        }

        /* Style for the Image Viewer Title */
        .image-viewer-title {
            position: absolute;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            /* color: #f1f1f1; */ /* Remove fixed color */
            color: var(--text-100); /* Use theme text color */
            font-size: 16px !important;
            font-weight: bold;
            z-index: 1061; /* Same as close button */
            text-align: center;
            width: 80%; /* Prevent overlapping buttons on narrow screens */
        }

        /* New: Style for the Image Viewer Date */
        #imageViewerDate {
            position: absolute;
            top: 40px; /* Position below the title */
            left: 50%;
            transform: translateX(-50%);
            color: var(--text-200); /* Use theme text color (slightly dimmer?) */
            font-size: 14px;
            z-index: 1061;
            text-align: center;
            width: 80%;
            margin: 0;
            padding: 0;
        }

        /* Slideshow Navigation Buttons - Corrected Selectors */
        #slideshowPrev,
        #slideshowNext {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 40px; /* Adjust size */
            height: 40px;
            /* background-color: rgba(0, 0, 0, 0.4); */ /* Consider theme variable? */
            background-color: var(--bg-300); /* Example using theme bg */
            /* color: #fff; */ /* Remove fixed color */
            color: var(--text-100); /* Use theme text color */
            border: none;
            border-radius: 50%;
            font-size: 24px;
            line-height: 20px; /* Center icon vertically */
            text-align: center;
            cursor: pointer;
            transition: background-color 0.2s ease;
            z-index: 1062; /* Above image, below close */
            opacity: 0.7;
            user-select: none; /* Prevent text selection */
            display: none; /* Initially hidden, shown via JS */
        }

        #slideshowPrev:hover,
        #slideshowNext:hover {
            /* background-color: rgba(0, 0, 0, 0.7); */ /* Consider theme variable? */
            background-color: var(--bg-400); /* Example using theme bg */
            opacity: 1;
        }

        #slideshowPrev {
            left: 20px; /* Position left */
        }

        #slideshowNext {
            right: 20px; /* Position right */
        }

        #slideshowPrev:disabled,
        #slideshowNext:disabled {
            opacity: 0.3;
            cursor: default;
        }

        /* Styles for the main image wrapper inside modal */
        .modal-main-content {
            width: 100%; /* Take full width */
            height: calc(100% - 100px); /* Adjust height to leave space for thumbnails (e.g., 100px) */
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden; /* Hide overflow if needed */
            position: relative; /* Needed if you plan absolute positioning inside */
        }

        /* Styles for Thumbnail Container */
        .thumbnail-container {
            position: absolute;
            bottom: 10px; /* Position at the bottom */
            left: 10%;  /* Center it roughly */
            right: 10%;
            width: 80%;
            height: 80px; /* Fixed height for the container */
            overflow-x: auto; /* Enable horizontal scrolling */
            overflow-y: hidden;
            white-space: nowrap; /* Keep images in a single line */
            background-color: rgba(0, 0, 0, 0.3); /* Slight background */
            padding: 5px 0;
            text-align: center; /* Center thumbnails if they don't fill width */
            z-index: 1063; /* Above modal bg, below close/nav */
        }

        /* Styles for Individual Thumbnails */
        .thumbnail-container img {
            height: 70px; /* Height of thumbnails */
            width: auto;  /* Let width adjust based on aspect ratio */
            margin: 0 4px; /* Spacing between thumbnails */
            border: 2px solid transparent; /* Default border */
            border-radius: 3px;
            cursor: pointer;
            opacity: 0.6;
            transition: opacity 0.2s ease, border-color 0.2s ease;
            display: inline-block; /* Needed with white-space: nowrap */
            vertical-align: middle;
        }

        .thumbnail-container img:hover {
            opacity: 1;
        }

        .thumbnail-container img.active {
            opacity: 1;
            border-color: #fff; /* Highlight active thumbnail */
        }