/* General Styles */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background-color: #f0f0f0;
}

/* Skip to main content link (accessibility) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
    position: fixed;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

body {
    background-color: #f0f0f0;
}

.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Container Styles */
.iris-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.eye-container {
    position: relative;
    width: 50%;
    height: 100%;
    float: left;
}

#dual-mapper-container {
    display: none;
    width: 100%;
    height: 100%;
}

#dual-mapper-container .eye-container {
    width: 50%;
    height: 100%;
    float: left;
}

#dual-mapper-container .eye-container:first-child {
    border-right: 1px solid #ccc;
}

/* Controls Styles */
.controls {
    position: absolute;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: move;
    width: fit-content;
    height: fit-content;
    
}

.top-left {
    top: 170px;
    left: 10px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px; /* Gap between controls */
    width: 160px; /* Set a fixed width to make the menu less wide */
}

.top-right {
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: row;
    gap: 4px;
}

.bottom-left {
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.bottom-right {
    bottom: 10px;
    right: 10px;
    width: 270px;
    max-height: calc(100vh - 100px);
}

/* Eye Selection Panel Styles */
.eye-selection-panel {
    display: flex;
    justify-content: center; /* Center buttons horizontally */
    align-items: center; /* Align items vertically */
    gap: 5px; /* Add a small gap between buttons */
    top: 70px; /* Position below the logo */
    left: 5%; /* Center horizontally */
    transform: translateX(-50%); /* Adjust for centering */
}

.eye-selection-panel .btn {
    width: auto; /* Allow buttons to size based on content or flex properties */
    flex-grow: 0; /* Don't allow buttons to grow to fill container */
    flex-shrink: 0; /* Don't allow buttons to shrink if container is too small */
    padding-left: 15px; /* Add some horizontal padding */
    padding-right: 15px; /* Add some horizontal padding */
}

/* Button Styles */
.btn {
    padding: 6px 8px;
    background-color: #4A90E2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s, transform 0.1s;
    text-align: center;
    width: 100%; /* Make all buttons full width within their container */
    box-sizing: border-box; /* Include padding and border in width */
}

.btn:hover {
    background-color: #3A80D2;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(1px);
}

/* Persistent active/toggled state */
.btn.active {
    background-color: #2F6FBF; /* deeper primary for selected */
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

/* Danger variant active state */
.reset-button:active,
.reset-button.active {
    background-color: #c64541;
}

/* Disabled button style */
.eye-selection-panel .btn[disabled] {
    background-color: #cccccc; /* Gray background */
    color: #666666;          /* Darker gray text */
    cursor: not-allowed;      /* Show 'not-allowed' cursor */
    transform: none;          /* Remove any hover/active transforms */
}

/* Eye selection: make active more prominent */
.eye-selection-panel .btn.active {
    background-color: #2F6FBF;
    border: 1px solid #245ca0;
}

/* Optional: Ensure hover effects are also disabled */
.eye-selection-panel .btn[disabled]:hover {
    background-color: #cccccc; /* Keep gray background on hover */
    transform: none;
}

/* Top-Left Controls Specific */
.controls.top-left .btn {
    width: 100%; /* Ensure all buttons have the same width */
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    gap: 4px;
}

.zoom-controls .btn {
    flex: 1;
    width: auto; /* Override width to allow side-by-side alignment */
}

/* Rotation Buttons */
.rotation-buttons {
    display: flex;
    gap: 4px;
}

.rotation-buttons .btn {
    flex: 1;
    width: auto; /* Override width to allow side-by-side alignment */
}

/* Direction Buttons */
.direction-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 4px;
  width: 100%;
  margin: 4px 0;
}

.direction-buttons button {
  padding: 8px;
  width: 100%;
}
/* Specific positioning for each button */
.direction-buttons #moveUp {
  grid-column: 2;
  grid-row: 1;
}

.direction-buttons #moveLeft {
  grid-column: 1;
  grid-row: 2;
}

