/* WooCommerce Product Customizer Advanced Styles */

.wpc-customization-wrapper {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  padding: 30px;
  margin: 25px 0;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.wpc-customization-wrapper h3 {
  margin-top: 0;
  margin-bottom: 25px;
  color: #2c3e50;
  font-size: 1.4em;
  font-weight: 600;
  border-bottom: 3px solid #3498db;
  padding-bottom: 12px;
  text-align: center;
}

.wpc-field-group {
  margin-bottom: 25px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.wpc-field-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
  color: #2c3e50;
  font-size: 15px;
}

.wpc-field-group label .required {
  color: #e74c3c;
  margin-left: 3px;
}

.wpc-field-group label .wpc-max-info {
  font-weight: normal;
  color: #6c757d;
  font-size: 13px;
}

.wpc-field-group small {
  display: block;
  color: #6c757d;
  font-size: 12px;
  margin-top: 8px;
}

/* Images Upload Area */
.wpc-images-upload {
  position: relative;
}

.wpc-upload-area {
  margin-bottom: 20px;
}

.wpc-upload-box {
  border: 3px dashed #3498db;
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  background: #f8f9fa;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.wpc-upload-box:hover {
  border-color: #2980b9;
  background: #e3f2fd;
  transform: translateY(-2px);
}

.wpc-upload-box.dragover {
  border-color: #27ae60;
  background: #d5edda;
}

.wpc-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.wpc-upload-text {
  pointer-events: none;
}

.wpc-upload-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 15px;
}

.wpc-upload-text p {
  margin: 8px 0;
  font-size: 16px;
  color: #2c3e50;
}

.wpc-upload-hint {
  font-size: 14px !important;
  color: #6c757d !important;
}

/* Images Preview */
.wpc-images-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.wpc-image-item {
  position: relative;
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.wpc-image-item:hover {
  border-color: #3498db;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wpc-image-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.wpc-image-item .wpc-image-info {
  padding: 8px;
  background: #f8f9fa;
  font-size: 11px;
  color: #6c757d;
  text-align: center;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.wpc-remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wpc-remove-image:hover {
  background: #c0392b;
  transform: scale(1.1);
}

/* Upload Status */
.wpc-upload-status {
  margin-top: 15px;
  padding: 12px;
  border-radius: 6px;
  display: none;
  font-weight: 500;
}

.wpc-upload-status.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  display: block;
}

.wpc-upload-status.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  display: block;
}

.wpc-upload-status.loading {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
  display: block;
}

/* Text Area - Extended */
#wpc_custom_text {
  width: 95%;
  padding: 15px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 120px;
  transition: all 0.3s ease;
}

#wpc_custom_text:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.wpc-char-count {
  text-align: right;
  color: #6c757d;
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}

.wpc-char-count.warning {
  color: #f39c12;
}

.wpc-char-count.danger {
  color: #e74c3c;
}

/* Admin Order Styles */
.wpc-customization {
  min-width: 250px;
  vertical-align: top;
}

.wpc-admin-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.wpc-admin-image {
  text-align: center;
  flex: 0 0 auto;
}

.wpc-admin-image img {
  max-width: 100px;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 5px;
  transition: transform 0.2s ease;
}

.wpc-admin-image img:hover {
  transform: scale(1.05);
}

.wpc-admin-image .button {
  font-size: 11px;
  padding: 4px 8px;
  height: auto;
  line-height: 1.2;
}

/* Progress Bar */
.wpc-progress-bar {
  width: 100%;
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.wpc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  width: 0%;
  transition: width 0.3s ease;
}

/* Error States */
.wpc-field-error {
  border-color: #e74c3c !important;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
}

.wpc-error-message {
  color: #e74c3c;
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  padding: 8px 12px;
  background: #fdf2f2;
  border: 1px solid #fecaca;
  border-radius: 4px;
}

/* Loading States */
.wpc-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(52, 152, 219, 0.2);
  border-radius: 50%;
  border-top-color: #3498db;
  animation: wpc-spin 1s linear infinite;
}

@keyframes wpc-spin {
  to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .wpc-customization-wrapper {
      padding: 20px;
      margin: 20px 0;
  }
  
  .wpc-field-group {
      padding: 15px;
  }
  
  .wpc-upload-box {
      padding: 20px;
  }
  
  .wpc-upload-icon {
      font-size: 36px;
  }
  
  .wpc-images-preview {
      grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
      gap: 10px;
  }
  
  .wpc-image-item img {
      height: 100px;
  }
  
  .wpc-admin-images {
      gap: 8px;
  }
  
  .wpc-admin-image img {
      max-width: 80px;
  }
}

@media (max-width: 480px) {
  .wpc-images-preview {
      grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
      gap: 8px;
  }
  
  .wpc-image-item img {
      height: 80px;
  }
  
  #wpc_custom_text {
      min-height: 100px;
      padding: 12px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .wpc-customization-wrapper {
      background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
      border-color: #4a6741;
      color: #ecf0f1;
  }
  
  .wpc-customization-wrapper h3 {
      color: #ecf0f1;
      border-color: #3498db;
  }
  
  .wpc-field-group {
      background: #34495e;
      border-color: #4a6741;
  }
  
  .wpc-field-group label {
      color: #ecf0f1;
  }
  
  #wpc_custom_text {
      background: #2c3e50;
      border-color: #4a6741;
      color: #ecf0f1;
  }
  
  .wpc-upload-box {
      background: #2c3e50;
      border-color: #3498db;
  }
  
  .wpc-upload-text p {
      color: #ecf0f1;
  }
}

/* Animation for new images */
@keyframes wpc-fade-in {
  from {
      opacity: 0;
      transform: translateY(10px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

.wpc-image-item.new {
  animation: wpc-fade-in 0.5s ease;
}