/* ============================================================
   Image Tools Pro — Main Stylesheet
   Design: Refined dark SaaS, Syne + DM Sans typography
   ============================================================ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --itp-bg:          #0a0a0f;
  --itp-surface:     #111118;
  --itp-surface-2:   #1a1a24;
  --itp-surface-3:   #22222e;
  --itp-border:      rgba(255,255,255,0.07);
  --itp-border-2:    rgba(255,255,255,0.12);

  --itp-text:        #f0f0f8;
  --itp-text-muted:  #8888a8;
  --itp-text-dim:    #5555708;

  --itp-accent:      #6c63ff;
  --itp-accent-2:    #a78bfa;
  --itp-accent-glow: rgba(108,99,255,0.35);
  --itp-green:       #22d3a0;
  --itp-amber:       #fbbf24;
  --itp-pink:        #f472b6;

  --itp-radius:      12px;
  --itp-radius-lg:   20px;
  --itp-shadow:      0 4px 24px rgba(0,0,0,0.4);
  --itp-shadow-lg:   0 12px 48px rgba(0,0,0,0.6);

  --font-display:    'Syne', sans-serif;
  --font-body:       'DM Sans', sans-serif;

  --transition:      all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ───────────────────────────────────────────────── */
.itp-wrap *, .itp-wrap *::before, .itp-wrap *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.itp-wrap {
  font-family: var(--font-body);
  color: var(--itp-text);
  background: var(--itp-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Hub Header ──────────────────────────────────────────── */
.itp-hero {
  position: relative;
  padding: 80px 24px 60px;
  text-align: center;
  overflow: hidden;
}

.itp-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(108,99,255,0.25) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 100%, rgba(167,139,250,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.itp-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(108,99,255,0.15);
  border: 1px solid rgba(108,99,255,0.3);
  color: var(--itp-accent-2);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.itp-hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #ffffff 30%, var(--itp-accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.itp-hero-subtitle {
  font-size: 1.125rem;
  color: var(--itp-text-muted);
  max-width: 520px;
  margin: 0 auto 36px;
  font-weight: 300;
}

/* ── Search Bar ──────────────────────────────────────────── */
.itp-search-wrap {
  max-width: 580px;
  margin: 0 auto;
  position: relative;
}

.itp-search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--itp-text-muted);
  pointer-events: none;
}

.itp-search-input {
  width: 100%;
  background: var(--itp-surface);
  border: 1px solid var(--itp-border-2);
  border-radius: 100px;
  padding: 16px 20px 16px 52px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--itp-text);
  outline: none;
  transition: var(--transition);
  box-shadow: 0 0 0 0 var(--itp-accent-glow);
}

.itp-search-input::placeholder { color: var(--itp-text-muted); }

.itp-search-input:focus {
  border-color: var(--itp-accent);
  box-shadow: 0 0 0 4px var(--itp-accent-glow);
}

/* ── Stats Bar ───────────────────────────────────────────── */
.itp-stats-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  padding: 24px 24px 0;
  border-bottom: 1px solid var(--itp-border);
}

.itp-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 20px;
}

.itp-stat-val {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--itp-accent-2);
}

.itp-stat-lbl {
  font-size: 0.75rem;
  color: var(--itp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Category Tabs ───────────────────────────────────────── */
.itp-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 24px 32px 0;
  border-bottom: 1px solid var(--itp-border);
}

.itp-tab {
  background: transparent;
  border: 1px solid var(--itp-border);
  color: var(--itp-text-muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 100px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.itp-tab:hover {
  border-color: var(--itp-border-2);
  color: var(--itp-text);
  background: var(--itp-surface-2);
}

.itp-tab.active {
  background: var(--itp-accent);
  border-color: var(--itp-accent);
  color: #fff;
  box-shadow: 0 0 20px var(--itp-accent-glow);
}

/* ── Main Content Area ───────────────────────────────────── */
.itp-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ── Section Title ───────────────────────────────────────── */
.itp-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 40px 0 20px;
}

.itp-section-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--itp-text);
}

