/* Add this for the mobile dropdown */
.more-dropdown.show {
  display: block !important;
}

/* Base Styles */
:root {
  --primary-color: #4361ee;
  --primary-hover: #3a56d4;
  --secondary-color: #f8f9fa;
  --text-color: #212529;
  --text-light: #6c757d;
  --border-color: #dee2e6;
  --success-color: #10b981;
  --error-color: #ef4444;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --radius: 0.5rem;
  --transition: all 0.3s ease;
  --sidebar-width: 320px;
  --header-height: 60px;
  --bg-color: #ffffff;
  --canvas-bg: #f8f9fa;
  --card-bg: #ffffff;
  --footer-bg: #212529;
  --footer-text: #ffffff;
  --footer-link: #adb5bd;
  --nav-bg: #ffffff;
  --nav-text: #212529;
  --sidebar-bg: #ffffff;
  --sidebar-border: #dee2e6;
  --button-primary-bg: #4361ee;
  --button-primary-text: #ffffff;
  --button-secondary-bg: #e9ecef;
  --button-secondary-text: #212529;
  --tab-active-bg: #4361ee;
  --tab-active-text: #ffffff;
  --ad-space-bg: #f8f9fa;
  --dimension-tab-active: #4361ee;
  --dimension-tab-active-text: #ffffff;
  --ad-space-height: clamp(80px, 8vh, 100px);
  --separator-height: 1px;
  --separator-color: #dee2e6;
  --ad-bar-height: 90px;
}

/* Dark mode colors */
.dark-mode {
  --primary-color: #4361ee;
  --primary-hover: #3a56d4;
  --secondary-color: #1e1e24;
  --text-color: #e9ecef;
  --text-light: #adb5bd;
  --border-color: #2d2d3a;
  --bg-color: #121212;
  --canvas-bg: #1e1e24;
  --card-bg: #2d2d3a;
  --footer-bg: #121212;
  --footer-text: #e9ecef;
  --footer-link: #adb5bd;
  --nav-bg: #121212;
  --nav-text: #e9ecef;
  --sidebar-bg: #1e1e24;
  --sidebar-border: #2d2d3a;
  --button-primary-bg: #4361ee;
  --button-primary-text: #ffffff;
  --button-secondary-bg: #2d2d3a;
  --button-secondary-text: #e9ecef;
  --tab-active-bg: #4361ee;
  --tab-active-text: #ffffff;
  --ad-space-bg: #1e1e24;
  --dimension-tab-active: #4361ee;
  --dimension-tab-active-text: #ffffff;
  --separator-color: #2d2d3a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    "Helvetica Neue", sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  background-color: var(--bg-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.2;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  height: auto;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* Header */
header {
  background-color: var(--nav-bg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: background-color 0.3s ease;
  padding: 0;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 32px;
  margin-right: 10px;
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0;
}

/* Navigation Controls */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav ul li {
  margin: 0 0.25rem;
  position: relative;
}

nav ul li a {
  color: var(--text-color);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  white-space: nowrap;
  display: block;
}

nav ul li a:hover,
nav ul li a.active {
  color: var(--primary-color);
  background-color: rgba(67, 97, 238, 0.1);
}

/* More dropdown */
.more-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 180px;
  display: none;
  z-index: 100;
}

nav ul li:hover .more-dropdown {
  display: block;
}

.more-dropdown a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-color);
  font-weight: 500;
  border-bottom: 1px solid var(--border-color);
}

.more-dropdown a:last-child {
  border-bottom: none;
}

.more-dropdown a:hover {
  background-color: rgba(67, 97, 238, 0.1);
  color: var(--primary-color);
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  justify-content: center; /* Center the content */
}

.dark-mode .theme-toggle {
  background-color: #2d2d3a;
  border-color: #3d3d4a;
}

.theme-toggle:hover {
  background-color: #e9ecef;
}

.dark-mode .theme-toggle:hover {
  background-color: #3d3d4a;
}

.theme-text {
  font-size: 0.9rem;
  font-weight: 500;
  margin-left: 0.25rem;
  text-align: center; /* Center the text */
}

/* Upload Section */
.upload-section {
  padding: 2rem 0;
}

.hero-text {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-text h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero-text p {
  font-size: 1.25rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

.upload-area {
  background-color: #f0f5ff;
  border: 2px dashed #c7d2fe;
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  max-width: 800px;
  margin: 0 auto;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background-color: #e6eeff;
}

/* Add this to your existing CSS */
.upload-area.loading {
  position: relative;
  pointer-events: none;
}

.upload-area.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.upload-icon {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.select-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  margin-bottom: 1rem;
  transition: var(--transition);
}

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

.upload-area p {
  color: var(--text-light);
}

/* Features Section */
.features-section {
  padding: 4rem 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

.feature-card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

.feature-card h3 {
  margin-bottom: 1rem;
}

.feature-card p {
  color: var(--text-light);
}

/* Editor Container */
.editor-container {
  display: flex;
  flex-direction: row; /* Ensures sidebar is on the right */
  height: calc(100vh - var(--header-height));
  min-height: 600px;
  background-color: var(--canvas-bg);
  max-width: 100vw; /* Use 100% viewport width */
  margin: 0 auto;
}

/* Update the ad bars to not overlap with the sidebar */
.ad-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--ad-space-bg);
  color: var(--text-light);
  font-size: 0.9rem;
  height: var(--ad-bar-height);
  min-height: var(--ad-bar-height);
  max-height: var(--ad-bar-height);
  width: calc(100vw - var(--sidebar-width)); /* Subtract sidebar width */
  border-bottom: 1px solid var(--separator-color);
  z-index: 20; /* Higher z-index to ensure they stay on top */
}

/* Make top ad bar sticky at the top */
.ad-bar.top-ad {
  position: fixed;
  top: var(--header-height); /* Position below header */
  left: 0;
}

/* Make bottom ad bar sticky at the bottom */
.ad-bar.bottom-ad {
  border-bottom: none;
  border-top: 1px solid var(--separator-color);
  position: fixed;
  bottom: 0;
  left: 0;
}

/* Adjust the canvas area to account for fixed ad bars */
.canvas-area {
  flex: 1;
  display: grid;
  grid-template-rows: var(--ad-bar-height) 1fr var(--ad-bar-height);
  height: 100vh;
  width: calc(100vw - var(--sidebar-width)); /* Subtract sidebar width */
  background-color: var(--canvas-bg);
  overflow: hidden; /* Prevent any overflow */
  position: relative; /* For absolute positioning */
}

/* Adjust preview container to fill space between ad bars */
.preview-container {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  top: var(--ad-bar-height); /* Position directly below top ad bar */
  left: 0; /* Full width */
  width: 100%; /* Full width of canvas area */
  height: calc(100vh - var(--header-height) - (2 * var(--ad-bar-height))); /* Fill space between ad bars */
  margin: 0; /* No margin */
}

/* Make sure the canvas stays contained and maximized */
#imageCanvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: 0;
  cursor: default;
}