.direction-buttons #moveRight {
  grid-column: 3;
  grid-row: 2;
}

.direction-buttons #moveDown {
  grid-column: 2;
  grid-row: 3;
}

/* Hide empty div elements */
.direction-buttons > div:empty {
  display: none;
}

/* Input Styles */
.bottom-left input {
    width: 100%;
    margin: 4px 0;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.bottom-left input[type="range"] {
    padding: 0;
}

/* Gallery Styles */
.gallery {
    margin-bottom: 15px;
}

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

.gallery-item-controls {
    flex-shrink: 0; /* Prevent controls from shrinking */
    display: flex; /* Use flex to align buttons */
    gap: 5px; /* Add space between buttons */
    align-items: center; /* Vertically align buttons */
}

.gallery-item-controls .btn {
    padding: 4px 8px; /* Reduced padding */
    font-size: 11px; /* Slightly smaller font size */
    background-color: #4A90E2; /* Primary blue background */
    color: white; /* White text color */
    border: none; /* Remove border */
    width: auto; /* Allow buttons to size based on content */
}

.gallery-item-controls .btn:hover {
    background-color: #3A80D2; /* Darker blue on hover */
}

.gallery-item-header .image-name {
    flex-grow: 1; /* Allow filename to take available space */
    overflow: hidden; /* Hide overflowing text */
    text-overflow: ellipsis; /* Show ellipsis for truncated text */
    white-space: nowrap; /* Prevent text wrapping */
}

.add-image-btn {
    width: 30px;
    height: 30px;
    background-color: #4A90E2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.gallery-accordion {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.gallery-item {
    border-bottom: 1px solid #ddd;
}

.gallery-item:last-child {
    border-bottom: none;
}

.gallery-item-header {
    position: relative;
    padding: 8px;
    background-color: #f5f5f5;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-item-content {
    padding: 8px;
    display: none;
    position: relative;
}

.gallery-item-content.active {
    display: block;
}

.gallery-item-content .gallery-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e74c3c;
    color: #fff;
    border: none;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s, opacity 0.2s;
    opacity: 0;
    pointer-events: none;
}
.gallery-item-content:hover .gallery-delete-btn,
.gallery-item-content.active .gallery-delete-btn {
    opacity: 1;
    pointer-events: auto;
}
.gallery-delete-btn:hover, .gallery-delete-btn:focus {
    background: #c0392b;
    box-shadow: 0 4px 12px rgba(231,76,60,0.15);
    outline: none;
    transform: scale(1.08);
}
.gallery-delete-btn:active {
    background: #a93226;
    transform: scale(0.95);
}
.gallery-item img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.adjustment-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #4A90E2;
    border-radius: 50%;
    cursor: pointer;
}

.adjustment-slider {
  flex: 1;
}

.adjustment-value {
  min-width: 30px;
  text-align: right;
  font-size: 12px;
  color: #fff;
}


/* Adjustment Row Styles */
.adjustment-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.adjustment-label {
  min-width: 80px;
  font-size: 12px;
  color: #fff;
}

/* Image Adjustment Panel Styles */
.image-adjustments {
  background-color: #2a2a2a;
  color: white;
  padding: 8px; /* Reduced padding */
  border-radius: 8px;
}

/* Adjustment Groups Container */
.adjustments-container {
  display: flex;
  flex-direction: column;
  gap: 2px; /* Minimal gap between rows */
}

.histogram {
  width: 100%;
  height: 80px; /* Slightly reduced height */
  background-color: #1a1a1a;
  border-radius: 4px;
  margin-bottom: 10px; /* Reduced margin */
  position: relative;
}

.histogram canvas {
    width: 100%;
    height: 100%;
}

.auto-levels {
  width: 100%;
  padding: 6px; /* Reduced padding */
  background-color: #4A90E2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 4px; /* Reduced margin */
  font-size: 13px;
}