.itp-section-count {
  font-size: 0.8rem;
  color: var(--itp-text-muted);
  background: var(--itp-surface-2);
  padding: 3px 10px;
  border-radius: 100px;
}

/* ── Tools Grid ──────────────────────────────────────────── */
.itp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ── Tool Card ───────────────────────────────────────────── */
.itp-card {
  position: relative;
  background: var(--itp-surface);
  border: 1px solid var(--itp-border);
  border-radius: var(--itp-radius);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: block;
  overflow: hidden;
}

.itp-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(108,99,255,0.06) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition);
  border-radius: inherit;
}

.itp-card:hover {
  border-color: var(--itp-border-2);
  transform: translateY(-3px);
  box-shadow: var(--itp-shadow);
}

.itp-card:hover::before { opacity: 1; }

.itp-card.popular {
  border-color: rgba(108,99,255,0.25);
}

.itp-card-icon {
  width: 48px;
  height: 48px;
  background: var(--itp-surface-2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 22px;
  transition: var(--transition);
}

.itp-card:hover .itp-card-icon {
  background: rgba(108,99,255,0.15);
}

.itp-card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--itp-text);
  margin-bottom: 8px;
  line-height: 1.3;
}

.itp-card-desc {
  font-size: 0.8rem;
  color: var(--itp-text-muted);
  line-height: 1.55;
}

.itp-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--itp-border);
}

.itp-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

.itp-badge-popular {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
}

.itp-card-arrow {
  color: var(--itp-text-muted);
  transition: var(--transition);
}

.itp-card:hover .itp-card-arrow {
  color: var(--itp-accent-2);
  transform: translateX(4px);
}

/* ── Popular Section ─────────────────────────────────────── */
.itp-popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.itp-popular-card {
  background: linear-gradient(135deg, var(--itp-surface) 0%, rgba(108,99,255,0.08) 100%);
  border: 1px solid rgba(108,99,255,0.2);
}

/* ── Tool Page Layout ────────────────────────────────────── */
.itp-tool-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.itp-tool-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 36px;
}

.itp-tool-icon-lg {
  width: 68px;
  height: 68px;
  background: var(--itp-surface-2);
  border: 1px solid var(--itp-border-2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}

.itp-tool-meta h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.itp-tool-meta p {
  color: var(--itp-text-muted);
  font-size: 0.95rem;
}

/* ── Tool Interface ──────────────────────────────────────── */
.itp-tool-interface {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.itp-tool-interface.full-width {
  grid-template-columns: 1fr;
}

.itp-panel {
  background: var(--itp-surface);
  border: 1px solid var(--itp-border);
  border-radius: var(--itp-radius-lg);
  overflow: hidden;
}

.itp-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--itp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.itp-panel-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--itp-text-muted);
}

.itp-panel-body {
  padding: 24px;
}

/* ── Drop Zone ───────────────────────────────────────────── */
.itp-dropzone {
  border: 2px dashed var(--itp-border-2);
  border-radius: var(--itp-radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.itp-dropzone:hover,
.itp-dropzone.drag-over {
  border-color: var(--itp-accent);
  background: rgba(108,99,255,0.05);
}

.itp-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.itp-dropzone-icon {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
}

.itp-dropzone-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.itp-dropzone-sub {
  font-size: 0.8rem;
  color: var(--itp-text-muted);
}

/* ── Preview Area ────────────────────────────────────────── */
.itp-preview {
  background: var(--itp-surface-2);
  border-radius: var(--itp-radius);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.itp-preview img,
.itp-preview canvas {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 8px;
}

.itp-preview-placeholder {
  color: var(--itp-text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ── Controls ────────────────────────────────────────────── */
.itp-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.itp-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.itp-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--itp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.itp-input,
.itp-select,
.itp-textarea {
  background: var(--itp-surface-2);
  border: 1px solid var(--itp-border-2);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--itp-text);
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.itp-input:focus,
.itp-select:focus,
.itp-textarea:focus {
  border-color: var(--itp-accent);
  box-shadow: 0 0 0 3px var(--itp-accent-glow);
}

.itp-select { cursor: pointer; }
.itp-select option { background: var(--itp-surface-2); }

/* Range Slider */
.itp-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--itp-surface-3);
  border-radius: 100px;
  outline: none;
}

.itp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--itp-accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--itp-accent-glow);
  transition: var(--transition);
}

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

.itp-range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.itp-range-val {
  min-width: 40px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--itp-accent-2);
  font-family: var(--font-display);
  font-weight: 600;
}