/* Crop Overlay Styles - Photoshop-like */
.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: all;
  z-index: 10;
  user-select: none;
  overflow: visible;
}

/* Shaded areas outside crop */
.crop-shade-area {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Crop box */
.crop-box {
  position: absolute;
  border: 2px dashed white;
  box-sizing: border-box;
  pointer-events: all;
  cursor: move;
  z-index: 15;
}

/* Rule of thirds grid */
.crop-grid-line {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.horizontal-top {
  top: 33.33%;
  left: 0;
  width: 100%;
  height: 1px;
}

.horizontal-bottom {
  top: 66.67%;
  left: 0;
  width: 100%;
  height: 1px;
}

.vertical-left {
  top: 0;
  left: 33.33%;
  width: 1px;
  height: 100%;
}

.vertical-right {
  top: 0;
  left: 66.67%;
  width: 1px;
  height: 100%;
}

/* Crop handles - much larger and more prominent */
.crop-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  background-color: white;
  border: 3px solid black;
  border-radius: 50%;
  pointer-events: all;
  z-index: 20;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
}

.crop-handle.top-left {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.crop-handle.top {
  top: 0;
  left: 50%;
  cursor: ns-resize;
}

.crop-handle.top-right {
  top: 0;
  left: 100%;
  cursor: nesw-resize;
}

.crop-handle.right {
  top: 50%;
  left: 100%;
  cursor: ew-resize;
}

.crop-handle.bottom-right {
  top: 100%;
  left: 100%;
  cursor: nwse-resize;
}

.crop-handle.bottom {
  top: 100%;
  left: 50%;
  cursor: ns-resize;
}

.crop-handle.bottom-left {
  top: 100%;
  left: 0;
  cursor: nesw-resize;
}

.crop-handle.left {
  top: 50%;
  left: 0;
  cursor: ew-resize;
}

/* Crop buttons */
.crop-buttons {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#applyCropButton,
#resetCropButton {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: var(--transition);
}

#applyCropButton {
  background-color: var(--primary-color);
  color: white;
  border: none;
}

#applyCropButton:hover {
  background-color: var(--primary-hover);
}

#resetCropButton {
  background-color: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border: 1px solid var(--border-color);
}

#resetCropButton:hover {
  background-color: var(--secondary-color);
}

/* Undo button */
#undoCropButton {
  background-color: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border: 1px solid var(--border-color);
  margin-top: 0.5rem;
}

#undoCropButton:hover {
  background-color: var(--secondary-color);
}

#undoCropButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Custom aspect ratio inputs */
#customAspectRatio {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Sidebar Styles (Right Side) */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--sidebar-bg);
  border-left: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease;
  height: 100%;
  position: relative;
}

/* Sidebar Content */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  padding-bottom: 6rem;
}

/* Sidebar Tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--sidebar-border);
  background-color: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.sidebar-tab {
  flex: 1;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  color: var(--text-color);
  border-bottom: 2px solid transparent;
}

.sidebar-tab svg {
  color: var(--text-light);
}

.sidebar-tab:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .sidebar-tab:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

.sidebar-tab.active svg {
  color: var(--primary-color);
}

.sidebar-tab span {
  white-space: nowrap;
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
}

.settings-tab {
  flex: 1;
  padding: 0.5rem;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: var(--transition);
  color: var(--text-color);
  border-bottom: 2px solid transparent;
}

.settings-tab:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .settings-tab:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.settings-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

/* Settings Content */
.settings-content {
  display: none;
}

.settings-content.active {
  display: block;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.sidebar-section {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section h4 {
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
  color: var(--text-color);
  font-weight: 600;
}

/* Control Styles */
.control-row {
  margin-bottom: 0.75rem;
  display: flex;
  gap: 0.75rem;
}

.control-row:last-child {
  margin-bottom: 0;
}

.control-item {
  margin-bottom: 0.5rem;
  flex: 1;
}

.control-item:last-child {
  margin-bottom: 0;
}

.control-item label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

.control-item input[type="number"],
.control-item select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background-color: var(--bg-color);
  color: var(--text-color);
}

.range-container {
  display: flex;
  align-items: center;
  margin-top: 0.25rem;
}

.range-container input[type="range"] {
  flex: 1;
  margin-right: 0.5rem;
  height: 4px;
}

.quality-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.1rem;
  font-size: 0.7rem;
  color: var(--text-light);
}

.control-item.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-item.checkbox label {
  margin-bottom: 0;
}

/* Dimension tabs */
.dimension-tabs {
  display: flex;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
  height: 28px;
}