.reset-button {
    width: 100%;
    padding: 8px;
    background-color: #d9534f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 15px;
}

/* Image and SVG Containers */
#image-container, #left-image-container, #right-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

#svg-container, #left-svg-container, #right-svg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    user-select: none;
}

/* Canvas Styles */
.image-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
    image-rendering: auto;
    transform-origin: center center;
}

/* Progress Indicator */
.progress-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1001;
    display: none;
    align-items: center;
    justify-content: center;
}

/* Cloud Loader Styles (replaces circular spinner) */
.loader {
    --cloud-color: #4387f4;
    --arrows-color: #80b1ff;
    --time-animation: 1s;
    transform: scale(1);
}

.loader #cloud {
    width: 100px;
    height: 100px;
}

.loader #cloud rect {
    fill: var(--cloud-color);
}

.loader #cloud g:nth-child(3) {
    transform-origin: 50% 72.8938%;
    fill: var(--arrows-color);
    filter: drop-shadow(0 0 8px black);
    animation: rotation var(--time-animation) linear infinite;
}

.loader #shapes g g circle {
    animation: cloud calc(var(--time-animation) * 2) linear infinite;
}

.loader #shapes g g circle:nth-child(2) {
    animation-delay: calc((var(--time-animation) * 2) / -3);
}

.loader #shapes g g circle:nth-child(3) {
    animation-delay: calc((var(--time-animation) * 2) / -1.5);
}

.loader svg #lines g line {
    stroke-width: 5;
    transform-origin: 50% 50%;
    rotate: -65deg;
    animation: lines calc(var(--time-animation) / 1.33) linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
    100% { transform: rotate(360deg); }
}

@keyframes lines {
    0% { transform: translateY(-10px); }
    100% { transform: translateY(8px); }
}

@keyframes cloud {
    0% { cx: 20; cy: 60; r: 15; }
    50% { cx: 50; cy: 45; r: 20; }
    100% { cx: 80; cy: 60; r: 15; }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1001;
}

.modal-content {
    position: relative;
    background-color: #fefefe;
    color: #333; /* Explicit text color for visibility */
    margin: 10% auto; /* Adjusted for better centering */
    padding: 20px;
    border: 1px solid #888;
    width: 90%; /* Increased width for better visibility */
    max-width: 500px;
    border-radius: 8px;
    overflow-y: auto; /* Allow scrolling if content overflows */
    max-height: 80vh; /* Prevent modal from exceeding viewport height */
}

.modal-content h2 {
    color: #333; /* Explicit color for heading */
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-content span {
    color: inherit; /* Inherit from parent for map option text */
}

.close {
    position: absolute;
    right: 10px;
    top: 5px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

/* Map Options in Modal */
.map-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.map-option {
    padding: 10px;
    background-color: #f5f5f5;
    color: #333; /* Explicit text color for visibility */
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
    font-size: 16px;
}

.map-option:hover {
    background-color: #f0f0f0;
}

/* Custom Maps Section */
.custom-maps-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.custom-maps-section h4 {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

#customMapsList {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-map-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background-color: #f5f5f5;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.custom-map-item:hover {
    background-color: #f0f0f0;
}

.custom-map-item .map-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: pointer;
}

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

.custom-map-item .map-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.custom-map-item .map-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.custom-map-item .map-meta {
    font-size: 11px;
    color: #999;
}

.custom-map-item .map-actions-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: all 0.2s;
}

.custom-map-item .map-actions-btn:hover {
    color: #333;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
}

/* Action Menu */
.action-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.action-btn {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: #f5f5f5;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: #f0f0f0;
}

.action-btn.btn-danger {
    color: #dc3545;
}

.action-btn.btn-danger:hover {
    background-color: #fee;
}

.logo-container {
    display: flex;
    align-items: flex-end; /* Align items to the bottom */
    position: absolute;
    top: 10px; 
    left: 10px; 
    z-index: 1001;
}

