/* Crop page styles */
.crop-card {
  border: 1px solid var(--light-border);
  background: var(--light-card);
  border-radius: 14px;
  padding: 28px;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.crop-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


.crop-settings {
  background: rgba(15, 23, 42, 0.02);
  border: 1px solid var(--light-border);
  border-radius: 12px;
  padding: 28px;
  transition: all 0.3s ease;
}

.crop-settings:hover {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(91, 140, 255, 0.2);
}

.crop-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .crop-controls-grid {
    grid-template-columns: 1fr;
  }
}

.control-group {
  position: relative;
}

.control-group label {
  transition: color 0.2s ease;
}

.control-group:focus-within label {
  color: var(--primary-500);
  font-weight: 700;
}

.form-control, .form-select {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0b1220;
  transition: all 0.2s ease;
  border-radius: 6px;
}

.form-control:hover, .form-select:hover {
  border-color: #cbd5e1;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 0.2rem rgba(91, 140, 255, 0.25);
  outline: none;
}

.form-range {
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  transition: background 0.2s ease;
}

.form-range:hover {
  background: #cbd5e1;
}

.form-range:focus {
  background: var(--primary-500);
  opacity: 1;
}

.form-range::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary-500);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.form-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary-500);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-range::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.preset-btn {
  font-size: 14px;
  padding: 8px 16px;
  transition: all 0.2s ease;
  border-radius: 6px;
  font-weight: 500;
}

.preset-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.preset-btn:active {
  transform: translateY(0);
}

.btn-primary {
  transition: all 0.2s ease;
  border-radius: 8px;
  font-weight: 600;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 140, 255, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  transition: all 0.2s ease;
  border-radius: 8px;
}

.btn-ghost:hover {
  background: rgba(91, 140, 255, 0.1);
  transform: translateY(-1px);
}

/* Canvas hover effects */
#canvasContainer:hover {
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.2);
}

/* Processing overlay improvements */
#processingOverlay {
  animation: fadeIn 0.3s ease;
}

#processingOverlay > div {
  animation: pulse 2s ease-in-out infinite;
}

/* Success view improvements */
#successView {
  animation: slideInUp 0.4s ease;
}

#croppedImg {
  transition: all 0.3s ease;
  cursor: pointer;
}

#croppedImg:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Form check improvements */
.form-check-input:checked {
  background-color: var(--primary-500);
  border-color: var(--primary-500);
}

.form-check-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 0.2rem rgba(91, 140, 255, 0.25);
}

/* Animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-20px) rotate(120deg);
  }
  66% {
    transform: translateY(10px) rotate(240deg);
  }
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

@keyframes titleGlow {
  0%, 100% {
    transform: scaleX(0);
  }
  50% {
    transform: scaleX(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

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

/* Loading states */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn:disabled:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Tooltip styles */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 200px;
  background-color: rgba(15, 23, 42, 0.9);
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px 12px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
  line-height: 1.4;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Dark theme overrides */
.crop-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)) !important;
  border-color: var(--border-700) !important;
}


.crop-settings {
  border-color: var(--border-700) !important;
  background: rgba(255, 255, 255, 0.02) !important;
}

.crop-settings:hover {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(91, 140, 255, 0.3) !important;
}

.form-control, .form-select {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-700);
  color: var(--text-100);
}

.form-control:hover, .form-select:hover {
  border-color: var(--border-600);
}

.form-control:focus, .form-select:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-400);
  color: var(--text-100);
}

.form-range {
  background: var(--border-700);
}

.form-range:hover {
  background: var(--border-600);
}

.form-range:focus {
  background: var(--primary-400);
}

.tooltip .tooltiptext {
  background-color: rgba(15, 23, 42, 0.95);
}

/* Mobile improvements */
@media (max-width: 768px) {
  .crop-card {
    padding: 20px;
  }

  #dropZone {
    padding: 50px 20px;
    border-radius: 12px;
    max-width: 90vw;
  }

  #main {
    padding-top: 40px !important;
  }

  #dropZone > div > div:first-child > div {
    width: 80px;
    height: 80px;
  }

  #dropZone > div > div:first-child > div svg {
    width: 36px;
    height: 36px;
  }

  #dropZone p {
    font-size: 16px !important;
    padding: 0 12px;
  }

  #dropZone .btn-primary {
    padding: 14px 24px !important;
    font-size: 16px !important;
  }

  #dropZone > div > div:nth-child(3) {
    flex-direction: column;
    gap: 16px;
  }

  #dropZone > div > div:nth-child(4) {
    flex-direction: column;
    gap: 12px;
  }

  .crop-settings {
    padding: 20px;
  }

  #canvasContainer {
    max-width: 100%;
  }

  .btn {
    width: 100%;
    margin-bottom: 8px;
  }

  .preset-btn {
    flex: 1;
    min-width: 0;
  }
}

/* Beautiful Upload Area Styles */
#dropZone {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 50%, rgba(240, 147, 251, 0.03) 100%);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.1);
  max-width: 1200px;
  margin: 0 auto;
  overflow: hidden;
}

#dropZone:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.08) 50%, rgba(240, 147, 251, 0.05) 100%);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
}

#dropZone.drag {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.1) 50%, rgba(240, 147, 251, 0.08) 100%);
  box-shadow: 0 16px 48px rgba(102, 126, 234, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(91, 140, 255, 0.5) !important;
}