/* Toggle Switch */
.itp-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.itp-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.itp-toggle input { opacity: 0; width: 0; height: 0; }

.itp-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--itp-surface-3);
  border-radius: 100px;
  cursor: pointer;
  transition: var(--transition);
}

.itp-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.itp-toggle input:checked + .itp-toggle-slider {
  background: var(--itp-accent);
}

.itp-toggle input:checked + .itp-toggle-slider::before {
  transform: translateX(20px);
}

/* Radio Buttons (as pills) */
.itp-pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.itp-pill-input { display: none; }

.itp-pill-label {
  background: var(--itp-surface-2);
  border: 1px solid var(--itp-border);
  color: var(--itp-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.itp-pill-input:checked + .itp-pill-label {
  background: rgba(108,99,255,0.2);
  border-color: var(--itp-accent);
  color: var(--itp-accent-2);
}

/* ── Buttons ─────────────────────────────────────────────── */
.itp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.itp-btn-primary {
  background: var(--itp-accent);
  color: #fff;
  box-shadow: 0 4px 20px var(--itp-accent-glow);
}

.itp-btn-primary:hover {
  background: #7b72ff;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--itp-accent-glow);
}

.itp-btn-primary:active { transform: translateY(0); }

.itp-btn-secondary {
  background: var(--itp-surface-2);
  border: 1px solid var(--itp-border-2);
  color: var(--itp-text);
}

.itp-btn-secondary:hover {
  background: var(--itp-surface-3);
  border-color: var(--itp-border-2);
}

.itp-btn-outline {
  background: transparent;
  border: 1px solid var(--itp-border-2);
  color: var(--itp-text-muted);
}

.itp-btn-outline:hover {
  border-color: var(--itp-accent);
  color: var(--itp-accent-2);
}

.itp-btn-green {
  background: var(--itp-green);
  color: #0a0a0f;
}

.itp-btn-green:hover { background: #26f0b7; }

.itp-btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.itp-btn-lg { padding: 16px 32px; font-size: 1rem; }
.itp-btn-full { width: 100%; }

.itp-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* Spinner */
.itp-btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: itp-spin 0.7s linear infinite;
  display: none;
}

.itp-btn.loading .spinner { display: block; }
.itp-btn.loading .btn-text { opacity: 0.6; }

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

/* ── Action Bar ──────────────────────────────────────────── */
.itp-action-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* ── Progress / Status ───────────────────────────────────── */
.itp-progress-wrap {
  margin-top: 16px;
  display: none;
}

.itp-progress-wrap.visible { display: block; }

.itp-progress-bar-bg {
  background: var(--itp-surface-2);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
}

.itp-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--itp-accent), var(--itp-accent-2));
  border-radius: 100px;
  transition: width 0.3s ease;
  width: 0%;
}

.itp-progress-label {
  font-size: 0.8rem;
  color: var(--itp-text-muted);
  margin-bottom: 8px;
}

/* ── Toast / Notifications ───────────────────────────────── */
.itp-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.itp-toast {
  background: var(--itp-surface);
  border: 1px solid var(--itp-border-2);
  border-radius: var(--itp-radius);
  padding: 14px 18px;
  color: var(--itp-text);
  font-size: 0.875rem;
  box-shadow: var(--itp-shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: itp-slide-in 0.3s ease;
}

.itp-toast.success { border-left: 3px solid var(--itp-green); }
.itp-toast.error   { border-left: 3px solid #ef4444; }
.itp-toast.info    { border-left: 3px solid var(--itp-accent); }

@keyframes itp-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── File Info Strip ─────────────────────────────────────── */
.itp-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--itp-surface-2);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--itp-text-muted);
  flex-wrap: wrap;
}

