@font-face {
    font-family: 'CustomFont';
    src: url('../font/font.ttf') format('truetype-variations');
    font-weight: 100 900; /* Allows full range of weights */
    font-style: normal;
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'CustomFont', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    font-family: 'CustomFont', sans-serif;
}

.demoarea {
    height: auto;
    width: 100%;
    padding-bottom: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.viewer-container {
    display: none;
    width: 90%;
    flex-grow: 1;
    position: relative;
    margin: 10px auto;
    flex-direction: column;
}

.viewer-container.active {
    display: flex;
    height: 98vh;
}

.sample-name {
    display: none;
    background: #13294B;
    color: white;
    padding: 12px 24x;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
    border-bottom: 3px solid #FF5F05;
}

.sample-name.active {
    display: block;
}

.viewer {
    display: flex;
    width: 100%;
    border: 1px solid #ccc;
    flex-grow: 1;
    position: relative;
}

.viewer.active {
    display: flex;
}

.viewer-container.active ~ .site-header,
body:has(.viewer-container.active) .site-header {
    position: relative;
}

.homepage {
    width: 90%;
    max-width: 1400px;
    flex-grow: 1;
    padding: 20px;
    padding-top: 45px; 
    overflow-y: auto;
    display: none;
}

.content {
    display: flex;
    width: 90%;
    flex-grow: 1;
    margin: 10px auto;
}

.homepage.active {
    display: block;
}

.homepage-header {
    text-align: center;
    margin-bottom: 40px;
}

.homepage-title {
    font-size: 2.5rem;
    color: #13294B;
    margin-bottom: 10px;
    font-weight: 600;
}

.homepage-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease-in;
}

.homepage-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.loading-circle {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.homepage-image-item {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e0e0e0;
    will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
    .homepage-image-item:hover {
        transform: translateY(-4px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        border-color: #007acc;
    }
}

.homepage-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #f5f5f5;
}

.homepage-image-info {
    padding: 16px;
}

.homepage-image-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    word-break: break-word;
}

.homepage-image-resolution, .homepage-image-model, .homepage-mm {
    font-size: 0.9rem;
    color: #666;
}

.homepage-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    font-size: 1.1rem;
}
.homepage-thumbnail-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #f8f9fa 25%, #e9ecef 25%, #e9ecef 50%, #f8f9fa 50%, #f8f9fa 75%, #e9ecef 75%);
    background-size: 28px 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 2rem;
    animation: pulse 2s infinite;
}

.homepage-thumbnail-placeholder::before {
    content: '📷';
}

.image-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    z-index: 10;
}

.homepage-image-item {
    position: relative; /* Add this to your existing class */
}

.homepage-thumbnail-error {
    width: 100%;
    height: 200px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    border: 2px dashed #ccc;
    font-size: 14px;
}

.sidebar-pagination-bottom {
    margin-top: auto;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.pagination-btn.page-number.active {
    background-color: #007bff;
    color: white;
}

.pagination-ellipsis {
    padding: 8px 12px;
    color: #666;
}

.pagination-btn.page-number {
    min-width: 40px;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Pagination Controls Styling */
.pagination-controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pagination-controls.sidebar-pagination {
    margin: 8px 0;
    padding: 12px;
    background: rgba(240, 240, 240, 0.9);
}

.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-info span {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.images-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
}

.images-per-page label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.images-per-page select,
.page-select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.images-per-page select:hover,
.page-select:hover {
    border-color: #007acc;
}

.images-per-page select:focus,
.page-select:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #007acc;
    color: #007acc;
}

.pagination-btn:active:not(:disabled) {
    background: #e6f3ff;
}

.pagination-btn:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #666;
    margin: 0 8px;
}

.page-select {
    min-width: 50px;
    text-align: center;
}

/* Sidebar specific pagination styling */
.sidebar-pagination .pagination-info {
    font-size: 12px;
}