.btn-primary:active {
  transform: translateY(0);
}


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

/* Focus management */
.focus-visible:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-500);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 1000;
  border-radius: 4px;
}

.skip-link:focus {
  top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  #dropZone {
    border-width: 3px;
  }

  #dropZone:hover {
    border-color: var(--primary-300);
  }

  .form-control:focus {
    border-width: 2px;
  }
}

/* Editor Layout */
.editor-layout {
  display: grid !important;
  grid-template-columns: 1fr 320px !important;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.editor-canvas-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  order: 1;
}

.editor-controls-section {
  width: 320px;
  display: block !important;
  order: 2;
  height: fit-content;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.02) 100%);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

/* Canvas Container */
#canvasContainer {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 300px;
  max-height: 600px;
  overflow: hidden;
  border: 2px solid rgba(102, 126, 234, 0.2);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
}

#cropCanvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
  max-height: 600px;
  cursor: crosshair;
  border-radius: 14px;
  object-fit: contain;
  image-rendering: crisp-edges;
}

#imageDimensions {
  margin-top: 12px;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
  border: 1px solid rgba(102, 126, 234, 0.15);
  border-radius: 8px;
  font-size: 13px;
  color: var(--light-text);
  font-weight: 500;
  text-align: center;
  display: inline-block;
}

.control-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
  transition: all 0.2s ease;
}

.editor-controls-section .control-card:last-child {
  margin-bottom: 0;
}

.control-card:hover {
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
  transform: translateY(-1px);
}

.control-card h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--light-text);
  text-align: center;
}

.control-input-group {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.control-input-group .form-control {
  border-radius: 4px;
  padding: 4px 6px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 11px;
}

.control-input-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--light-text);
}

.enhanced-input {
  font-size: 14px !important;
  font-weight: 500 !important;
  padding: 8px 10px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(59, 130, 246, 0.4) !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: var(--light-text) !important;
}

.enhanced-input:focus {
  border-color: var(--primary-500) !important;
  box-shadow: 0 0 0 0.2rem rgba(91, 140, 255, 0.25) !important;
  background: rgba(255, 255, 255, 1) !important;
}

.control-card .form-range {
  margin-bottom: 6px;
}

.control-card .form-check {
  margin: 0;
}

.control-card .form-check-label {
  font-weight: 500;
  font-size: 13px;
  color: var(--light-text);
}



.preset-btn {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.08) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  border-radius: 6px;
  padding: 6px 8px;
  font-weight: 600;
  font-size: 11px;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}


.crop-action-btn {
  padding: 10px 16px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
  border: none !important;
  color: white !important;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3) !important;
  transition: all 0.3s ease !important;
}

.crop-action-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

.zoom-controls-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.zoom-btn {
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  min-width: 36px;
  border-radius: 6px;
}

.zoom-display {
  font-size: 14px;
  font-weight: 600;
  color: var(--light-text);
  min-width: 50px;
  text-align: center;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.action-btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .editor-layout {
    grid-template-columns: 1fr 280px;
    gap: 20px;
  }

  .editor-controls-section {
    width: 280px;
  }
}

@media (max-width: 1024px) {
  .editor-layout {
    grid-template-columns: 1fr 260px;
    gap: 18px;
  }

  .editor-controls-section {
    width: 260px;
  }
}

@media (max-width: 900px) {
  .editor-layout {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  .editor-controls-section {
    width: 100%;
    display: flex !important;
    flex-direction: column;
    gap: 16px;
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
  }

  .control-card {
    width: 100%;
    min-width: unset;
  }
}

@media (max-width: 768px) {
  .editor-layout {
    gap: 16px;
  }

  .control-card {
    padding: 12px;
    min-width: 200px;
  }

  .preset-grid {
    gap: 4px;
  }

  .preset-btn {
    padding: 4px 6px;
    font-size: 10px;
  }

  .editor-controls-section {
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .editor-layout {
    gap: 12px;
  }

  .control-card {
    width: 100%;
    min-width: unset;
    padding: 10px;
  }

  .control-card h4 {
    font-size: 14px;
    margin-bottom: 8px;
  }

  #canvasContainer {
    min-height: 300px;
    max-height: 70vh;
    margin-bottom: 8px;
  }

  #cropCanvas {
    max-height: 70vh !important;
  }

  .control-input-group {
    flex-direction: column;
    gap: 6px;
  }

  .control-input-group .form-control {
    width: 100%;
  }

  .control-card .form-range {
    width: 100%;
    margin-bottom: 8px;
  }
}

/* Success Modal */
.success-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.success-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.success-message {
  text-align: center;
  margin-bottom: 24px;
}

.success-message #success-heading {
  font-size: 24px;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 8px;
}

.success-message #successDimensions {
  font-size: 16px;
  color: #6b7280;
  font-weight: 500;
}

.success-image {
  margin-bottom: 24px;
  width: 100%;
  text-align: center;
}

.success-image img {
  max-width: 100%;
  max-height: 300px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.success-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

.success-actions .btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
}

.success-actions .btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  border: none;
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.success-actions .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.success-actions .btn-ghost {
  border: 2px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
}

.success-actions .btn-ghost:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* Mobile responsive for success modal */
@media (max-width: 640px) {
  .success-modal-content {
    padding: 24px;
    width: 95%;
  }

  .success-actions {
    flex-direction: column;
  }

  .success-actions .btn {
    width: 100%;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}