.image-effects-tool {
  color: #f0f0f0;
  background-color: #1e1e1e;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
  font-family: 'Segoe UI', sans-serif;
}
.image-effects-tool h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  text-align: center;
}
.upload-section {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.upload-section button {
  background: #333;
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.3s;
}
.upload-section button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.upload-section button:hover:not(:disabled) {
  background: #444;
}
.canvas-wrapper {
  position: relative;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  margin-bottom: 2rem;
  overflow: hidden;
  text-align: center;
  min-height: 320px;
}
#imageCanvas {
  max-width: 100%;
  max-height: 500px;
  display: none;
}
.canvas-placeholder {
  color: #777;
  padding: 4rem 1rem;
  font-size: 1.1rem;
}
.controls-panel {
  background: #2a2a2a;
  border-radius: 8px;
  box-shadow: 0 0 0 1px #333;
}
.control-group {
  margin-bottom: 1.2rem;
}
.control-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
  color: #ddd;
}
.control-group input[type="range"] {
  width: 100%;
  cursor: pointer;
  accent-color: #0af;
}
.control-group input[type="checkbox"] {
  margin: 0;
  margin-right: 0.1rem;
  padding: 0!;
  background-color: red;
  accent-color: #0af;
}
@media (max-width: 600px) {
  .upload-section {
    flex-direction: column;
    align-items: center;
  }

  .image-effects-tool h1 {
    font-size: 1.4rem;
  }
}
/* Collapsible Group Styling */
.filter-group {
  margin-bottom: 2px;
  border: 1px solid #444;
  border-radius: 6px;
  position: relative;
  overflow: visible;
  font-size: 14px;
}
.filter-group-header {
  background: #333;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.3s;
  text-align: left;
  padding-left: 5px;
}
.filter-group-header:hover {
  background: #444;
}
.filter-group-body {
  margin: 0;
  padding: 0.1rem 1rem;
  display: none;
}
.filter-group-body.show {
  display: block;
}
.filter-controls {
  text-align: right;
  margin-bottom: 2px;
}
/* Active highlight */
.control-group input[type="checkbox"]:checked + label,
.control-group input[type="checkbox"]:checked {
  color: #0af;
}
.control-group input[type="range"]:hover {
  filter: brightness(1.2);
}
.control-group[title] {
  position: relative;
}
.control-group[title]::after {
  content: attr(title);
  position: absolute;
  left: 105%;
  top: 50%;
  transform: translateY(-50%);
  background: #222;
  color: #ccc;
  font-size: 0.75rem;
  white-space: nowrap;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  box-shadow: 0 0 0 1px #333;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.control-group[title]:hover::after {
  opacity: 1;
}
/* Split Before/After Preview */
.split-preview {
  position: relative;
  display: flex;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
  height: auto;
  aspect-ratio: 4 / 3;
}
.before-canvas,
.after-canvas {
  position: absolute;
  top: 0; bottom: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.before-canvas canvas,
.after-canvas canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.before-canvas {
  clip-path: inset(0 50% 0 0);
}
.after-canvas {
  clip-path: inset(0 0 0 50%);
}
#sliderHandle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: #0af;
  cursor: ew-resize;
  z-index: 10;
}
#downloadFormat {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  padding: 0.4rem;
  margin-left: 0.5rem;
  border-radius: 4px;
}

#qualitySlider {
  width: 100%;
  accent-color: #0af;
}
.file-size {
  color: #aaa;
  font-size: 0.9rem;
}
input[type="range"] {
  width: 100%;
  accent-color: #0af;
}
input[type="color"] {
  background: #111;
  border: 1px solid #444;
  padding: 0.2rem;
  width: 60px;
  height: 34px;
}

#toggleAllGroups {
  background: #333;
  color: #fff;
  border: 1px solid #444;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
}