.dimension-tab {
  flex: 1;
  padding: 0.25rem;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  color: var(--text-color);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dimension-tab.active {
  background-color: var(--dimension-tab-active);
  color: var(--dimension-tab-active-text);
  box-shadow: var(--shadow-sm);
}

.dark-mode .dimension-tabs {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Resize content */
.resize-content {
  display: none;
}

.resize-content.active {
  display: block;
}

/* File info styles */
.file-info-section {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.file-info-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.file-info-section h4 {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-weight: 600;
}

.file-info {
  font-size: 0.8rem;
}

.file-info-row {
  margin-bottom: 0.25rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.file-info-row:last-child {
  margin-bottom: 0;
}

.file-info-label {
  color: var(--text-light);
}

.file-info-value {
  font-weight: 500;
  text-align: right;
}

/* Quality slider specific styles */
.quality-container {
  margin-top: 0.75rem;
  position: relative;
}

.quality-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.quality-slider-header label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 0;
}

.quality-value {
  font-weight: 500;
  font-size: 1rem;
}

.range-value-container {
  position: relative;
  margin: 0.75rem 0;
  height: 4px;
  background-color: #e9ecef;
  border-radius: 2px;
}

/* The actual slider track */
.range-value-container::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--slider-percent, 50%);
  background-color: #000000 !important; /* Force black with !important */
  border-radius: 2px;
  z-index: 1;
}

/* Dark mode override for slider fill */
.dark-mode .range-value-container::before {
  background-color: #ffffff !important; /* Force white with !important */
}

/* The slider input */
.range-value-container input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
}

/* The slider thumb */
.slider-thumb {
  position: absolute;
  top: 50%;
  left: var(--slider-percent, 50%);
  width: 20px;
  height: 20px;
  background-color: #000000 !important;
  border: 1px solid #000000 !important;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

/* Dark mode override for slider thumb */
.dark-mode .slider-thumb {
  background-color: #ffffff !important;
  border-color: #ffffff !important;
}

/* Disabled state */
.range-value-container.disabled {
  opacity: 0.6;
}

.range-value-container.disabled .slider-thumb {
  background-color: #f5f5f5;
}

.quality-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

.format-message {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.75rem;
  font-style: italic;
  display: none;
}

.format-message.visible {
  display: block;
}

/* Format select styling */
.format-select-container {
  margin-bottom: 1rem;
}

.format-select-container label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  display: block;
}

.format-select-container select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  background-color: white;
  color: var(--text-color);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9  stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
}

.dark-mode .format-select-container select {
  background-color: var(--card-bg);
  border-color: var(--border-color);
}

/* Card Styles */
.settings-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.settings-card:last-child {
  margin-bottom: 0;
}

.settings-card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-color);
  font-weight: 600;
}

/* Fixed Action Buttons */
.sidebar-actions {
  padding: 1rem;
  border-top: 1px solid var(--sidebar-border);
  background-color: var(--sidebar-bg);
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
}

.action-buttons .btn {
  flex: 1;
}

/* Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: var(--transition);
  border: none;
  text-align: center;
  font-size: 1rem;
}

.primary-btn {
  background-color: var(--button-primary-bg);
  color: var(--button-primary-text);
}

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

.secondary-btn {
  background-color: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border: 1px solid var(--border-color);
}

.secondary-btn:hover {
  background-color: var(--secondary-color);
}

/* Footer */
footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  padding: 4rem 0 2rem;
  transition: background-color 0.3s ease;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}

.footer-logo h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.footer-logo p {
  color: #adb5bd;
}

.footer-links h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.footer-links ul {
  list-style: none;
}

.footer-links ul li {
  margin-bottom: 0.75rem;
}

.footer-links ul li a {
  color: var(--footer-link);
}

.footer-links ul li a:hover {
  color: white;
}

/* Hide footer when editor is active */
body.editor-active footer {
  display: none;
}

/* Responsive Styles */
@media (min-width: 1200px) {
  :root {
    --ad-space-height: clamp(80px, 8vh, 100px);
  }

  .theme-text {
    display: inline-block;
  }

  .theme-text::after {
    content: " Mode";
  }
}

@media (max-width: 1200px) {
  .sidebar {
    width: 280px;
    min-width: 280px;
  }
  :root {
    --ad-bar-height: 80px;
  }
}

@media (max-width: 992px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  nav ul li {
    margin: 0 0.25rem;
  }

  nav ul li a {
    padding: 0.5rem 0.35rem;
    font-size: 0.85rem;
  }

  .sidebar {
    width: 260px;
    min-width: 260px;
  }

  :root {
    --ad-space-height: clamp(70px, 7vh, 90px);
  }
  :root {
    --ad-bar-height: 70px;
  }
}

@media (max-width: 768px) {
  header {
    height: auto;
    padding: 0.5rem 0;
  }

  header .container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0.5rem 1rem;
  }

  .nav-controls {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-bottom: 0.25rem;
  }

  nav ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    padding-bottom: 0.25rem;
  }

  nav ul::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }

  nav ul li {
    flex-shrink: 0;
  }

  .theme-text::before {
    content: "";
  }

  .hero-text h1 {
    font-size: 2rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  /* Mobile-specific fixes */
  .editor-container {
    flex-direction: column;
    height: auto;
    min-height: auto;
  }

  :root {
    --ad-space-height: clamp(60px, 8vh, 80px);
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    min-height: 450px;
    border-left: none;
    border-top: 1px solid var(--sidebar-border);
  }

  /* Fix for mobile sidebar content */
  .sidebar-content {
    position: absolute;
    top: 40px;
    bottom: var(--sidebar-actions-height);
    overflow-y: auto;
    padding-bottom: 1rem;
  }

  /* Make sure sidebar actions are visible */
  .sidebar-actions {
    position: absolute;
    bottom: 0;
  }

  /* Allow scrolling on mobile */
  body.editor-active {
    overflow-y: auto;
  }

  .action-buttons {
    flex-direction: row;
  }
  :root {
    --ad-bar-height: 60px;
  }

  /* Adjust preview container for mobile */
  .preview-container {
    top: calc(var(--header-height) + var(--ad-bar-height));
    height: calc(100vh - var(--header-height) - (2 * var(--ad-bar-height)) - 20vh);
  }

  /* Full width for ad bars on mobile */
  .ad-bar,
  .canvas-area {
    width: 100vw; /* Full width on mobile since sidebar is below */
  }
}

@media (max-width: 576px) {
  .control-row {
    flex-direction: column;
  }

  :root {
    --ad-space-height: clamp(50px, 7vh, 70px);
  }
  :root {
    --ad-bar-height: 50px;
  }
}