.sidebar-pagination .pagination-btn {
    padding: 6px 8px;
    font-size: 12px;
    min-width: 45px;
}

.sidebar-pagination .images-per-page label,
.sidebar-pagination .page-info {
    font-size: 12px;
}

.sidebar-pagination .images-per-page select,
.sidebar-pagination .page-select {
    font-size: 12px;
    padding: 2px 6px;
}

/* Enhanced grid layout for different page sizes */
.image-grid {
    display: grid;
    gap: 16px;
    padding: 16px 0;
}

/* Dynamic grid columns based on images per page */
.image-grid[data-per-page="6"] {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.image-grid[data-per-page="12"] {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.image-grid[data-per-page="24"] {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.image-grid[data-per-page="48"] {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px 8px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    min-height: 60px;
    height: auto;
}

.tools {
    display: flex;
    margin-left: auto; /* Push to the right */
    gap: 4px;
    flex-wrap: wrap;
    flex-shrink: 0; /* Prevent tools from shrinking */
}

.toolbar select {
    margin-left: 4px;
    padding: 4px 8px;
    min-width: 120px; /* Reduced for mobile */
    max-width: 100%;
    flex-shrink: 1; /* Allow select to shrink if needed */
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
}

/* OpenSeadragon optimizations */
.openseadragon-canvas {
    outline: none;
    width: 100% ;
    height: 100% ;
    z-index: 0;
}

.openseadragon-container {
    background: #f8f8f8 ;
}

/* Simplified Annotorious styles */
.a9s-annotationlayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.a9s-annotation {
    pointer-events: all;
}

.a9s-annotation .a9s-inner .a9s-annotation[data-shape-type="freehand"] path{
    fill: transparent ;
}

.a9s-handle {
    fill: #000000 ;
}

.custom-annotation .a9s-inner,
        .custom-annotation path,
        .custom-annotation rect,
        .custom-annotation polygon {
    stroke: #000000;
    stroke-width: 4px;
    fill: transparent ;
}

/* Logo styles */
.logo {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.logo-and-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.block-i {
    height: 42px;
    width: auto;
    transition: all 0.2s ease;
}

.block-i__fill {
    fill: #FF5F05; /* UIUC orange */
    transition: fill 0.2s ease;
}

.block-i:hover .block-i__fill {
    fill: #13294B;  /* UIUC blue */
}

.block-i__outline {
    fill: #13294B; /* UIUC blue */
}

.header-separator {
    align-self: stretch; /* Makes the separator fill the height */
    width: 1px;
    background-color: #666;
    margin: 0 8px; /* Reduced from 16px */
}

.unit-wordmark {
    text-decoration: none;
    color: #13294B; /* UIUC blue */
    font-size: 1.4rem;
    font-family: 'CustomFont', sans-serif;
    font-weight: 600;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.unit-wordmark:hover {
    color: #FF5F05; /* UIUC orange */
    text-decoration: none;
}

/* University wordmark styles */
.university-wordmark-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 32px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.university-wordmark-link {
    display: inline-block;
    text-decoration: none;
    padding-top: 10px;
    padding-left: 32px;
}

.university-wordmark svg {
    height: 20px;
}

.university-wordmark path {
    fill: #13294B; /* UIUC blue */
    transition: fill 0.2s ease;
}

.university-wordmark-link:hover .university-wordmark path {
    fill: #FF5F05; /* UIUC orange */
}

.tools {
    display: flex;
    flex-direction: row;
}

#viewerSearch {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    width: 200px; /* Adjusted for better visibility */
    transition: border-color 0.2s ease;
}

/* Home Button - Right Side of Header */
#homeButton, #dbButton, #button {
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    margin-left: auto;
    flex-shrink: 0;
}

#homeButton:hover, #dbButton:hover, #button:hover{
    background-color: rgba(0, 0, 0, 0.1);
}

.icon {
    font-size: 20px;
    line-height: 1;
}

/* Floating controls - positioned at bottom center */
.floating-controls {
    position: absolute;
    top: 50%;
    right:15px;
    transform: translateY(-50%);
    z-index: 6;
    pointer-events: none;
}

.floating-control-group {
    display: flex;
    flex-direction: column;;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 25px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    pointer-events: all;
}

.floating-tools-divider {
    width: 24px;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    margin: 4px 0;
}

.floating-btn,
.floating-color-control,
.floating-width-control {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.floating-color-control::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--current-color, #000000);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.floating-btn:hover,
.floating-color-control:hover,
.floating-width-control:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.2);
}

.floating-color-control.expanded {
    width: 200px;
    z-index: 7;
    position: relative;
}

.floating-width-control.expanded {
    width: 150px;
    background: rgba(255, 255, 255, 0.25);
}

.floating-color-grid {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: row;
    gap: 6px;
    background: rgba(0, 0, 0, 0.9);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 100%;
    height: 100%;
    align-items: center;
    z-index: 5;
    pointer-events: auto;
}

.floating-color-control.expanded .floating-color-grid {
    display: flex;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    pointer-events: auto;
    z-index: 3;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.color-option.plus-button {
    font-size: 18px;
    width: 32px;
    height: 32px;
    z-index: 7;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: bold;
    line-height: 1;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-option.current-color {
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.3);
}

.plus-button {
    background: #f0f0f0;
    color: #666;
    border: 2px dashed #ccc;
}

.plus-button:hover {
    background: #e0e0e0;
    color: #333;
    border-color: #999;
}

/* Critical CSS for inline color picker positioning */
.inline-color-picker {
    position: absolute;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    
    /* Hide the default color picker styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: none;
    padding: 0;
    margin: 0;
    
    /* Ensure it starts hidden and positioned */
    display: none !important;
    top: 0;
    left: 0;
}

/* When the picker is active/visible */
.inline-color-picker.active {
    display: block !important;
    opacity: 0.01;
    pointer-events: auto;
}

/* For WebKit browsers (Chrome, Safari) - style the color picker */
.inline-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 6px;
}

.inline-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

/* For Firefox */
.inline-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 6px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.floating-width-slider {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.floating-width-control.expanded .floating-width-slider {
    display: block;
}

.floating-width-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.floating-width-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.floating-width-value {
    color: white;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 6;
    background: white;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    will-change: auto;
    transition: position 0.3s ease;
}

.site-footer {
    background: #13294B;
    color: white;
    padding: 24px 0;
    margin-top: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-contact {
    flex: 1;
}

.footer-contact a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

.footer-contact a:hover {
    text-decoration: underline;
}

.footer-links ul {
    list-style: none;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a, .footer-links button {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover, .footer-links button:hover {
    color: white;
}

.footer-links button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.header-strip {
    background-color: #FF5F05; /* UIUC orange */
    order:-3;
    height: 7px;
    width: 100%;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.sidebar-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    width: 20px;
    height: 16px;
    justify-content: space-between;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #333;
    transition: all 0.3s ease;
}

.sidebar-toggle.active .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.sidebar-toggle.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.sidebar-toggle.active .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Sidebar */
.image-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 350px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    z-index: 11;
    transform: translateX(-350px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.image-sidebar.open {
    transform: translateX(0);
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px; /* optional fixed height */
  border-bottom: 1px solid #eee; /* optional divider */
}

.sidebar-header h3 {
    padding: 20px 20px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.sidebar-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.image-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.image-item:hover {
    border-color: #007acc;
    box-shadow: 0 2px 8px rgba(0, 122, 204, 0.1);
    transform: translateY(-1px);
}

.image-item.selected {
    border-color: #007acc;
    background-color: #f0f8ff;
}

.image-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
}

.image-info {
    flex: 1;
    min-width: 0;
}

.image-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    font-size: 14px;
    word-break: break-word;
}

.image-resolution, .image-model, .image-mm {
    font-size: 12px;
    color: #666;
}

.image-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

.image-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #d32f2f;
    font-size: 14px;
    text-align: center;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}



/* Scale Bar Styles */
/* Scale Bar Styles */
#scaleBarContainer {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    user-select: none;
}

.scale-bar {
    height: 2px;
    background: #000;
    margin: 2px 0;
}

.scale-label {
    font-size: 12px;
    color: #000;
    font-family: monospace;
    line-height: 1;
}

.viewer-container.active ~ .site-header .sidebar-toggle,
body:has(.viewer-container.active) .site-header .sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.viewer-container.active ~ .site-header .home-button,
body:has(.viewer-container.active) .site-header .home-button {
    position: fixed;
    top: 20px;
    right: 20px;
}


.viewer-container.active ~ .site-header .db-button,
body:has(.viewer-container.active) .site-header .db-button {
    position: fixed;
    top: 60px;
    right: 20px;
}

.viewer-container.active ~ .site-header .home-button #homeButton,
body:has(.viewer-container.active) .site-header .home-button #homeButton, .viewer-container.active ~ .site-header .db-button #dbButton,
body:has(.viewer-container.active) .site-header .db-button #dbButton  {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* QR Page Specific Styles */



#homepage.content {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Error alert styling */
.alert {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.3s ease-out;
}

.alert strong {
    color: #dc2626;
    font-weight: 600;
    font-size: 14px;
}

.alert .close {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.alert .close:hover {
    background-color: rgba(220, 38, 38, 0.1);
}

/* Page title */
h2 {
    color: #13294B;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Form styling */
form {
    margin-top: 32px;
}

.form-group {
    margin-bottom: 32px;
}

/* Form labels */
h4 {
    color: #374151;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    display: block;
}

/* Input styling */
.form-control {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Input validation states */
.form-control:invalid {
    border-color: #ef4444;
}

.form-control:valid {
    border-color: #10b981;
}


@media screen and (max-width: 768px) {
    
    #homepage.content {
        margin: 0 10px;
        padding: 24px 16px;
        border-radius: 12px;
    }
    
    .viewer-container.active ~ .site-header .sidebar-toggle,
    body:has(.viewer-container.active) .site-header .sidebar-toggle {
        top: 15px;
        left: 15px;
    }
    
    .viewer-container.active ~ .site-header .home-button,
    .viewer-container.active ~ .site-header .db-button,
    body:has(.viewer-container.active) .site-header .home-button,
    body:has(.viewer-container.active) .site-header .db-button {
        top: 15px;
        right: 15px;
    }
    
    .viewer-container.active ~ .site-header .db-button,
    body:has(.viewer-container.active) .site-header .db-button {
        top: 55px;
    }
    
    #scaleBarContainer {
        bottom: 80px; /* Move above floating controls */
        left: 10px;
        padding: 6px 10px;
    }
    
    .scale-label {
        font-size: 10px;
    }
    
    .tools{
        margin-right: auto;
    }
    
    .floating-controls {
        position: fixed;
        top: auto;
        right: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 4;
        pointer-events: none;
    }

    .floating-control-group {
        display: flex;
        flex-direction: row;;
        align-items: center;
        background: rgba(0, 0, 0, 0.8);
        border-radius: 25px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        pointer-events: all;
        padding: 6px 10px;
        gap: 6px;
    }

    .floating-tools-divider {
        width: 1px;
        height: 24px;
        background: rgba(255, 255, 255, 0.3);
        margin: 0 4px;
    }
    
    .floating-btn,
    .floating-color-control,
    .floating-width-control {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .floating-btn:hover,
    .floating-color-control:hover,
    .floating-width-control:hover {
        transform: none;
    }

    .floating-color-control.expanded {
        width: 200px;
        z-index: 7; /* Higher than color grid */
        position: relative;
    }

    .floating-width-control.expanded {
        width: 150px;
        /* Add semi-transparent background for better slider visibility */
        background: rgba(255, 255, 255, 0.25);
    }

    .floating-color-control.expanded .floating-color-grid {
        display: flex;
    }

    .color-option {
        width: 32px;
        height: 32px;
        z-index: 6 ;
    }

    /* Enhanced width slider visibility on mobile */
    .floating-width-slider {
        position: absolute;
        bottom: 50px;
        left: 50%;
        transform: translateX(-50%);
        display: none;
        width: 120px;
        height: 8px; /* Slightly thicker for mobile */
        background: rgba(255, 255, 255, 0.4) ; /* More opaque background */
        border-radius: 4px;
        outline: none;
        -webkit-appearance: none;
        appearance: none;
        border: 1px solid rgba(255, 255, 255, 0.6); /* Add border for better visibility */
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); /* Add shadow */
    }

    .floating-width-control.expanded .floating-width-slider {
        display: block;
    }

    .floating-width-slider::-webkit-slider-thumb {
        appearance: none;
        width: 20px; /* Larger thumb for mobile */
        height: 20px;
        background: white;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
        border: 2px solid rgba(0, 0, 0, 0.1); /* Add border to thumb */
    }

    .floating-width-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
        background: white;
        border-radius: 50%;
        cursor: pointer;
        border: 2px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }

    /* Additional mobile touch improvements */
    .floating-color-control,
    .floating-width-control,
    .color-option,
    .floating-btn {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    /* Improve visibility of width value text */
    .floating-width-value {
        color: white;
        font-size: 12px;
        font-weight: bold;
        white-space: nowrap;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* Add text shadow for better visibility */
    }

    .university-wordmark {
        display: none; /* Hide on mobile */
    }
    .toolbar {
        min-height: auto;
        padding: 12px 20px;
    }

    .logo {
        flex-shrink: 1;
        min-height: 50px;
    }

    .unit-wordmark {
        font-size: 1.2rem;
    }
    
    .sample-name {
        font-size: 1.1rem;
        padding: 12px 16px;
    }
    
    .image-sidebar {
        width: 300px;
        transform: translateX(-300px);
        box-shadow: 1px 0 3px rgba(0, 0, 0, 0.05);
    }
    
    .image-sidebar.open {
        transform: translateX(0);
    }
    
    .site-header {
        box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    }
    
    .image-thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .sidebar-content {
        padding: 15px;
    }
    
    .image-item {
        padding: 10px;
    }
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }

    .homepage-image-thumbnail {
        height: 150px;
    }

    .homepage-title {
        font-size: 2rem;
    }

    .homepage-subtitle {
        font-size: 1rem;   
    }
    .homepage-image-item {
        transition: none;
    }
    .image-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
        gap: 12px;
    }
    .pagination-controls {
        padding: 12px;
    }
    
    .pagination-info {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .pagination-info > span {
        text-align: center;
    }
    
    .images-per-page {
        justify-content: center;
    }
    
    .pagination-nav {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .pagination-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 50px;
    }
    
    .page-info {
        margin: 4px 0;
        justify-content: center;
        width: 100%;
    }
}


@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
    }
    .image-sidebar {
        width: 280px;
        transform: translateX(-280px);
    }
    
    .image-sidebar.open {
        transform: translateX(0);
    }
    .pagination-nav {
        gap: 8px;
    }
    
    .pagination-nav > div:first-child {
        display: flex;
        gap: 4px;
    }
    
    .page-info {
        order: -1;
    }
}

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.no-results-message {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 1rem;
}

.clear-search-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.clear-search-btn:hover {
    background: #0056b3;
}

/* Save Options Dialog */
.save-options-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.save-options-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    min-width: 250px;
}

.save-options-content button {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: none;
    border-radius: 4px;
    background: #007acc;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.save-options-content button:hover {
    background: #0062a3;
}

.save-options-content button.cancel {
    background: #666;
}

.save-options-content button.cancel:hover {
    background: #555;
}