:root {
    --primary-color: #5aa8cc;
    --primary-hover: #4a98bc;
    --background-color: #f0f0f0;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #dddddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --thumbnail-height: 120px;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    color: var(--text-color);
}

/* Layout */
.container {
    height: 100vh;
    padding: 20px;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    overflow: hidden;
}

select.camera-select {
    font-family: Arial, sans-serif;
	display: block;
	padding-top: 3px;
	padding-left: 10px;
	padding-bottom: 3px;
	font-weight: 500; /* Changed from invalid value to valid numeric value */
        padding: 8px;
        border-radius: 6px;
        border: 1px solid #ccc;
        background-color: white;
        cursor: pointer;	
	margin-top: 2px;
	height: 35px;
	width: 100%;
	background: #E6E6E6;
	border:#A4A4A4 solid 1px;
	border-radius: 10px;
	margin-bottom: 4px;
}

select option.camera-select {
	padding-top: 3px;
	padding-left: 10px;
	padding-bottom: 3px;
}


/* Sidebar */
.sidebar {
    background: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    height: calc(100vh - 40px);
    overflow-y: auto;
}

/* Camera Select */
.camera-select {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background-color: var(--card-background);
    cursor: pointer;
}

/* Calendar Toggle */
.calendar-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    color: var(--text-color);
    justify-content: space-between;
    align-items: center;
}

.calendar-toggle i {
    transition: transform 0.3s;
}

.calendar-toggle.active i {
    transform: rotate(180deg);
}

/* Calendar Container */
.calendar-container {
    transition: all 0.3s ease;
}

/* Calendar */
.calendar {
    background: var(--card-background);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

.calendar-nav {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--text-secondary);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.calendar-nav:hover {
    background-color: var(--background-color);
}

.calendar table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.calendar th {
    font-weight: 500;
    color: var(--text-secondary);
    padding: 5px 0;
    font-size: 13px;
    width: calc(100% / 7);
}

.calendar td {
    padding: 2px;
    text-align: center;
    font-size: 13px;
    width: calc(100% / 7);
    height: 32px;
    position: relative;
}

.calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0 auto;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-color);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.calendar td:not(:empty):hover .calendar-day {
    background-color: var(--background-color);
}

.calendar .other-month .calendar-day {
    color: #ccc;
}

.calendar .future-date .calendar-day {
    color: #ccc;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.calendar .future-date:hover .calendar-day {
    background-color: #f5f5f5;
}

.calendar .selected .calendar-day {
    background-color: var(--primary-color);
    color: white;
}

.calendar .today .calendar-day {
    border: 2px solid var(--primary-color);
}

.calendar .selected.today .calendar-day {
    border: none;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Main Content */
.main-content {
    background: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
    overflow: hidden;
    min-height: 500px;
}

/* Main Image */
.main-image-container {
    flex: 1;
    position: relative;
    width: 100%;
    background-color: var(--background-color);
    margin-bottom: 4px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}


/* Add these CSS styles */
.image-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.main-image {
    object-fit: contain;
    display: block;
    opacity: 1;
    transition: opacity 0.2s;
    position: relative;
    transform-origin: center;
    transition: transform 0.3s ease-out;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    max-width: 100%;
    max-height: 100%;
}     
         
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px;
    border-radius: 8px;
    z-index: 10;
}

.zoom-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    color: white;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.zoom-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.zoom-level {
    font-size: 14px;
    min-width: 48px;
    text-align: center;
}

/* Image Info */
.image-info {
    text-align: center;
    margin: 5px 0;
}

.image-timestamp {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
}

.image-timestamp .date {
    color: var(--text-secondary);
}

/* Thumbnails */
.thumbnails-wrapper {
    position: relative;
    height: var(--thumbnail-height);
    margin-top: auto;
    min-height: 90px;
    width: 100%;
    overflow: hidden;
}

.thumbnails {
    display: flex;
    gap: 10px;
    padding: 10px 40px;
    overflow-x: auto;
    height: 100%;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--background-color);
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    flex-wrap: nowrap;
}

.thumbnails::-webkit-scrollbar {
    height: 8px;
}

.thumbnails::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}

.thumbnails::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.2s ease;
}

/* Loading gif specific styles */
.thumbnail-container img[src$='loading.gif'] {
    width: 32px !important;
    height: 32px !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    opacity: 0.6 !important;
    object-fit: contain !important;
}

/* Ensure consistent container dimensions */
.thumbnail-container {
    flex: 0 0 auto;
    width: 160px;
    height: 90px;
    min-width: 160px;
    position: relative;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
    background-color: #f5f5f5;
}

.thumbnail-container:hover {
    transform: scale(1.02);
}

.thumbnail-container.active {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

/* Prevent any intermediate image states */
.thumbnail-container img:not([src$='loading.gif']) {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Time indicator */
.thumbnail-time {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 12px;
    padding: 2px 4px;
    text-align: center;
    z-index: 2;
}

/* Navigation Arrows */
.nav-arrows {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    z-index: 10;
    box-shadow: 0 2px 4px var(--shadow-color);
    transition: all 0.2s;
}

.nav-arrows:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
}

.nav-arrows:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-prev {
    left: 5px;
}

.nav-next {
    right: 5px;
}

/* Fullscreen */
.fullscreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.fullscreen img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.close-fullscreen {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-fullscreen:hover {
    color: var(--primary-color);
}

/* Status Indicators */
.loading, .error, .no-images {
    text-align: center;
    padding: 20px;
    border-radius: 20px;
    color: var(--text-secondary);
}

.error {
    color: #dc3545;
}

/* Selection Controls */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;

}

.selected-count {
    display: none;
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
    margin-bottom: 10px;
}

#selectModeToggle {
    margin-top: 10px;
}