.logo {
    margin-right: 8px; /* Add some space between the logo and the version text */
    height: 50px; 
    width: auto;
}

.version-text {
    font-size: 0.75em; /* Smaller font size */
    color: #666;       /* Slightly lighter gray */
    font-weight: 300;   /* Lighter font weight */
    padding-bottom: 5px; /* Adjust to align with baseline of 'IRISLAB' in logo */
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .controls.bottom-right {
        width: 90%;
        right: 5%;
        bottom: 10px;
    }
    
    .controls.top-left, .controls.bottom-left {
        left: 5%;
    }
    
    .eye-container {
        width: 100%;
        height: 50%;
    }
    
    #dual-mapper-container {
        flex-direction: column;
    }
}
@media (max-width: 768px) {
    /* Adjustments for tablets and smaller screens */
}

@media (max-width: 480px) {
    /* Adjustments for mobile devices */
}

/* Base Responsive System */
:root {
  --control-panel-width: 270px;
  --control-panel-mobile-width: 90vw;
  --button-size: 40px;
  --button-mobile-size: 48px;
  --spacing-unit: 8px;
  --border-radius: 8px;
  --transition-speed: 0.3s;
  --panel-background: rgba(255, 255, 255, 0.95);
  --panel-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* Responsive Container System */
.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: none; /* Hide by default - only show when authenticated */
}

.app-container.authenticated {
  display: block; /* Show when user is authenticated */
  background-image: 
      linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
      linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
      linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Enhanced Control Panels */
.controls {
  position: absolute;
  background-color: var(--panel-background);
  border-radius: var(--border-radius);
  box-shadow: var(--panel-shadow);
  transition: transform var(--transition-speed), width var(--transition-speed);
  z-index: 1000;
}

/* Improved Top Controls */
.controls.top-left {
  top: 170px;
  left: var(--spacing-unit);
  width: 160px;
  transform-origin: left top;
}

.controls.top-right {
  top: var(--spacing-unit);
  right: var(--spacing-unit);
  display: flex;
  gap: var(--spacing-unit);
}

/* Enhanced Bottom Controls */
.controls.bottom-left {
  bottom: var(--spacing-unit);
  left: var(--spacing-unit);
  width: auto;
}

.controls.bottom-right {
  bottom: var(--spacing-unit);
  right: var(--spacing-unit);
  width: var(--control-panel-width);
  max-height: calc(100vh - 120px);
}

/* Mobile-Optimized Buttons */
.btn {
  min-height: var(--button-size);
  padding: calc(var(--spacing-unit) * 1.5);
  border-radius: calc(var(--border-radius) / 2);
  font-size: 14px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Enhanced Mobile Navigation */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  bottom: var(--spacing-unit);
  right: var(--spacing-unit);
  width: var(--button-mobile-size);
  height: var(--button-mobile-size);
  background: #4A90E2;
  border-radius: 50%;
  z-index: 1002;
  box-shadow: var(--panel-shadow);
}

/* Responsive Dual View Container */
#dual-mapper-container {
  display: flex;
  width: 100%;
  height: 100%;
  transition: flex-direction var(--transition-speed);
}