/* Add this to fix the scrollbar issue without breaking the layout */
body.editor-active {
  overflow: hidden;
}

/* Override for mobile to allow scrolling */
@media (max-width: 768px) {
  body.editor-active {
    overflow-y: auto;
  }
}

/* Only hide scrollbar when editor is active on desktop */
@media (min-width: 769px) {
  body.editor-active {
    overflow: hidden;
  }
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  .ad-bar,
  .canvas-area {
    width: 100vw; /* Full width on mobile since sidebar is below */
  }

  .preview-container {
    left: 5vw;
    width: 90vw;
  }
}

/* Add these updated mobile-specific styles at the end of the file, after the existing mobile media queries */

/* Enhanced Mobile Fixes */
@media (max-width: 768px) {
  /* Make settings use full width of screen */
  .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: auto;
    min-height: auto;
    border-left: none;
    border-top: 1px solid var(--sidebar-border);
    overflow-x: hidden;
  }

  /* Fix sidebar content to use full width */
  .sidebar-content {
    width: 100%;
    padding: 1rem;
    padding-bottom: 5rem; /* Space for action buttons */
    position: relative;
    top: 0;
    bottom: auto;
    overflow-y: auto;
  }

  /* Make settings cards use full width */
  .settings-card {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Fix dimension tabs to use full width */
  .dimension-tabs {
    width: 100%;
  }

  /* Fix input fields to use proper width */
  .control-item input[type="number"],
  .control-item select {
    width: 100%;
    max-width: 100%;
  }

  /* Fix sidebar actions positioning */
  .sidebar-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--sidebar-bg);
    z-index: 100;
    padding: 0.75rem;
    border-top: 1px solid var(--sidebar-border);
  }

  /* Remove unwanted white bottom bar */
  body::after {
    display: none !important;
  }

  /* Fix editor container layout */
  .editor-container {
    flex-direction: column;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  /* Adjust canvas area for mobile */
  .canvas-area {
    width: 100% !important;
    height: auto;
    min-height: 50vh;
  }

  /* Fix preview container */
  .preview-container {
    position: relative;
    top: 0;
    left: 0;
    width: 100% !important;
    height: auto;
    min-height: 50vh;
    padding: 1rem 0;
  }

  /* Fix ad bars on mobile */
  .ad-bar {
    position: relative !important;
    width: 100% !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
  }

  /* Ensure buttons are properly sized */
  .action-buttons {
    display: flex;
    width: 100%;
  }

  .action-buttons .btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }

  /* Fix tab content to use full width */
  .tab-content {
    width: 100%;
  }

  /* Fix settings tabs to use full width */
  .settings-tabs {
    width: 100%;
  }

  /* Fix settings content to use full width */
  .settings-content {
    width: 100%;
  }
}

/* Extra small devices */
@media (max-width: 576px) {
  /* Further refinements for very small screens */
  .sidebar-content {
    padding: 0.75rem;
  }

  .settings-card {
    padding: 0.75rem;
  }

  /* Make sure inputs are large enough to tap */
  .control-item input[type="number"],
  .control-item select {
    height: 40px;
  }

  /* Ensure checkbox is easily tappable */
  .control-item.checkbox {
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  /* Fix dimension tabs for very small screens */
  .dimension-tab {
    font-size: 0.7rem;
    padding: 0.25rem 0.1rem;
  }
}

/* Hamburger Menu */
.mobile-controls {
  display: none;
}

.hamburger-menu {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  z-index: 101;
}

.hamburger-menu span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-color);
  transition: var(--transition);
}

/* Mobile Menu Active State */
.nav-controls.active {
  display: flex;
}

/* Mobile Styles */
@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
    align-items: center;
  }

  .nav-controls {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background-color: var(--bg-color);
    flex-direction: column;
    padding: 1rem;
    box-shadow: var(--shadow);
    z-index: 100;
  }

  .nav-controls.active {
    display: flex;
  }

  nav ul {
    flex-direction: column;
    width: 100%;
  }

  nav ul li {
    margin: 0.5rem 0;
  }

  .theme-toggle {
    margin-top: 1rem;
    align-self: flex-start;
  }

  /* Ensure more dropdown works on mobile */
  .more-dropdown {
    position: static;
    display: none;
    width: 100%;
    margin-top: 0.5rem;
    box-shadow: none;
    border: none;
    background-color: transparent;
  }

  .more-dropdown.show {
    display: block;
  }
}

/* Mobile Menu Styles - Updated for sleek design */
@media (max-width: 768px) {
  /* Keep existing mobile controls */
  .mobile-controls {
    display: flex;
    align-items: center;
  }

  /* Improved hamburger menu */
  .hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    cursor: pointer;
    z-index: 101;
  }

  .hamburger-menu span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
    transition: var(--transition);
  }

  /* Enhanced dropdown menu styling - position from right side */
  .nav-controls {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: auto; /* Remove left positioning */
    right: 0; /* Position from right side */
    width: 250px; /* Fixed width for more compact look */
    max-width: 80vw;
    background-color: var(--bg-color);
    flex-direction: column;
    padding: 0.5rem 0; /* Reduced padding */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-radius: 0 0 0 12px; /* Rounded corner on bottom left */
    overflow: hidden;
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
  }

  .dark-mode .nav-controls {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  }

  .nav-controls.active {
    display: flex;
  }

  /* Improved menu items */
  nav ul {
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  nav ul li {
    margin: 0;
    width: 100%;
  }

  nav ul li a {
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    width: 100%;
    font-size: 0.95rem;
    border-radius: 0;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
  }

  nav ul li a.active {
    background-color: rgba(67, 97, 238, 0.08);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
  }

  nav ul li a:hover {
    background-color: rgba(67, 97, 238, 0.05);
  }

  /* More dropdown styling */
  .more-dropdown {
    position: static;
    display: none;
    background-color: rgba(0, 0, 0, 0.02);
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-width: 0;
    padding: 0;
    margin: 0;
  }

  .dark-mode .more-dropdown {
    background-color: rgba(255, 255, 255, 0.02);
  }

  .more-dropdown.show {
    display: block;
  }

  .more-dropdown a {
    padding: 0.65rem 1.25rem 0.65rem 2.5rem;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    color: var(--text-light);
  }

  .more-dropdown a:hover {
    color: var(--primary-color);
  }

  /* Theme toggle in mobile menu - centered */
  .theme-toggle {
    margin: 0.5rem 1.25rem 0.75rem;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    align-self: center;
    width: 120px;
  }

  .dark-mode .theme-toggle {
    background-color: rgba(255, 255, 255, 0.03);
  }

  .theme-toggle svg {
    margin-right: 0.5rem;
  }
}