.highlight-mode {
    background-color: rgba(90, 168, 204, 1.8) !important; /* Lighter version of primary color */
    
}

.highlight-mode .thumbnail-time {
    background-color: rgba(90, 168, 204, 1.8) !important; /* Lighter version of primary color */
    
}

.selection-mode .thumbnail-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(90, 168, 204, 0.5);
    z-index: 1;
    pointer-events: none;
}

.selection-mode .thumbnail-container {
    border: 2px solid rgba(90, 168, 204, 0.3) !important;
    background-color: rgba(90, 168, 204, 0.3) !important;
}

#selectionControls:not(.hidden) + #selectModeToggle {
    display: none;
}

#selectionControls {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 0;
    opacity: 0;
}

#selectionControls:not(.hidden) {
    margin-top: 10px;
}

/* Select Multiple Button Active State */
#selectModeToggle.active {
    background-color: var(--primary-hover);
}


/* Remove the floating controls styles */
#multiSelectControls {
    position: static;
    transform: none;
    background: none;
    box-shadow: none;
    padding: 0;
}


/* iOS Firefox specific fixes */
@supports (-webkit-touch-callout: none) {
    .thumbnails-wrapper {
        -webkit-overflow-scrolling: touch;
        overflow-x: scroll;
    }

    .thumbnails {
        display: -webkit-box;
        display: -webkit-flex;
        display: flex;
        -webkit-overflow-scrolling: touch;
    }

    .thumbnail-container {
        -webkit-flex: 0 0 auto;
        flex: 0 0 auto;
    }
}

/* Media Queries */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 250px 1fr;
    }

    .calendar td {
        height: 30px;
    }

    .calendar-day {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }

    .thumbnail-container {
        width: 140px;
        height: 79px;
        min-width: 140px;
    }
}

/* Hide multi-select on mobile */
@media (max-width: 768px) {
    #selectModeToggle,
    #selectionControls {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        height: auto;
        overflow: auto;
        padding: 10px;
    }

    .sidebar {
        height: auto;
        margin-bottom: 20px;
        padding: 15px;
    }

    .calendar-toggle {
        display: flex;
    }

    .calendar-container {
        max-height: 0;
        overflow: hidden;
        margin: 0;
    }

    .calendar-container.expanded {
        max-height: 400px;
        margin-bottom: 20px;
    }

    .main-content {
        height: auto;
        min-height: calc(100vh - 400px);
        padding: 15px;
    }

    .-image-container {
        min-height: 200px;
    }

    .calendar td {
        height: 28px;
        padding: 1px;
    }

    .calendar-day {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .thumbnails-wrapper {
        height: 90px;
        min-height: 90px;
    }

    .thumbnails {
        padding: 5px 35px;
        gap: 5px;
    }

    .thumbnail-container {
        width: 120px;
        height: 67.5px;
        min-width: 120px;
    }

    .nav-arrows {
        width: 30px;
        height: 30px;
    }

    .calendar-header {
        padding: 0;
    }

    .calendar-title {
        font-size: 14px;
    }

    .calendar-nav {
        width: 24px;
        height: 24px;
        padding: 3px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .sidebar, 
    .main-content {
        padding: 12px;
    }

    .calendar td {
        height: 24px;
        padding: 0;
    }

    .calendar-day {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }

    .calendar-toggle {
        font-size: 13px;
        padding: 10px 12px;
    }

    .thumbnails-wrapper {
        height: 80px;
        min-height: 80px;
    }

    .thumbnail-container {
        width: 100px;
        height: 56.25px;
        min-width: 100px;
    }

    .nav-arrows {
        width: 28px;
        height: 28px;
    }

    .btn {
        font-size: 13px;
        padding: 8px;
    }

    .image-timestamp {
        font-size: 0.9em;
    }
}

@media screen and (max-width: 428px) {
    .thumbnails-wrapper {
        height: 80px;
        min-height: 80px;
    }

    .thumbnails {
        padding: 5px 30px;
    }

    .thumbnail-container {
        width: 100px;
        height: 56.25px;
        min-width: 100px;
    }
}

@media (max-width: 360px) {
    .calendar-day {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .thumbnails-wrapper {
        height: 70px;
        min-height: 70px;
    }

    .thumbnail-container {
        width: 80px;
        height: 45px;
        min-width: 80px;
    }

    .thumbnail-time {
        font-size: 10px;
        padding: 1px 2px;
    }

    .nav-arrows {
        width: 26px;
        height: 26px;
    }

    .image-timestamp {
        flex-direction: column;
        gap: 5px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .nav-arrows,
    .calendar td {
        min-height: 44px;
    }

    .thumbnail-container:active {
        transform: scale(0.98);
    }
}