.eye-container {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* Enhanced Image Controls */
.image-canvas {
  touch-action: none;
  will-change: transform;
}

/* Responsive Gallery */
.gallery {
  border-radius: var(--border-radius);
  background: #ffffff;
}

.gallery-item {
  touch-action: manipulation;
}

/* Mobile-Optimized Adjustments Panel */
.image-adjustments {
  border-radius: var(--border-radius);
  overflow: hidden;
}

.adjustment-row {
  padding: calc(var(--spacing-unit) * 1.5) var(--spacing-unit);
  touch-action: manipulation;
}

/* Enhanced Modal for Mobile */
.modal-content {
  width: min(90vw, 500px);
  margin: 5vh auto;
  max-height: 90vh;
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  :root {
    --control-panel-width: 240px;
    --button-size: 36px;
  }
}

@media (max-width: 992px) {
  .controls.bottom-right {
    width: var(--control-panel-mobile-width);
    right: 50%;
    transform: translateX(50%);
    bottom: calc(var(--button-mobile-size) + var(--spacing-unit) * 2);
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .controls.top-left {
    transform: translateX(-100%);
  }
  
  .controls.top-left.active {
    transform: translateX(0);
  }
}

@media (max-width: 768px) {
  :root {
    --button-size: 44px;
    --spacing-unit: 12px;
  }

  #dual-mapper-container {
    flex-direction: column;
  }
  
  .eye-container {
    height: 50%;
    width: 100%;
  }
  
  .controls.top-right {
    right: 50%;
    transform: translateX(50%);
  }
  
  .gallery-item-header {
    padding: calc(var(--spacing-unit) * 1.5);
  }
}

@media (max-width: 576px) {
  :root {
    --button-mobile-size: 56px;
  }
  
  .btn {
    padding: calc(var(--spacing-unit) * 2);
  }
  
  .controls.bottom-right {
    width: 100%;
    bottom: 0;
    right: 0;
    transform: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
  }
  
  .mobile-menu-toggle {
    bottom: calc(var(--spacing-unit) * 2);
  }
  
  .modal-content {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
  }

  .gallery-item-content .gallery-delete-btn {
    top: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    font-size: 22px;
  }
}

/* Touch Device Optimizations */
@media (hover: none) {
  .btn:hover {
    transform: none;
  }
  
  .image-canvas {
    cursor: grab;
  }
  
  .map-option {
    padding: calc(var(--spacing-unit) * 2);
  }
}
/* Mobile-Optimized Styles */
:root {
  --bottom-nav-height: 60px;
  --panel-header-height: 50px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Bottom Navigation */
.bottom-navigation {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--bottom-nav-height);
  background: #fff;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
  padding-bottom: var(--safe-area-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  min-width: 60px;
}

/* Mobile Panels */
.mobile-panel {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
  left: 0;
  width: 100%;
  background: #fff;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  z-index: 999;
}

.panel-header {
  height: var(--panel-header-height);
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}

/* Touch-Friendly Slider */
.touch-slider {
  height: 60px;
  padding: 0 20px;
  margin: 10px 0;
}

.touch-slider-track {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  position: relative;
}

.touch-slider-handle {
  width: 32px;
  height: 32px;
  background: #4A90E2;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 20px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: #4A90E2;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 1001;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Media Queries */
@media (max-width: 768px) {
  .controls {
      display: none; /* Hide original controls */
  }

  .mobile-panel {
      display: block;
  }

  .bottom-navigation {
      display: flex;
  }
}

/* Touch-Specific Optimizations */
@media (hover: none) {
  .btn {
      min-height: 44px;
  }

  .adjustment-row {
      padding: 12px 0;
  }
}
.adjustment-row {
  display: flex;
  align-items: center;
  height: 20px; /* Reduced height */
  padding: 0 2px; /* Minimal padding */
  margin: 0; /* Remove margin */
  gap: 4px; /* Reduced gap between elements */
}

/* Profile System Styles */
.profile-container {
  position: absolute;
  top: 10px;
  right: 70px;
  z-index: 1001;
}

.profile-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #4A90E2;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: background-color 0.3s ease;
}

.profile-icon:hover {
  background-color: #357ABD;
}

.profile-dropdown {
  position: absolute;
  top: 45px;
  right: 0;
  min-width: 200px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 9999;
}

.profile-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.profile-header {
  padding: 15px;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.user-email {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.profile-menu {
  padding: 0;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin: 0;
  box-sizing: border-box;
}

.profile-menu-item:hover {
  background-color: #f0f0f0;
}

.profile-menu-divider {
  height: 1px;
  background-color: #e5e5e5;
  margin: 4px 0;
  width: 100%;
}

.menu-icon {
  margin-right: 10px;
  font-size: 16px;
}

.menu-text {
  font-size: 14px;
  color: #333;
}

/* Custom Modal Styles */
.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
}

.custom-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.custom-modal-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
}

.custom-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.custom-modal-header {
  display: flex;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #eee;
}

.custom-modal-icon {
  font-size: 24px;
  margin-right: 12px;
  flex-shrink: 0;
}

.custom-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
  flex: 1;
}

.custom-modal-body {
  padding: 20px 24px;
}

.custom-modal-message {
  font-size: 15px;
  line-height: 1.5;
  color: #555;
  margin: 0;
  white-space: pre-wrap;
}

.custom-modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px 24px;
  justify-content: flex-end;
}