/* Landscape orientation specific styles for mobile devices */
@media (max-width: 900px) and (orientation: landscape) {
  /* Root variables */
  :root {
    --header-height: 50px;
    --sidebar-width: 35%;
    --ad-bar-height: 30px;
  }

  /* Header adjustments - make it fixed */
  header {
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
  }

  /* Add this to push content below the fixed header */
  main {
    margin-top: var(--header-height);
    padding-top: 10px;
  }

  /* Adjust the upload section to account for fixed header */
  .upload-section {
    padding-top: 10px;
  }

  /* Ensure hero text doesn't get cut off */
  .hero-text h1 {
    font-size: 1.8rem;
  }

  /* Editor container layout - adjust to account for fixed header */
  .editor-container {
    flex-direction: row;
    height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
    overflow: hidden;
  }

  /* 1. Clear image preview with proper ad spaces */
  .canvas-area {
    width: 65% !important;
    height: calc(100vh - var(--header-height));
    position: relative;
  }

  .ad-bar {
    width: 65% !important;
    height: var(--ad-bar-height);
    min-height: var(--ad-bar-height);
    position: absolute !important;
    left: 0 !important;
  }

  .ad-bar.top-ad {
    top: 0 !important;
  }

  .ad-bar.bottom-ad {
    bottom: 0 !important;
  }

  .preview-container {
    position: absolute;
    top: var(--ad-bar-height);
    left: 0;
    width: 100% !important;
    height: calc(100vh - var(--header-height) - (2 * var(--ad-bar-height)));
    padding: 0;
  }

  /* 2. Fully functional sidebar with scrolling */
  .sidebar {
    width: 35% !important;
    min-width: 35% !important;
    height: calc(100vh - var(--header-height));
    border-left: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
  }

  .sidebar-tabs {
    height: 36px;
    min-height: 36px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
  }

  .sidebar-content {
    position: absolute;
    top: 36px; /* Height of tabs */
    bottom: 60px; /* Height of action buttons */
    left: 0;
    right: 0;
    overflow-y: auto;
    padding: 0.5rem;
    height: auto;
    max-height: none;
  }

  /* 3. Fixed download and reset buttons */
  .sidebar-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    min-height: 60px;
    padding: 0.5rem;
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--sidebar-border);
    z-index: 10;
    display: flex;
    align-items: center;
  }

  .action-buttons {
    display: flex;
    width: 100%;
    gap: 0.5rem;
  }

  .action-buttons .btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.85rem;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Ensure proper sizing for all elements */
  #imageCanvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  /* Make sure settings cards are properly sized */
  .settings-card {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  /* Ensure hamburger menu is visible */
  .mobile-controls {
    display: flex !important;
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    z-index: 200;
  }

  /* Hide default navigation */
  .nav-controls {
    display: none;
  }

  /* Show navigation only when hamburger is clicked */
  .nav-controls.active {
    display: flex;
    position: absolute;
    top: var(--header-height);
    right: 0;
    width: 250px;
    max-width: 80vw;
    background-color: var(--bg-color);
    flex-direction: column;
    padding: 0.5rem 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-radius: 0 0 0 12px;
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
  }
}

@media (max-width: 1023px) and (orientation: landscape) {
  /* Make hamburger menu visible */
  .mobile-controls {
    display: flex;
    align-items: center;
  }

  /* Hide default navigation until hamburger is clicked */
  .nav-controls {
    display: none;
    position: absolute;
    top: var(--header-height);
    right: 0;
    width: 250px;
    max-width: 80vw;
    background-color: var(--bg-color);
    flex-direction: column;
    padding: 0.5rem 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-radius: 0 0 0 12px;
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
  }

  /* Show navigation when hamburger is clicked */
  .nav-controls.active {
    display: flex;
  }

  /* Ensure menu items are vertical */
  nav ul {
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  nav ul li {
    margin: 0;
    width: 100%;
  }

  nav ul li a {
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    width: 100%;
    font-size: 0.95rem;
    border-radius: 0;
    border-left: 3px solid transparent;
  }

  /* Center the theme toggle */
  .theme-toggle {
    margin: 0.5rem 1.25rem 0.75rem;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    align-self: center;
    width: 120px;
  }

  /* Style for more dropdown in landscape */
  .more-dropdown {
    position: static;
    display: none;
    background-color: rgba(0, 0, 0, 0.02);
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-width: 0;
    padding: 0;
    margin: 0;
  }

  .more-dropdown.show {
    display: block;
  }

  .more-dropdown a {
    padding: 0.65rem 1.25rem 0.65rem 2.5rem;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    color: var(--text-light);
  }

  /* Dark mode specific adjustments */
  .dark-mode .nav-controls {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  }

  .dark-mode .more-dropdown {
    background-color: rgba(255, 255, 255, 0.02);
  }

  .dark-mode .theme-toggle {
    background-color: rgba(255, 255, 255, 0.03);
  }
}

/* Add these styles to the end of your CSS file */

/* Crop Tool Styles */
.crop-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: white;
  border: 1.5px solid black;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  pointer-events: all;
}

.crop-handle.top-left {
  cursor: nwse-resize;
}

.crop-handle.top-right {
  cursor: nesw-resize;
}

.crop-handle.bottom-left {
  cursor: nesw-resize;
}

.crop-handle.bottom-right {
  cursor: nwse-resize;
}

