/* ai-tool.css: Styling for the AI Image Enhancer widget. */
/* The page wraps the widget in the shared .card frame, so the widget adds no frame of its own. */
.ai-tool {
  background: none;
  border: 0;
  padding: 0;
  box-shadow: none;
}

.ai-drop[hidden] { display: none; }
.ai-preview { margin: 0 0 16px; }
.ai-preview-img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ai-preview-caption { margin-top: 6px; font-size: .85rem; color: var(--muted); }

.ai-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px 28px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s, background .2s, box-shadow .2s;
  display: block;
}
.ai-drop:hover, .ai-drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px rgba(15,110,86,.12);
}
.ai-drop input[type=file] { display: none; }
.ai-drop strong { display: block; margin-bottom: 6px; font-size: 1.1rem; }
.ai-drop-icon { display: block; margin: 0 auto 12px; color: var(--muted); }
.ai-privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 0;
  font-size: .84rem;
  font-weight: 600;
  color: var(--accent);
}

/* Control Options */
.ai-options {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-label {
  display: block;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: 8px;
  color: var(--text);
}

.ai-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 500px) {
  .ai-modes { grid-template-columns: 1fr; }
}

.ai-mode-btn {
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all .2s;
}
.ai-mode-btn strong { display: block; font-size: .95rem; margin-bottom: 2px; }
.ai-mode-btn span { display: block; font-size: .8rem; color: var(--muted); }
.ai-mode-btn:hover { border-color: var(--accent); }
.ai-mode-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.ai-mode-btn[aria-pressed="true"] span { color: var(--accent); }

/* Progress Container */
.ai-progress-wrap {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ai-progress-item { margin-bottom: 12px; }
.ai-progress-item:last-child { margin-bottom: 0; }
.ai-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: .86rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.ai-progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.ai-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .2s ease-out;
}

/* Action buttons */
.ai-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}
.ai-btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: 0;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.ai-btn-primary:hover { filter: brightness(1.08); }
.ai-btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
}
.ai-btn-secondary:hover { border-color: var(--muted); }

/* Interactive Before / After Split Slider */
.ai-compare-container {
  margin-top: 24px;
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  user-select: none;
}
.ai-compare-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 500px;
  overflow: hidden;
}
.ai-compare-img {
  pointer-events: none;
  user-select: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ai-compare-overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  clip-path: inset(0 50% 0 0);
}
.ai-compare-overlay .ai-compare-img {
  width: 100%;
  height: 100%;
  max-width: none;
}
.ai-compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  color: #111;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 10;
}
.ai-badge {
  position: absolute;
  top: 10px;
  padding: 4px 10px;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  z-index: 5;
}
.ai-badge-before { left: 10px; }
.ai-badge-after { right: 10px; }

/* Stats banner */
.ai-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .9rem;
}
.ai-stat-box label { display: block; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.ai-stat-box div { font-weight: 600; color: var(--text); font-size: 1.05rem; }

.ai-err {
  margin-top: 16px;
  background: var(--warn-bg);
  border: 1px solid var(--border);
  color: var(--warn-text);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .92rem;
}