.custom-modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.custom-modal-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}

.custom-modal-btn-primary {
  background: #4A90E2;
  color: white;
}

.custom-modal-btn-primary:hover {
  background: #357ABD;
}

.custom-modal-btn-secondary {
  background: #f8f9fa;
  color: #666;
  border: 1px solid #ddd;
}

.custom-modal-btn-secondary:hover {
  background: #e9ecef;
}

/* My Saved Projects Styles */
.saved-projects {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  /* Scrolling is handled by .saved-projects-list to keep header visible */
}

.saved-projects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  z-index: 1;
}

.saved-projects-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.refresh-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  color: #666;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.refresh-btn:hover {
  background: #f0f0f0;
}

.saved-projects-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.saved-project-item {
  display: flex;
  align-items: center;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 8px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.saved-project-item:hover {
  background: #f5f5f5;
}

/* BATCH_DELETE: Selected project styling */
.saved-project-item.selected {
  background: #e3f2fd;
  border-color: #4A90E2;
}

/* BATCH_DELETE: Checkbox container */
.project-checkbox-container {
  margin-right: 8px;
  flex-shrink: 0;
}

.project-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #4A90E2;
}

/* BATCH_DELETE: Batch delete controls */
.batch-delete-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

/* BATCH_DELETE: Batch action buttons (matches refresh-btn style) */
.batch-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  padding: 3px 6px;
  color: #666;
  border-radius: 3px;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.batch-action-btn:hover:not(:disabled) {
  background: #f0f0f0;
  color: #333;
}

.batch-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.batch-action-btn-danger {
  color: #dc3545;
}

.batch-action-btn-danger:hover:not(:disabled) {
  background: #fee;
  color: #c82333;
}

.project-thumbnail {
  width: 45px;
  height: 45px;
  border-radius: 4px;
  object-fit: cover;
  margin-right: 10px;
  background: #ddd;
  flex-shrink: 0;
}

/* LAZY_LOAD: Styles for lazy-loaded thumbnails */
.project-thumbnail.lazy-thumbnail {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-thumbnail.lazy-thumbnail[src] {
  opacity: 1;
}

.project-details {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}

.project-name {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  margin: 0 0 3px 0;
  word-wrap: break-word;
  display: block;
}

.project-name.editing {
  display: none;
}

.project-name-input {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  padding: 2px 4px;
  border: 1px solid #4A90E2;
  border-radius: 3px;
  width: 100%;
  display: none;
  background: white;
}

.project-name-input.editing {
  display: block;
}

.project-date {
  font-size: 10px;
  color: #666;
  margin: 0;
}

.project-buttons {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.project-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all 0.2s ease;
  position: relative;
}

.project-icon-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(1.1);
}

.project-icon-btn.load:hover {
  background: rgba(40, 167, 69, 0.2);
}

.project-icon-btn.edit:hover {
  background: rgba(74, 144, 226, 0.2);
}

.project-icon-btn.delete:hover {
  background: rgba(220, 53, 69, 0.2);
}

