/* @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap'); */

:root {
  --primary-color: #e1306c;
  --primary-gradient: linear-gradient(135deg, #f99f1b 0%, #e1306c 50%, #833ab4 100%);
  --primary-gradient-hover: linear-gradient(135deg, #fbc02d 0%, #f43f5e 50%, #a855f7 100%);
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 0;
  min-height: 100vh;
}

/* Header */
header {
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(225, 48, 108, 0.3);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.header-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  background-color: #f1f5f9;
}

/* Main Container */
main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 2rem;
  align-items: start;
}

/* Control Panel */
.panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 90px;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title svg {
  width: 20px;
  height: 20px;
  color: var(--primary-color);
}

/* File Upload Area */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  background-color: #fafbfc;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary-color);
  background-color: rgba(225, 48, 108, 0.02);
  transform: translateY(-2px);
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.upload-area:hover .upload-icon {
  color: var(--primary-color);
}

.upload-text {
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 500;
}

.upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Image Info Pill */
.image-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: #f1f5f9;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-main);
}

.image-info .btn-remove {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.image-info .btn-remove:hover {
  text-decoration: underline;
}

/* Slider Controls */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.control-val {
  font-weight: 700;
  color: var(--primary-color);
}

.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  transition: background var(--transition-fast);
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-gradient);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-gradient);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition-fast);
}

.range-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.btn-grid-preset {
  background: none;
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.btn-grid-preset:hover, .btn-grid-preset.active {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background-color: rgba(225, 48, 108, 0.04);
}

.presets-container {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Action Buttons */
.btn-primary {
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(225, 48, 108, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(225, 48, 108, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background-color: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #e2e8f0;
  border-color: var(--border-hover);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Middle Preview Card & Grid Container */
.preview-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.card-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Image Workspace & Overlay */
.preview-workspace {
  position: relative;
  background-color: #f1f5f9;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  max-height: 600px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
}

.image-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 600px;
}

.preview-image {
  max-width: 100%;
  max-height: 600px;
  display: block;
  object-fit: contain;
}

/* Placeholder Art */
.placeholder-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  width: 100%;
  height: 100%;
  min-height: 380px;
  position: relative;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f8fafc 100%);
}

.placeholder-mockup {
  width: 220px;
  height: 220px;
  border-radius: 20px;
  background: white;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.placeholder-mockup-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
}

.placeholder-mockup-inner svg {
  width: 60px;
  height: 60px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

/* Grid Overlay on Preview */
.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

.grid-line-h, .grid-line-v {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-fast);
}

.grid-line-h {
  left: 0;
  right: 0;
  height: 1.5px;
}

.grid-line-v {
  top: 0;
  bottom: 0;
  width: 1.5px;
}

/* Grid overlay text label */
.grid-label {
  position: absolute;
  background-color: rgba(15, 23, 42, 0.7);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  transform: translate(5px, 5px);
  backdrop-filter: blur(4px);
}

/* Results Output Card */
.results-card {
  animation: fadeIn var(--transition-normal);
}

.grid-results {
  display: grid;
  gap: 8px;
  margin-top: 1.5rem;
  background-color: #f1f5f9;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  justify-content: center;
}

.result-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: #e2e8f0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.result-tile:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
  z-index: 5;
}

.result-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Download Overlay on Hover */
.tile-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.result-tile:hover .tile-overlay {
  opacity: 1;
}

.btn-tile-download {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: white;
  border: none;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.btn-tile-download:hover {
  transform: scale(1.1);
  background-color: var(--primary-color);
  color: white;
}

.btn-tile-download svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Bottom Actions (Zip Download) */
.results-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.tile-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background-color: rgba(15, 23, 42, 0.6);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #f1f5f9;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
}

.loading-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: #0f172a;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 10000;
  transition: transform var(--transition-normal);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast svg {
  width: 16px;
  height: 16px;
  color: #10b981;
}

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

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

/* SEO Friendly Helper Utilities */
.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;
}

/* Responsive Adaptations */
@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1rem auto;
  }
  
  header {
    padding: 1rem;
  }
  
  .panel {
    position: static;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .preview-workspace {
    min-height: 280px;
  }
  
  .placeholder-mockup {
    width: 160px;
    height: 160px;
  }
}

/* SEO Article styling */
.seo-article-section {
  max-width: 1200px;
  margin: 0 auto 4rem auto;
  padding: 0 1.5rem;
}

.article-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem;
  box-shadow: var(--shadow-md);
}

.article-content h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.article-content h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.article-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.article-content ul, .article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.feature-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  background-color: #fafbfc;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feature-item:hover {
  transform: translateY(-3px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
  background-color: white;
}

.feature-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(225, 48, 108, 0.08);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-icon-wrapper svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.feature-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (max-width: 768px) {
  .article-card {
    padding: 1.75rem;
  }
}

.lang-switch {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  background-color: var(--bg-card);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.lang-switch:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background-color: rgba(225, 48, 108, 0.04);
}