.crop-handle.top {
  cursor: ns-resize;
}

.crop-handle.right {
  cursor: ew-resize;
}

.crop-handle.bottom {
  cursor: ns-resize;
}

.crop-handle.left {
  cursor: ew-resize;
}

.crop-border {
  position: absolute;
  border: 2px dashed white;
  box-sizing: border-box;
  pointer-events: none;
}

.crop-shield {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* Enhance the crop tab UI */
#crop-tab .settings-card {
  display: flex;
  flex-direction: column;
}

#applyCropButton {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  margin-top: 1rem;
  width: 100%;
  cursor: pointer;
  transition: var(--transition);
}

#applyCropButton:hover {
  background-color: var(--primary-hover);
}

#cancelCropButton {
  background-color: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  margin-top: 0.5rem;
  width: 100%;
  cursor: pointer;
  transition: var(--transition);
}

#cancelCropButton:hover {
  background-color: var(--secondary-color);
}

/* Make sure the canvas container has position relative for proper overlay positioning */
.preview-container {
  position: relative !important;
}

/* Ensure the canvas has proper cursor when in crop mode */
#imageCanvas {
  cursor: default;
}

#imageCanvas.crop-active {
  cursor: crosshair;
}

/* Add these styles at the end of the file */

/* Image Optimizer Styles */
.adjustment-container {
  margin-bottom: 1.5rem;
}

.adjustment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.adjustment-value {
  font-weight: 600;
  font-size: 1rem;
}

/* Replace the existing adjustment slider styles with these improved styles that match the quality slider */
.adjustment-slider-container {
  position: relative;
  margin: 0.75rem 0;
  height: 4px;
  background-color: #e9ecef;
  border-radius: 2px;
}

.dark-mode .adjustment-slider-container {
  background-color: #2d2d3a;
}

/* The actual slider track fill */
.adjustment-slider-container::before {
  content: "";
  position: absolute;
  top: 0;
  height: 100%;
  background-color: #000000 !important; /* Force black with !important */
  border-radius: 2px;
  z-index: 1;
  transition: width 0.1s ease, left 0.1s ease;
}

/* Dark mode override for slider fill */
.dark-mode .adjustment-slider-container::before {
  background-color: #ffffff !important; /* Force white with !important */
}

/* The slider input */
.adjustment-slider-container input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
}

/* The slider thumb */
.adjustment-slider-thumb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background-color: #000000 !important; /* Force black with !important */
  border: 1px solid #000000 !important;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  transition: left 0.3s ease;
}

.dark-mode .adjustment-slider-thumb {
  background-color: #ffffff !important;
  border-color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Adjustment tabs layout */
.adjustment-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 8px;
  margin-bottom: 1rem;
}

.adjustment-tab {
  padding: 12px;
  text-align: center;
  background-color: #f8f9fa;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.adjustment-tab.active {
  background-color: #4361ee;
  color: white;
}

.dark-mode .adjustment-tab {
  background-color: #2d2d3a;
}

.dark-mode .adjustment-tab.active {
  background-color: #4361ee;
}

/* Adjustment content */
.adjustment-content {
  display: none;
  margin-top: 1rem;
}

.adjustment-content.active {
  display: block;
}

.adjustment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.adjustment-group-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reset-button {
  background: none;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.reset-button:hover {
  background-color: #f8f9fa;
}

.dark-mode .reset-button {
  border-color: #3d3d4a;
}

.dark-mode .reset-button:hover {
  background-color: #2d2d3a;
}

.adjustment-item {
  margin-bottom: 1.25rem;
}

.adjustment-item:last-child {
  margin-bottom: 0;
}

.adjustment-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.adjustment-value {
  font-weight: 600;
}

/* Ensure all tabs are visible when active */
.sidebar-tabs[data-mode="optimize"] {
  display: flex;
}

.tab-content[data-mode="optimize"] {
  display: none;
}

.tab-content[data-mode="optimize"].active {
  display: block;
}

/* Ensure proper styling for sidebar tabs in optimizer mode */
.sidebar-tabs[data-mode="optimize"] {
  display: flex;
  border-bottom: 1px solid var(--sidebar-border);
  background-color: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.sidebar-tabs[data-mode="optimize"] .sidebar-tab {
  flex: 1;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  color: var(--text-color);
  border-bottom: 2px solid transparent;
}

.sidebar-tabs[data-mode="optimize"] .sidebar-tab svg {
  color: var(--text-light);
}

.sidebar-tabs[data-mode="optimize"] .sidebar-tab:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .sidebar-tabs[data-mode="optimize"] .sidebar-tab:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-tabs[data-mode="optimize"] .sidebar-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

.sidebar-tabs[data-mode="optimize"] .sidebar-tab.active svg {
  color: var(--primary-color);
}

/* Responsive adjustments for optimizer UI */
@media (max-width: 768px) {
  .adjustment-container {
    margin-bottom: 1rem;
  }

  .adjustment-slider-container {
    height: 8px; /* Slightly larger for touch */
  }

  .reset-adjustment {
    padding: 0.6rem 1rem;
    font-size: 1rem;
  }
}

/* Adjustment tabs layout - horizontal design */
.adjustment-tabs {
  display: flex;
  flex-direction: row;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.adjustment-tabs::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.adjustment-tab {
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--text-light);
  position: relative;
}

.tab-icon {
  stroke: var(--text-light);
  transition: stroke 0.2s ease;
}

.adjustment-tab.active {
  color: #4361ee;
}

.adjustment-tab.active .tab-icon {
  stroke: #4361ee;
}

.adjustment-tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #4361ee;
}

.dark-mode .adjustment-tab {
  color: var(--text-light);
}

.dark-mode .adjustment-tab.active {
  color: #4361ee;
}

/* The actual slider track */
.adjustment-slider-container {
  position: relative;
  margin: 0.75rem 0;
  height: 4px;
  background-color: #e9ecef;
  border-radius: 2px;
}

.dark-mode .adjustment-slider-container {
  background-color: #2d2d3a;
}

/* The center marker for zero position */
.adjustment-slider-container::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: 1px;
  background-color: rgba(0, 0, 0, 0.2);
  z-index: 0;
  transform: translateX(-50%);
}

