/* ==========================================================================
   tool.css — tool page: panels, dropzone, output & its loading state
   ========================================================================== */

.tool {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--space-5);
}

/* --- Panel (shared shell for form + output) ------------------------------- */
.panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  /* Below ~360px the title plus both actions no longer fit on one line; without
     this the panel's overflow:hidden would clip the Download button. */
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.panel__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
}
.panel__title .icon { width: 16px; height: 16px; color: var(--text-subtle); }
.panel__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5);
}
.panel__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

/* --- Dropzone ------------------------------------------------------------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 180px;
  padding: var(--space-6);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.015);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t), background-color var(--t), transform var(--t);
}
.dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone.is-dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.01);
}
.dropzone.has-file { border-style: solid; border-color: rgba(52, 211, 153, 0.4); }

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--space-2);
  border-radius: 50%;
  background: var(--gradient-soft);
  color: var(--primary);
  transition: transform var(--t);
}
.dropzone:hover .dropzone__icon { transform: translateY(-3px); }
.dropzone__title { font-size: var(--text-base); font-weight: 600; }
.dropzone__hint { font-size: var(--text-sm); color: var(--text-subtle); }
.dropzone__file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-top: var(--space-2);
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success);
  font-size: var(--text-sm);
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropzone__file .icon { width: 14px; height: 14px; }

/* --- Output --------------------------------------------------------------- */
.tool__output { position: sticky; top: calc(var(--header-h) + var(--space-6)); }

.output {
  min-height: 240px;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  animation: slide-up var(--t) both;
}
.output--mono { font-family: var(--font-mono); font-size: var(--text-sm); }

/* Skeleton stands in for the result while a run is "processing". */
.output-loading {
  min-height: 240px;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
}

/* --- Result variants (stats · image · note · error) ----------------------- */
.output-stats { display: flex; flex-direction: column; padding: var(--space-2) var(--space-5); }
.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: 0; }
.stat-row__label { color: var(--text-subtle); font-size: var(--text-sm); }
.stat-row__value {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
  word-break: break-word;
}

.output-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  text-align: center;
}
.output-image img {
  max-width: 100%;
  max-height: 420px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  /* checkerboard so transparency is visible */
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.05) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.output-image__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  justify-content: center;
  color: var(--text-subtle);
  font-size: var(--text-sm);
}
.output-image__meta b { color: var(--text-secondary); font-weight: 600; }

.output__note {
  padding: 0 var(--space-5) var(--space-4);
  color: var(--text-subtle);
  font-size: var(--text-sm);
}
.output.is-error {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.32);
  background: rgba(244, 63, 94, 0.06);
}

/* --- Saran Fitur page ----------------------------------------------------- */
.suggest { width: 100%; max-width: 640px; margin: 0 auto; }
.field__opt { color: var(--text-subtle); font-weight: 400; font-size: var(--text-sm); }

/* WhatsApp-green CTA (overrides .btn--primary; loaded after components.css). */
.btn--whatsapp { background: #25d366; border-color: #25d366; color: #05310f; }
.btn--whatsapp:hover { background: #1fb457; border-color: #1fb457; }
.btn--whatsapp .icon { color: currentColor; }