.has-tooltip {
  position: relative;
  display: inline-block;
}
.has-tooltip .tooltip-text {
  position: absolute;
  bottom: 100%;
  left: 0;
  transform: translateX(0); /* no shift to right */
  margin-bottom: 6px;
  background: #222;
  color: #fff;
  padding: 6px 10px;
  font-size: 0.85em;
  border-radius: 5px;
  white-space: normal;
  max-width: 260px;
  width: max-content;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 9999;

  /* Prevent overflowing page width */
  overflow-wrap: break-word;
  word-break: break-word;
  box-sizing: border-box;
  right: auto;
}

.has-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}
/* Make sure all containers allow overflow */
.tool-section.how-to-use {
  background: #1c1c1c;
  padding: 20px;
  border-radius: 10px;
  margin-top: 30px;
  color: #f0f0f0;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}
.tool-section.how-to-use h2 {
  font-size: 1.5em;
  margin-bottom: 12px;
  color: #ffffff;
  border-left: 4px solid #00bcd4;
  padding-left: 10px;
}
.tool-section.how-to-use ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tool-section.how-to-use li {
  margin-bottom: 10px;
  padding-left: 22px;
  position: relative;
  line-height: 1.6;
  font-size: 0.95em;
}
.tool-section.how-to-use li::before {
  content: "✔";
  position: absolute;
  left: 0;
  color: #00ffc8;
  font-weight: bold;
}



.image-effects-tool {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
  font-family: 'Segoe UI', sans-serif;
  color: #f0f0f0;
  background-color: #121212;
}
.image-effects-tool h1,
.image-effects-tool h3 {
  text-align: center;
  color: #fff;
}
.controls-panel h3 {
  margin: 0;
  margin-bottom: 2px;
  font-size: 1.0rem;
  border-bottom: 1px solid #444;
}
.upload-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.upload-section button,
.upload-section select {
  background: #1e1e1e;
  color: #fff;
  border: 1px solid #444;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}
.upload-section button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.upload-section .quality-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #ccc;
}

#qualitySlider {
  width: 100px;
}
#fileSizeInfo {
  font-size: 0.9rem;
  color: #aaa;
}

.canvas-wrapper {
  position: relative;
  display: flex;
  width: 100%;
  height: 400px;
  border: 1px solid #333;
  margin-bottom: 1.5rem;
  background: #0a0a0a;
}
.canvas-wrapper canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.before-canvas,
.after-canvas {
  flex: 1;
  overflow: hidden;
}

#sliderHandle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #777;
  cursor: ew-resize;
  z-index: 10;
  left: 50%;
}
.canvas-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  text-align: center;
}

.preset-panel {
  text-align: center;
  float: left;
  position: relative;
}
.preset-panel select {
  background: #1e1e1e;
  color: #fff;
  border: 1px solid #444;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
}
.controls-panel {
  background: #1a1a1a;
  padding: 5px;
  padding-top: 0px;
  border-radius: 8px;
}

.reset-group {
  display: block;
  margin: 0.5rem auto 0;
  padding: 0.4rem 0.8rem;
  background: #222;
  border: 1px solid #555;
  border-radius: 4px;
  color: #ccc;
  cursor: pointer;
}
.has-tooltip {
  position: relative;
}
.has-tooltip .tooltip-text {
  position: absolute;
  bottom: 100%;
  left: 0;
  transform: translateY(-0.5rem);
  background: #333;
  color: #eee;
  font-size: 0.85rem;
  padding: 0.5rem;
  border-radius: 4px;
  white-space: pre-line;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
  z-index: 999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  max-width: 320px;
}
.has-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}
.tool-section.how-to-use {
  margin-top: 2rem;
  padding: 1rem;
  background: #181818;
  border-radius: 8px;
}
.tool-section.how-to-use h2 {
  margin-bottom: 1rem;
  color: #fff;
  text-align: center;
}
.tool-section.how-to-use ul {
  list-style: disc inside;
  color: #ccc;
}
.tool-section.how-to-use li {
  margin-bottom: 0.6rem;
}