.itp-file-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.itp-file-info-item strong { color: var(--itp-text); }

/* ── Comparison Slider ───────────────────────────────────── */
.itp-compare {
  position: relative;
  overflow: hidden;
  border-radius: var(--itp-radius);
  cursor: col-resize;
  user-select: none;
}

.itp-compare-after {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.itp-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  left: 50%;
  cursor: col-resize;
}

.itp-compare-handle::after {
  content: '⟺';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  background: #fff;
  color: #000;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.itp-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--itp-text-muted);
  padding: 20px 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.itp-breadcrumb a {
  color: var(--itp-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.itp-breadcrumb a:hover { color: var(--itp-accent-2); }

.itp-breadcrumb-sep { color: var(--itp-border-2); }

/* ── Color Swatches ──────────────────────────────────────── */
.itp-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.itp-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.itp-swatch.active,
.itp-swatch:hover { border-color: var(--itp-accent); transform: scale(1.1); }

/* ── Batch Table ─────────────────────────────────────────── */
.itp-batch-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.itp-batch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--itp-surface-2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
}

.itp-batch-item-name { flex: 1; color: var(--itp-text); }
.itp-batch-item-size { color: var(--itp-text-muted); font-size: 0.75rem; }

.itp-batch-item-status {
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-pending  { background: rgba(255,255,255,0.07); color: var(--itp-text-muted); }
.status-done     { background: rgba(34,211,160,0.15); color: var(--itp-green); }
.status-error    { background: rgba(239,68,68,0.15);  color: #ef4444; }
.status-working  { background: rgba(108,99,255,0.15); color: var(--itp-accent-2); }

/* ── Metadata Table ──────────────────────────────────────── */
.itp-meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.itp-meta-table tr + tr { border-top: 1px solid var(--itp-border); }
.itp-meta-table th { color: var(--itp-text-muted); text-align: left; padding: 8px 12px 8px 0; font-weight: 500; width: 40%; }
.itp-meta-table td { color: var(--itp-text); padding: 8px 0; word-break: break-all; }

/* ── Color Palette ───────────────────────────────────────── */
.itp-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.itp-palette-swatch {
  aspect-ratio: 1;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}

.itp-palette-swatch:hover { transform: scale(1.05); }

.itp-palette-swatch-label {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 10px;
  padding: 4px;
  text-align: center;
  font-family: monospace;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .itp-tool-interface { grid-template-columns: 1fr; }
  .itp-hero { padding: 48px 16px 40px; }
  .itp-hero-title { font-size: 2rem; }
  .itp-tabs { padding: 16px 16px 0; }
  .itp-main { padding: 0 16px 60px; }
  .itp-stats-bar { gap: 20px; }
  .itp-tool-page { padding: 24px 16px 60px; }
  .itp-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .itp-grid { grid-template-columns: 1fr; }
  .itp-action-bar { flex-direction: column; }
  .itp-btn { width: 100%; }
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes itp-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.itp-card {
  animation: itp-fade-up 0.4s ease both;
}

.itp-card:nth-child(1)  { animation-delay: 0.05s; }
.itp-card:nth-child(2)  { animation-delay: 0.1s; }
.itp-card:nth-child(3)  { animation-delay: 0.15s; }
.itp-card:nth-child(4)  { animation-delay: 0.2s; }
.itp-card:nth-child(5)  { animation-delay: 0.25s; }
.itp-card:nth-child(6)  { animation-delay: 0.3s; }
.itp-card:nth-child(7)  { animation-delay: 0.05s; }
.itp-card:nth-child(8)  { animation-delay: 0.1s; }

/* Scrollbar */
.itp-wrap ::-webkit-scrollbar { width: 6px; height: 6px; }
.itp-wrap ::-webkit-scrollbar-track { background: var(--itp-surface); }
.itp-wrap ::-webkit-scrollbar-thumb { background: var(--itp-surface-3); border-radius: 3px; }
.itp-wrap ::-webkit-scrollbar-thumb:hover { background: var(--itp-border-2); }

/* ── Checkerboard for transparent images ─────────────────── */
.itp-checker-bg {
  background-image: linear-gradient(45deg, #333 25%, transparent 25%),
                    linear-gradient(-45deg, #333 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #333 75%),
                    linear-gradient(-45deg, transparent 75%, #333 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

/* ── No Results State ────────────────────────────────────── */
.itp-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--itp-text-muted);
}

.itp-empty-icon { font-size: 48px; margin-bottom: 12px; }
.itp-empty-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; color: var(--itp-text); }
.itp-empty-sub { font-size: 0.875rem; }


/* ════════════════════════════════════════════════════════════
   AD SLOTS — AdSense Integration
   ════════════════════════════════════════════════════════════ */

/* ── Ad Label ─────────────────────────────────────────────── */
.itp-ad-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--itp-text-muted);
  text-align: center;
  margin-bottom: 4px;
  opacity: 0.6;
}

/* ── Base Ad Slot Container ────────────────────────────────── */
.itp-ad-slot {
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* Ensure adsbygoogle fills its container */
.itp-ad-slot ins.adsbygoogle {
  display: block !important;
  width: 100%;
}

/* ── Leaderboard Banners (top/mid/bottom) ──────────────────── */
.itp-ad-leaderboard {
  width: 100%;
  padding: 12px 0;
  border-top: 1px solid var(--itp-border);
  border-bottom: 1px solid var(--itp-border);
  background: var(--itp-surface);
  margin: 20px 0;
  text-align: center;
}

.itp-ad-leaderboard ins.adsbygoogle {
  min-height: 90px;
}

/* ── Hub Top Banner — above hero ──────────────────────────── */
.itp-ad-hub-banner-top {
  margin: 0 0 8px;
  border-bottom: 1px solid var(--itp-border);
}

/* ── Hub Mid Banner — between sections ─────────────────────── */
.itp-ad-hub-banner-mid {
  margin: 32px 0;
}

/* ── Hub Bottom Banner ──────────────────────────────────────── */
.itp-ad-hub-banner-bottom {
  margin: 32px 0 0;
}

/* ── Tool Above Editor ──────────────────────────────────────── */
.itp-ad-tool-above-editor {
  margin: 0 0 24px;
}

/* ── Tool Below Editor ──────────────────────────────────────── */
.itp-ad-tool-below-editor {
  margin: 32px 0;
}

/* ── Tool Related Mid (in-feed) ─────────────────────────────── */
.itp-ad-tool-related-mid {
  margin: 20px 0;
  grid-column: 1 / -1;
}

.itp-ad-in-feed {
  padding: 16px;
  background: var(--itp-surface);
  border: 1px solid var(--itp-border);
  border-radius: var(--itp-radius);
}

/* ── Rectangle Ads ───────────────────────────────────────────── */
.itp-ad-rectangle ins.adsbygoogle {
  min-height: 250px;
}

/* ── Sidebar Layout ──────────────────────────────────────────── */
.itp-main-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 1024px) {
  .itp-main-with-sidebar {
    grid-template-columns: 1fr;
  }
  .itp-ad-sidebar {
    display: none; /* Hide sidebar on narrow screens — banner ads still show */
  }
}

/* ── Sidebar Ad Unit ─────────────────────────────────────────── */
.itp-ad-sidebar {
  grid-column: 2;
}

.itp-sidebar-sticky {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.itp-sidebar-ad-unit {
  background: var(--itp-surface);
  border: 1px solid var(--itp-border);
  border-radius: var(--itp-radius);
  padding: 12px;
  text-align: center;
}

.itp-sidebar-ad-unit ins.adsbygoogle {
  min-height: 600px; /* Standard sidebar rectangle */
}

/* Sidebar: stack additional slots below if ever needed */
.itp-hub-sidebar .itp-ad-hub-sidebar,
.itp-tool-sidebar .itp-ad-tool-sidebar {
  display: block;
}

/* ── Empty Ad Placeholder (dev/preview mode) ─────────────────── */
.itp-ad-slot[data-preview]::after {
  content: attr(data-slot) ' ad slot';
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  background: repeating-linear-gradient(
    45deg,
    rgba(108,99,255,0.04),
    rgba(108,99,255,0.04) 10px,
    transparent 10px,
    transparent 20px
  );
  border: 1px dashed rgba(108,99,255,0.3);
  border-radius: 6px;
  color: var(--itp-text-muted);
  font-size: 11px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Responsive tweaks ───────────────────────────────────────── */
@media (max-width: 768px) {
  .itp-ad-leaderboard {
    margin: 12px 0;
    padding: 8px 0;
  }

  .itp-ad-leaderboard ins.adsbygoogle {
    min-height: 50px; /* Mobile banner height */
  }

  .itp-ad-tool-above-editor,
  .itp-ad-hub-banner-top {
    margin-bottom: 16px;
  }

  .itp-main-with-sidebar {
    grid-template-columns: 1fr;
  }
}


/* ══════════════════════════════════════════════════════════
   ADSENSE AD ZONES
══════════════════════════════════════════════════════════ */

/* ── Label ──────────────────────────────────────────────── */
.itp-ad-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--itp-text-muted);
  opacity: 0.55;
  text-align: center;
  margin-bottom: 4px;
  font-family: var(--font-display);
}

/* ── Base zone wrapper ───────────────────────────────────── */
.itp-ad-zone {
  width: 100%;
  overflow: hidden;
  /* Prevents layout shift when ad loads */
  min-height: 0;
  transition: min-height 0.2s;
}

/* ── Hub zones ───────────────────────────────────────────── */
.itp-ad-hub-top,
.itp-ad-hub-bottom {
  margin: 24px 0;
  text-align: center;
}

.itp-ad-hub-mid {
  margin: 32px 0;
  text-align: center;
}

/* ── Tool zones ──────────────────────────────────────────── */
.itp-ad-tool-top {
  margin: 16px 0 24px;
  text-align: center;
}

.itp-ad-tool-mid {
  margin: 40px 0;
  text-align: center;
}

.itp-ad-tool-bottom {
  margin: 32px 0 16px;
  text-align: center;
}

.itp-ad-tool-after-result {
  margin: 20px 0;
  text-align: center;
}

/* ── Sidebar zone ─────────────────────────────────────────── */
.itp-ad-tool-sidebar {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
  align-self: flex-start;
  text-align: center;
}

/* Tool page with sidebar layout */
.itp-tool-page-with-sidebar {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.itp-tool-page-with-sidebar .itp-tool-content {
  flex: 1;
  min-width: 0;
}

/* ── Test Mode placeholder ───────────────────────────────── */
.itp-ad-placeholder .itp-ad-test-block {
  background: rgba(108,99,255,0.06);
  border: 2px dashed rgba(108,99,255,0.25);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}

.itp-ad-test-icon { font-size: 1.6rem; }

.itp-ad-test-zone {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--itp-accent-2);
  background: rgba(108,99,255,0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

.itp-ad-test-label {
  font-size: 0.72rem;
  color: var(--itp-text-muted);
  font-weight: 500;
}

.itp-ad-test-suggested {
  font-size: 0.65rem;
  color: var(--itp-text-muted);
  opacity: 0.6;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .itp-tool-page-with-sidebar {
    flex-direction: column;
  }
  .itp-ad-tool-sidebar {
    width: 100%;
    position: static;
    margin: 20px 0;
  }
}

/* Hide adsbygoogle when it has no content (avoid blank space) */
ins.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}