/* Tooltip for icon buttons */
.project-icon-btn::after {
  content: attr(title);
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 5px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 10px;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.project-icon-btn:hover::after {
  opacity: 1;
}

/* ===================================
   ACTIVITY MONITOR STYLES
   =================================== */

/* Note: removed thumbnail status badges for simplicity */

/* Warning Modal */
.activity-warning-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.activity-warning-modal.show {
    opacity: 1;
    visibility: visible;
}

.activity-warning-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.activity-warning-modal.show .activity-warning-content {
    transform: scale(1);
}

.activity-warning-header {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.activity-warning-icon {
    font-size: 32px;
    line-height: 1;
    animation: gentle-pulse 2s ease-in-out infinite;
}

@keyframes gentle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.activity-warning-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.activity-warning-body {
    padding: 24px;
    text-align: center;
}

.activity-warning-body p {
    margin: 0 0 24px 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

.activity-warning-body strong {
    color: #333;
}

#warningCountdown {
    color: #4A90E2;
    font-weight: 600;
}

.activity-warning-actions {
    display: flex;
    gap: 12px;
    flex-direction: column;
}

/* Primary Button */
#stayLoggedInBtn {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

#stayLoggedInBtn:hover {
    background: linear-gradient(135deg, #357ABD 0%, #2968A3 100%);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.4);
    transform: translateY(-1px);
}

#stayLoggedInBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

/* Secondary Button */
#logoutNowBtn {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e9ecef;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#logoutNowBtn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #495057;
}

#logoutNowBtn:active {
    transform: translateY(1px);
}

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

/* Logout Notification */
.activity-logout-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 300px;
    width: 90%;
    text-align: center;
}

.activity-logout-notification.show {
    opacity: 1;
    visibility: visible;
}

.logout-notification-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logout-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.logout-message {
    text-align: left;
}

.logout-message strong {
    color: #28a745;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.logout-message p {
    margin: 0;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .activity-warning-content {
        max-width: 350px;
        margin: 20px;
    }

    .activity-warning-header {
        padding: 20px;
    }

    .activity-warning-body {
        padding: 20px;
    }

    .activity-warning-actions {
        gap: 10px;
    }

    #stayLoggedInBtn,
    #logoutNowBtn {
        padding: 12px 20px;
        font-size: 13px;
    }

    .activity-logout-notification {
        max-width: 280px;
        padding: 20px;
    }

    .logout-notification-content {
        gap: 12px;
    }

    .logout-icon {
        font-size: 20px;
    }

    .logout-message strong {
        font-size: 13px;
    }

    .logout-message p {
        font-size: 12px;
    }
}

/* ========================================
   AUTH LOADING SCREEN
   ======================================== */

#auth-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#auth-loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Gradient Loader Animation */
#auth-loading-screen .loader-container {
    position: relative;
    max-width: 300px;
    width: 90%;
    height: 40px;
    background: linear-gradient(to right, rgba(74, 144, 226, 0.3), rgba(74, 144, 226, 0.8), rgba(74, 144, 226, 0.3));
    background-size: 200% 100%;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
    -webkit-box-reflect: below 1px linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4));
    animation: gradientAnimation 3s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

#auth-loading-screen .loader-text {
    color: white;
    mix-blend-mode: difference;
    text-align: center;
    margin: 0;
    font-size: 13px;
    line-height: 40px;
    font-family: 'Josefin Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    padding: 0;
    letter-spacing: 3px;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

@keyframes gradientAnimation {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #auth-loading-screen .loader-container {
        max-width: 280px;
        height: 36px;
    }
    
    #auth-loading-screen .loader-text {
        font-size: 11px;
        letter-spacing: 2px;
        line-height: 36px;
    }
}

@media (max-width: 480px) {
    #auth-loading-screen .loader-container {
        max-width: 250px;
        height: 32px;
    }
    
    #auth-loading-screen .loader-text {
        font-size: 10px;
        letter-spacing: 1.5px;
        line-height: 32px;
    }
}

/* App container visibility control */
.app-container {
    display: none !important;
}

.app-container.authenticated {
    display: block !important;
}