.dark-mode .adjustment-slider-container::after {
  background-color: rgba(255, 255, 255, 0.2);
}

/* The actual slider track fill */
.adjustment-slider-container::before {
  content: "";
  position: absolute;
  top: 0;
  height: 100%;
  background-color: #000000 !important; /* Force black with !important */
  border-radius: 2px;
  z-index: 1;
  transition: width 0.1s ease, left 0.1s ease;
}

/* Dark mode override for slider fill */
.dark-mode .adjustment-slider-container::before {
  background-color: #ffffff !important;
}

/* The slider input */
.adjustment-slider-container input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
}

/* The slider thumb */
.adjustment-slider-thumb {
  position: absolute;
  top: 50%;
  left: var(--slider-percent, 50%);
  width: 20px;
  height: 20px;
  background-color: #000000 !important; /* Force black with !important */
  border: 1px solid #000000 !important;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  transition: left 0.3s ease;
}

/* Dark mode override for slider thumb */
.dark-mode .adjustment-slider-thumb {
  background-color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); /* Slightly stronger shadow for visibility */
}

/* Add these new styles for the optimizer tabs */

/* Optimizer Tabs - Improved Design */
.optimizer-tabs {
  border-bottom: 1px solid var(--border-color);
  background-color: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0;
}

.tab-scroll-container {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  white-space: nowrap;
  width: 100%;
}

.tab-scroll-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.optimizer-tab {
  flex: 1;
  min-width: 80px;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  color: var(--text-light);
  position: relative;
  border-bottom: 2px solid transparent;
}

.optimizer-tab span {
  white-space: nowrap;
}

.optimizer-tab .tab-icon {
  stroke: var(--text-light);
  transition: stroke 0.2s ease;
}

.optimizer-tab:hover {
  background-color: rgba(67, 97, 238, 0.05);
}

.optimizer-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  background-color: rgba(67, 97, 238, 0.1);
}

.optimizer-tab.active .tab-icon {
  stroke: var(--primary-color);
}

/* Update the adjustment content styles */
.adjustment-item {
  margin-bottom: 1.5rem;
}

.adjustment-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.adjustment-value {
  font-weight: 600;
}

/* Remove the adjustment group title styles that we don't want */
.adjustment-group-title {
  display: none;
}

/* Reset button and adjustment actions */
.adjustment-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.reset-button {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-color);
  transition: all 0.2s ease;
}

.reset-button:hover {
  background-color: rgba(67, 97, 238, 0.05);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.reset-button svg {
  stroke: currentColor;
}

/* Full width button */
.full-width {
  width: 100%;
  text-align: center;
  justify-content: center;
}

/* Optimizer Tabs */
.optimizer-tabs-container {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 20px;
}

.optimizer-tabs {
  display: flex;
  min-width: 100%;
  border-bottom: 1px solid #e0e0e0;
}

.optimizer-tab {
  padding: 12px 20px;
  cursor: pointer;
  white-space: nowrap;
  color: #666;
  font-weight: 500;
  position: relative;
  transition: all 0.3s ease;
}

.optimizer-tab i {
  margin-right: 6px;
}

.optimizer-tab.active {
  color: #4169e1;
}

.optimizer-tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #4169e1;
}

.optimizer-tab-content {
  display: none;
  padding: 20px 0;
}

.optimizer-tab-content.active {
  display: block;
}

/* Adjustment Controls */
.adjustment-control {
  margin-bottom: 24px;
}

.adjustment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 500;
}

.adjustment-value {
  color: #666;
}

/* Slider Styling */
.slider-container {
  padding: 0 10px;
  margin-bottom: 15px;
}

.slider {
  position: relative;
  height: 4px;
  background-color: #e0e0e0;
  border-radius: 2px;
  cursor: pointer;
}

.slider-track {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #e0e0e0;
  border-radius: 2px;
}

.slider-fill {
  position: absolute;
  height: 100%;
  background-color: #000;
  border-radius: 2px;
  width: 0%;
  left: 50%;
  transition: width 0.1s ease, left 0.1s ease;
}

.slider-fill.positive {
  left: 50%;
}

.slider-fill.negative {
  right: 50%;
  left: auto;
}

.slider-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: #000;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.slider-thumb:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.slider-center-mark {
  position: absolute;
  width: 2px;
  height: 8px;
  background-color: rgba(0, 0, 0, 0.2);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Reset Button */
.reset-button-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.reset-adjustments-button {
  background-color: transparent;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-adjustments-button:hover {
  background-color: #f5f5f5;
}

/* Update the optimizer tabs styling to ensure proper display of icons */
.optimizer-tab {
  flex: 1;
  min-width: 80px;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  color: var(--text-light);
  position: relative;
  border-bottom: 2px solid transparent;
}

.optimizer-tab span {
  white-space: nowrap;
}

.optimizer-tab .tab-icon {
  stroke: var(--text-light);
  transition: stroke 0.2s ease;
  min-width: 20px;
}

.optimizer-tab:hover {
  background-color: rgba(67, 97, 238, 0.05);
}

.optimizer-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  background-color: rgba(67, 97, 238, 0.1);
}

.optimizer-tab.active .tab-icon {
  stroke: var(--primary-color);
}

/* Ensure the tab container scrolls properly on smaller screens */
.tab-scroll-container {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  white-space: nowrap;
  width: 100%;
}

.tab-scroll-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Find the optimizer tabs section and replace it with this two-row layout */

