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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

h1 {
  font-size: 2rem;
  color: #4caf50;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: #888;
  margin-bottom: 1.5rem;
}

h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #ccc;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  padding: 0.5rem 1.25rem;
  border: 1px solid #333;
  background: #1a1a1a;
  color: #aaa;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}

.tab.active {
  background: #222;
  color: #4caf50;
  border-bottom-color: #222;
}

/* Panels */
.panel {
  display: none;
  background: #222;
  border: 1px solid #333;
  border-radius: 0 6px 6px 6px;
  padding: 1.5rem;
}

.panel.active {
  display: block;
}

/* Dropzone */
.dropzone {
  border: 2px dashed #444;
  border-radius: 8px;
  padding: 2.5rem 1rem;
  text-align: center;
  color: #666;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone.dragover {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.05);
}

/* Preview */
.preview {
  margin-top: 1rem;
  text-align: center;
}

.preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
}

.preview p {
  margin-top: 0.5rem;
  color: #888;
  font-size: 0.85rem;
}

/* URL input */
#url-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #444;
  border-radius: 6px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 1rem;
  margin-bottom: 1rem;
}

#url-input:focus {
  outline: none;
  border-color: #4caf50;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: background 0.2s;
}

.btn:hover {
  background: #43a047;
}

.btn:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}

.btn-secondary {
  background: #444;
  color: #ccc;
}

.btn-secondary:hover {
  background: #555;
}

.btn-accent {
  background: #e65100;
}

.btn-accent:hover {
  background: #f4721a;
}

.btn-ghibli {
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  color: #fff;
}

.btn-ghibli:hover {
  background: linear-gradient(135deg, #7b1fd4, #3a85fd);
}

.btn-ghibli:disabled {
  background: #333;
  color: #666;
}

/* Status */
.status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.status.success {
  background: rgba(76, 175, 80, 0.15);
  color: #4caf50;
}

.status.error {
  background: rgba(244, 67, 54, 0.15);
  color: #f44336;
}

/* ─── Beautification Studio ─────────────────────────────────────── */

.beautify-studio {
  margin-top: 2rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 1.5rem;
}

.beautify-studio h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: #e65100;
}

/* Cuisine Badge */
.cuisine-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.badge-label {
  color: #888;
  font-size: 0.85rem;
}

.badge-type {
  background: #e65100;
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-quality {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-quality.good {
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
}

.badge-quality.low {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
}

/* Before / After Comparison */
.comparison-container {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.comparison-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #333;
}

.comparison-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.comparison-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: #fff;
  padding: 1.5rem 0.75rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.comparison-divider {
  width: 2px;
  min-height: 200px;
  background: #444;
  align-self: stretch;
  flex-shrink: 0;
}

/* Controls */
.beautify-controls {
  margin-top: 1rem;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.slider-group label {
  color: #aaa;
  font-size: 0.9rem;
  white-space: nowrap;
}

.slider-group input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #333;
  border-radius: 3px;
  outline: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e65100;
  cursor: pointer;
  border: 2px solid #ff8a50;
  transition: transform 0.15s;
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e65100;
  cursor: pointer;
  border: 2px solid #ff8a50;
}

.slider-group span {
  color: #e65100;
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 36px;
  text-align: right;
}

.beautify-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Processing Indicator */
.processing-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(230, 81, 0, 0.1);
  border-radius: 6px;
  color: #ff9800;
  font-size: 0.9rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(230, 81, 0, 0.3);
  border-top-color: #e65100;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ─── Style Panel ──────────────────────────────────────────────── */

.style-panel {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #333;
}

.style-panel-title {
  color: #ccc;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  margin-top: 0;
}

.style-section {
  margin-bottom: 1.25rem;
}

.style-section-title {
  color: #aaa;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ai-badge {
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-note {
  color: #666;
  font-size: 0.75rem;
  font-weight: 400;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}

.style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  background: #222;
  border: 2px solid #333;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  text-align: center;
}

.style-card:hover {
  border-color: #555;
  background: #2a2a2a;
  transform: translateY(-1px);
}

.style-card.active {
  border-color: #e65100;
  background: rgba(230, 81, 0, 0.1);
}

.style-card:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

.style-card-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.style-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #ddd;
}

.style-card-desc {
  font-size: 0.7rem;
  color: #777;
  line-height: 1.3;
}

.style-card-ai {
  border-color: rgba(106, 17, 203, 0.3);
}

.style-card-ai:hover {
  border-color: rgba(106, 17, 203, 0.6);
}

.style-card-ai.active {
  border-color: #7b1fd4;
  background: rgba(106, 17, 203, 0.1);
}

.ai-badge-small {
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ─── AI Glowup Result ──────────────────────────────────────────── */

.glowup-result {
  margin-top: 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, rgba(106, 17, 203, 0.1), rgba(37, 117, 252, 0.1));
  border: 1px solid rgba(106, 17, 203, 0.3);
  border-radius: 10px;
  padding: 1.5rem;
}

.glowup-result h3 {
  color: #a78bfa;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.glowup-result img {
  max-width: 100%;
  max-height: 500px;
  border-radius: 8px;
  border: 2px solid rgba(106, 17, 203, 0.3);
}

.glowup-actions {
  margin-top: 1rem;
}

/* ─── Gallery ───────────────────────────────────────────────────── */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a1a;
  border: 1px solid #333;
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.gallery-item-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-item:hover .gallery-item-actions {
  opacity: 1;
}

.gallery-item .delete-btn,
.gallery-item .beautify-btn {
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.gallery-item .delete-btn {
  color: #f44336;
}

.gallery-item .delete-btn:hover {
  background: rgba(244, 67, 54, 0.3);
}

.gallery-item .beautify-btn {
  color: #ff9800;
}

.gallery-item .beautify-btn:hover {
  background: rgba(255, 152, 0, 0.3);
}

.empty-msg {
  color: #555;
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 0;
}

/* Responsive */
@media (max-width: 600px) {
  .comparison-container {
    flex-direction: column;
    align-items: center;
  }
  .comparison-wrapper {
    max-width: 100%;
  }
  .comparison-divider {
    width: 80%;
    height: 2px;
    min-height: auto;
  }
  .slider-group {
    flex-wrap: wrap;
  }
  .beautify-actions {
    flex-direction: column;
  }
  .beautify-actions .btn {
    width: 100%;
    text-align: center;
  }
  .style-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
