/**
 * 4.1 Crop Module - CSS Styles
 * Add this as a new snippet in Code Snippets plugin
 */
/* ============================================
   ICC CROP MODULE STYLES
   ============================================ */

/* Crop Wrapper */
.icc-crop-widget-wrapper,
.icc-crop-input-widget-wrapper {
  all: initial;
  display: block !important;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #333;
  contain: layout style;
  isolation: isolate;
  max-width: 100%;
  box-sizing: border-box;
  z-index: 1;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
}

.icc-crop-widget-wrapper *,
.icc-crop-input-widget-wrapper * {
  box-sizing: border-box;
}

/* Hide crop input wrapper by default */
#crop-input-wrapper {
  display: none !important;
}

/* Show wrapper when active class is added */
#crop-input-wrapper.icc-active {
  display: block !important;
}

/* Elementor Overrides */
.elementor-editor-active .icc-crop-widget-wrapper,
.elementor-preview .icc-crop-widget-wrapper,
.elementor-widget-container .icc-crop-widget-wrapper,
body .icc-crop-widget-wrapper {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative;
}

/* Crop Input Container */
.elementor-editor-active #crop-input-container,
.elementor-preview #crop-input-container,
.elementor-widget-container #crop-input-container,
body #crop-input-container {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  text-align: center;
  min-height: 120px;
  position: relative;
  z-index: 10010 !important;
  margin: 0;
  padding: 0;
}

/* Drop Area Styles */
.elementor-editor-active #crop-drop-area,
.elementor-preview #crop-drop-area,
.elementor-widget-container #crop-drop-area,
body #crop-drop-area {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  border: 2px dashed #ddd;
  padding: 30px 20px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 175px !important;
  height: 175px !important;
  max-height: 175px !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #00000069;
  z-index: 10020 !important;
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 650px;
  transition: all 0.3s ease;
}

#crop-drop-area {
  min-height: 250px !important;
  height: 250px !important;
  max-height: 250px !important;
}

#crop-drop-area.dragover {
  border-color: #4CAF50;
  background: #FFFFFF8C;
}

#crop-drop-area p {
  margin: 0;
  font-size: 16px;
  color: #fff;
  pointer-events: none;
  font-weight: 500;
}

#crop-file-input {
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: auto !important;
}

/* Crop Modal Styles */
.icc-crop-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 999999;
  overflow: auto;
  padding: 20px;
}

.icc-crop-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.icc-crop-modal-content {
  background: #fff;
  border-radius: 12px;
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  position: relative;
  padding: 20px;
}

.icc-crop-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.icc-crop-modal-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.icc-crop-close-btn {
  background: #ff4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.icc-crop-close-btn:hover {
  background: #cc0000;
  transform: scale(1.05);
}

.icc-crop-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin-bottom: 20px;
}

.icc-crop-image-area {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.icc-crop-image-wrapper {
  max-width: 100%;
  max-height: 600px;
  position: relative;
}

#icc-crop-image {
  max-width: 100%;
  display: block;
}

.icc-crop-controls {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  overflow-y: auto;
  max-height: 600px;
}

.icc-crop-control-section {
  margin-bottom: 25px;
}

.icc-crop-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.icc-crop-aspect-ratios {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.icc-crop-aspect-btn {
  padding: 10px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
  color: #555;
}

.icc-crop-aspect-btn:hover {
  border-color: #4CAF50;
  background: #f0fff0;
}

.icc-crop-aspect-btn.active {
  border-color: #4CAF50;
  background: #4CAF50;
  color: #fff;
}

.icc-crop-input-group {
  margin-bottom: 15px;
}

.icc-crop-input-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  margin-bottom: 6px;
}

.icc-crop-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icc-crop-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.icc-crop-input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.icc-crop-slider {
  width: 100%;
  margin: 8px 0;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  outline: none;
}

.icc-crop-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: #4CAF50;
  border-radius: 50%;
  cursor: pointer;
}

.icc-crop-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #4CAF50;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.icc-crop-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding-top: 20px;
  border-top: 2px solid #f0f0f0;
}

.icc-crop-apply-btn,
.icc-crop-reset-btn {
  padding: 12px 30px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.icc-crop-apply-btn {
  background: #4CAF50;
  color: #fff;
}

.icc-crop-apply-btn:hover {
  background: #45a049;
  transform: translateY(-2px);
}

.icc-crop-reset-btn {
  background: #ff9800;
  color: #fff;
}

.icc-crop-reset-btn:hover {
  background: #e68900;
  transform: translateY(-2px);
}

/* Crop/Skip Buttons in Output Row */
.icc-crop-action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.icc-crop-btn,
.icc-skip-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.icc-crop-btn {
  background: #2196F3;
  color: #fff;
}

.icc-crop-btn:hover {
  background: #1976D2;
  transform: translateY(-1px);
}

.icc-crop-btn.cropped {
  background: #4CAF50;
  pointer-events: none;
}

.icc-crop-btn.cropped::before {
  content: '✓ ';
}

.icc-skip-btn {
  background: #9e9e9e;
  color: #fff;
}

.icc-skip-btn:hover {
  background: #757575;
  transform: translateY(-1px);
}

.icc-skip-btn.skipped {
  background: #ff9800;
  pointer-events: none;
}

/* Responsive Design */
@media (max-width: 968px) {
  .icc-crop-container {
    grid-template-columns: 1fr;
  }
  
  .icc-crop-controls {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .elementor-editor-active #crop-drop-area,
  .elementor-preview #crop-drop-area,
  .elementor-widget-container #crop-drop-area,
  body #crop-drop-area {
    min-height: 150px !important;
    height: 150px !important;
    max-height: 150px !important;
    padding: 20px 15px;
  }
  
  #crop-drop-area {
    min-height: 150px !important;
    height: 150px !important;
    max-height: 150px !important;
  }
  
  .icc-crop-modal {
    padding: 10px;
  }
  
  .icc-crop-modal-content {
    padding: 15px;
  }
  
  .icc-crop-aspect-ratios {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  
  .icc-crop-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .elementor-editor-active #crop-drop-area,
  .elementor-preview #crop-drop-area,
  .elementor-widget-container #crop-drop-area,
  body #crop-drop-area {
    min-height: 120px !important;
    height: 120px !important;
    max-height: 120px !important;
    padding: 15px 10px;
  }
  
  #crop-drop-area {
    min-height: 120px !important;
    height: 120px !important;
    max-height: 120px !important;
  }
  
  #crop-drop-area p {
    font-size: 14px;
  }
  
  .icc-crop-aspect-btn {
    padding: 8px;
    font-size: 11px;
  }
}