/* Optimizer Tabs - Two Row Layout */
.optimizer-tabs {
  border-bottom: 1px solid var(--border-color);
  background-color: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.tab-scroll-container {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
}

.optimizer-tab {
  flex: 1;
  min-width: 80px;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  color: var(--text-light);
  position: relative;
  border-bottom: 2px solid transparent;
}

/* First row - 3 tabs */
.optimizer-tab:nth-child(-n + 3) {
  flex: 1 0 33.333%;
}

/* Second row - Vibrance tab positioned under Brightness */
.optimizer-tab:nth-child(4) {
  flex: 1 0 33.333%;
  margin-left: 0; /* Align under Brightness */
}

/* Replace the adjustment slider styles to match the resizer output slider */
.adjustment-slider-container {
  position: relative;
  margin: 0.75rem 0;
  height: 6px;
  background-color: #e9ecef;
  border-radius: 2px;
}

.dark-mode .adjustment-slider-container {
  background-color: #2d2d3a;
}

/* The actual slider track */
.adjustment-slider-container::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--slider-percent, 50%);
  background-color: #000000 !important; /* Force black with !important */
  border-radius: 2px;
  z-index: 1;
  transition: width 0.3s ease;
}

.dark-mode .adjustment-slider-container::before {
  background-color: var(--primary-color);
}

/* The slider input */
.adjustment-slider-container input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
}

/* The slider thumb */
.adjustment-slider-thumb {
  position: absolute;
  top: 50%;
  left: var(--slider-percent, 50%);
  width: 20px;
  height: 20px;
  background-color: #000000 !important; /* Force black with !important */
  border: 1px solid #000000 !important;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  transition: left 0.3s ease;
}

.dark-mode .adjustment-slider-thumb {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Optimizer Tab Rows - 2x2 Layout */
.optimizer-tab-row {
  display: flex;
  width: 100%;
}

.optimizer-tab-row .optimizer-tab {
  flex: 1;
  min-width: 0; /* Allow tabs to shrink if needed */
}

/* Update tab-scroll-container to use column layout */
.tab-scroll-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Add these styles for the 2x2 optimizer tabs layout */
.optimizer-tabs {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--sidebar-border);
  background-color: var(--sidebar-bg);
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0;
}

.optimizer-tab-row {
  display: flex;
  width: 100%;
}

.optimizer-tab-row .sidebar-tab {
  flex: 1;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  color: var(--text-color);
  border-bottom: 2px solid transparent;
}

.optimizer-tab-row .sidebar-tab svg {
  color: var(--text-light);
}

.optimizer-tab-row .sidebar-tab:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .optimizer-tab-row .sidebar-tab:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.optimizer-tab-row .sidebar-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

.optimizer-tab-row .sidebar-tab.active svg {
  color: var(--primary-color);
}

.optimizer-tab-row .sidebar-tab span {
  white-space: nowrap;
}

/* Update the adjustment slider styles for better visual feedback and smoother operation */

/* The actual slider track */
.adjustment-slider-container {
  position: relative;
  margin: 0.75rem 0;
  height: 6px; /* Slightly taller for better visibility */
  background-color: #e9ecef;
  border-radius: 3px;
  overflow: visible;
}

.dark-mode .adjustment-slider-container {
  background-color: #2d2d3a;
}

/* Center line indicator for zero position */
.adjustment-slider-container::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: 2px;
  background-color: rgba(0, 0, 0, 0.1);
  z-index: 0;
  transform: translateX(-50%);
}

.dark-mode .adjustment-slider-container::after {
  background-color: rgba(255, 255, 255, 0.1);
}

/* The actual slider track fill for positive values */
.adjustment-slider-container.positive::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: var(--slider-percent, 0%);
  background-color: #000000 !important; /* Force black with !important */
  border-radius: 0 3px 3px 0;
  z-index: 1;
  transition: width 0.1s ease-out;
}

/* The actual slider track fill for negative values */
.adjustment-slider-container.negative::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--slider-start, 50%);
  height: 100%;
  width: var(--slider-percent, 0%);
  background-color: #000000 !important; /* Force black with !important */
  border-radius: 3px 0 0 3px;
  z-index: 1;
  transition: width 0.1s ease-out, left 0.1s ease-out;
}

/* Dark mode override for slider fill */
.dark-mode .adjustment-slider-container.positive::before,
.dark-mode .adjustment-slider-container.negative::before {
  background-color: #ffffff !important; /* Force white with !important */
}

/* The slider input */
.adjustment-slider-container input[type="range"] {
  position: absolute;
  top: -5px; /* Extend the hit area */
  left: 0;
  width: 100%;
  height: 16px; /* Larger hit area for better usability */
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
}

/* The slider thumb */
.adjustment-slider-thumb {
  position: absolute;
  top: 50%;
  left: 50%; /* Default to center */
  width: 18px;
  height: 18px;
  background-color: #000000 !important; /* Force black with !important */
  border: 2px solid #000000 !important;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  transition: left 0.1s ease-out, transform 0.1s ease;
  will-change: left, transform;
}

/* Enhance slider transitions for smoother movement */
.adjustment-slider-thumb {
  transition: left 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: left;
}

.adjustment-slider-container::before {
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1), left 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width, left;
}

/* Ensure slider containers properly handle transitions */
.adjustment-slider-container.positive::before,
.adjustment-slider-container.negative::before {
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1), left 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode override for slider thumb */
.dark-mode .adjustment-slider-thumb {
  background-color: #ffffff !important; /* Force white with !important */
  border-color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); /* Stronger shadow for visibility */
}

/* Add a subtle hover effect for the thumb when the slider is hovered */
.adjustment-slider-container:hover .adjustment-slider-thumb {
  transform: translate(-50%, -50%) scale(1.1);
}

/* Add a subtle loading indicator for the preview container */
.preview-container.processing::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: #4361ee;
  border-radius: 50%;
  animation: processing-spinner 0.8s linear infinite;
  z-index: 100;
}

@keyframes processing-spinner {
  to {
    transform: rotate(360deg);
  }
}

/* Improve the adjustment value display */
.adjustment-value {
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Add a subtle transition to the adjustment value for smoother updates */
.adjustment-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Add tick marks for better visual reference */
.adjustment-slider-container .tick-marks {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--text-light);
}

/* Improve the reset button hover state */
.reset-button:hover {
  background-color: rgba(67, 97, 238, 0.1);
  border-color: var(--primary-color);
  color: var(--primary-color);
}
