/**
 * Image Resizer Tool Styles
 * Specific styles for resizing, cropping, and preview functionality
 */

/* ========== TOOL LAYOUT ========== */
.tool-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-lg);
}

.tool-header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.tool-title {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-md);
}

.tool-description {
  font-size: 1.125rem;
  color: var(--gray);
  max-width: 600px;
  margin: 0 auto;
}

/* ========== WORKSPACE ========== */
.workspace {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

.main-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  
  .side-panel {
    order: -1;
  }
}

/* ========== IMAGE PREVIEW ========== */
.preview-area {
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.preview-image {
  max-width: 100%;
  max-height: 600px;
  display: block;
  border-radius: var(--radius-sm);
}

.preview-empty {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--gray);
}

.preview-empty-icon {
  font-size: 4rem;
  color: var(--light-gray);
  margin-bottom: var(--spacing-md);
}

/* ========== FOCUS POINT ========== */
.focus-point-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.focus-circle {
  position: absolute;
  width: 100px;
  height: 100px;
  border: 3px solid var(--primary);
  border-radius: 50%;
  background: rgba(108, 92, 231, 0.1);
  cursor: move;
  pointer-events: all;
  transition: transform 0.1s;
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.3);
}

.focus-circle:hover {
  transform: scale(1.1);
  border-color: var(--primary-dark);
}

.focus-circle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ========== PRESET SELECTOR ========== */
.preset-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.preset-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
  max-height: 400px;
  overflow-y: auto;
  padding-right: var(--spacing-sm);
}

.preset-grid::-webkit-scrollbar {
  width: 6px;
}

.preset-grid::-webkit-scrollbar-track {
  background: var(--bg-gray);
  border-radius: var(--radius-sm);
}

.preset-grid::-webkit-scrollbar-thumb {
  background: var(--light-gray);
  border-radius: var(--radius-sm);
}

.preset-grid::-webkit-scrollbar-thumb:hover {
  background: var(--gray);
}

.preset-item {
  padding: 12px 16px;
  background: var(--bg-gray);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preset-item:hover {
  background: #e8e7ff;
  border-color: var(--primary-light);
}

.preset-item.active {
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(162, 155, 254, 0.1));
  border-color: var(--primary);
}

.preset-name {
  font-weight: 600;
  color: var(--dark);
}

.preset-dimensions {
  font-size: 0.875rem;
  color: var(--gray);
  font-family: var(--font-mono);
}

/* ========== CUSTOM DIMENSIONS ========== */
.dimensions-input {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.dimension-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.dimension-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray);
}

.dimension-input {
  padding: 10px 12px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-mono);
  text-align: center;
}

.dimension-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* ========== CROP MODE SELECTOR ========== */
.crop-mode-selector {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.crop-mode-btn {
  flex: 1;
  padding: 10px;
  background: var(--bg-gray);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray);
}

.crop-mode-btn:hover {
  background: #e8e7ff;
  color: var(--primary);
}

.crop-mode-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary-dark);
}

/* ========== FORMAT & QUALITY ========== */
.format-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.format-btn {
  padding: 10px;
  background: var(--bg-gray);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray);
  text-align: center;
}

.format-btn:hover {
  background: #e8e7ff;
  color: var(--primary);
}

.format-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary-dark);
}

.quality-slider {
  margin-bottom: var(--spacing-lg);
}

.quality-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

.quality-value {
  font-family: var(--font-mono);
  color: var(--primary);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-gray);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-md);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-md);
}

/* ========== ACTION BUTTONS ========== */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.btn-full {
  width: 100%;
}

/* ========== RESULTS SECTION ========== */
.results-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  margin-top: var(--spacing-xl);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-lg);
}

.result-card {
  background: var(--bg-gray);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s;
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.result-preview {
  width: 100%;
  height: 150px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.result-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.result-info {
  padding: var(--spacing-md);
}

.result-name {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: var(--spacing-xs);
}

.result-size {
  font-size: 0.75rem;
  color: var(--gray);
  font-family: var(--font-mono);
}

/* ========== LOADING STATE ========== */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: var(--radius-md);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--bg-gray);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  margin-top: var(--spacing-md);
  font-weight: 600;
  color: var(--primary);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .tool-title {
    font-size: 2rem;
  }
  
  .dimensions-input {
    grid-template-columns: 1fr;
  }
  
  .format-selector {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
