/* === Image Editor Modal Overlay === */
.image-editor-modal {
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  background: rgba(0, 0, 0, 0.95); /* More opaque background */
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px); /* Stronger blur */
  -webkit-backdrop-filter: blur(10px); /* Safari support */
}

/* Additional overlay for extra darkness */
.image-editor-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.8); /* Extra dark layer */
  z-index: -1;
}

/* === Container === */
.image-editor-container {
  background: #1a2a2a;
  border: 2px solid #203b3b;
  border-radius: 20px;
  padding: 20px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8); /* Stronger shadow */
  animation: modalSlideIn 0.3s ease-out;
  position: relative;
  z-index: 1;
}

@keyframes modalSlideIn {
  from { 
    opacity: 0; 
    transform: scale(0.9) translateY(-20px); 
  }
  to { 
    opacity: 1; 
    transform: scale(1) translateY(0); 
  }
}

/* === Canvas Area === */
.editor-canvas-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  margin: 20px 0;
  background: #0f0f0f;
  border: 2px solid #333;
  border-radius: 10px;
  overflow: hidden;
}
.editor-canvas-container:hover {
  border-color: #164141;
}

.editor-canvas {
  max-width: 100%;
  max-height: 400px;
  border-radius: 10px;
  cursor: grab;
  transition: transform 0.1s ease;
  image-rendering: crisp-edges;
}
.editor-canvas:active {
  cursor: grabbing;
}

/* === Modal Title === */
.image-editor-container h3 {
  background: linear-gradient(45deg, #164141, #1a4b4b);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 0;
  margin-bottom: 20px;
}

/* === Editor Controls === */
.editor-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  padding: 20px;
  background: rgba(15, 15, 15, 0.7); /* More opaque */
  border-radius: 15px;
  border: 1px solid #333;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.control-group label {
  font-size: 0.9rem;
  color: #ccc;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-group span {
  font-size: 0.8rem;
  color: #aaa;
  font-weight: 500;
  min-height: 16px;
}

.control-slider {
  width: 150px;
  height: 6px;
  background: #333;
  border-radius: 3px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: background 0.3s ease;
}

.control-slider:hover {
  background: #444;
}

/* Webkit slider thumb */
.control-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px; 
  height: 20px;
  background: linear-gradient(45deg, #164141, #1a4b4b);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}
.control-slider::-webkit-slider-thumb:hover {
  background: linear-gradient(45deg, #1a4b4b, #205555);
  transform: scale(1.1);
}

/* Firefox slider thumb */
.control-slider::-moz-range-thumb {
  width: 20px; 
  height: 20px;
  background: linear-gradient(45deg, #164141, #1a4b4b);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}
.control-slider::-moz-range-thumb:hover {
  background: linear-gradient(45deg, #1a4b4b, #205555);
  transform: scale(1.1);
}

/* === Editor Buttons === */
.editor-button,
.upload-button {
  background: transparent;
  border-radius: 12px;
  padding: 12px 24px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  user-select: none;
  border: 2px solid #164141;
}

.editor-button:hover,
.upload-button:hover {
  transform: scale(1.05);
  border-color: #1a4b4b;
  color: #fff;
  box-shadow: 0 5px 15px rgba(22, 65, 65, 0.3);
}

.editor-button:active,
.upload-button:active {
  transform: scale(0.97);
}

.editor-button::before,
.upload-button::before {
  content: '';
  position: absolute;
  top: 0; 
  left: -100%;
  width: 100%; 
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.editor-button:hover::before,
.upload-button:hover::before {
  left: 100%;
}

.editor-button.active {
  background: #164141;
  border-color: #1a4b4b;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.upload-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Upload Loading Spinner */
.upload-button.loading {
  color: transparent;
  position: relative;
}
.upload-button.loading::after {
  content: '';
  position: absolute;
  top: 50%; 
  left: 50%;
  margin: -10px;
  width: 20px; 
  height: 20px;
  border: 2px solid transparent;
  border-top-color: #164141;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* === Editor Action Buttons Group === */
.editor-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* === Crop Overlay === */
.crop-overlay {
  position: absolute;
  border: 2px dashed #164141;
  background: rgba(22, 65, 65, 0.1);
  pointer-events: none;
  display: none;
  backdrop-filter: blur(1px);
}
.crop-overlay::before {
  content: '';
  position: absolute;
  top: -2px; 
  left: -2px;
  right: -2px; 
  bottom: -2px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

/* === Crop Handles === */
.crop-handle {
  position: absolute;
  width: 10px; 
  height: 10px;
  background: #164141;
  border: 2px solid white;
  cursor: pointer;
  transition: all 0.3s ease;
}
.crop-handle:hover {
  background: #1a4b4b;
  transform: scale(1.2);
}

/* === Responsive Tweaks === */
@media screen and (max-width: 768px) {
  .image-editor-container {
    max-width: 95vw;
    max-height: 95vh;
    padding: 15px;
  }
  .editor-canvas-container {
    min-height: 300px;
  }
  .editor-controls {
    gap: 10px;
    padding: 15px;
  }
  .control-group {
    min-width: 100px;
  }
  .control-slider {
    width: 120px;
  }
  .editor-button, 
  .upload-button {
    padding: 10px 16px;
    font-size: 0.8rem;
  }
  .editor-actions {
    gap: 10px;
  }
}

@media screen and (max-width: 480px) {
  .editor-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .control-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-width: auto;
  }
  .control-slider {
    width: 60%;
  }
  .editor-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .editor-button,
  .upload-button {
    width: 100%;
    margin: 5px 0;
  }
}