/* TOOL WRAPPER */
.tool {
  background: radial-gradient(circle at top, rgba(79, 70, 229, 0.14), #020617 55%);
  padding-block: 3rem 3.5rem;
}

.tool__header {
  text-align: left;
  margin-bottom: 1.6rem;
}

.tool__header h2 {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

.tool__header p {
  max-width: 36rem;
  color: var(--text-soft);
}

/* BIG CENTERED DROPZONE */
.tool__drop {
  display: flex;
  justify-content: center;
  margin-bottom: 1.8rem;
}

.dropzone {
  position: relative;
  border-radius: 20px;
  border: 1.5px dashed rgba(148, 163, 184, 0.7);
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), rgba(15, 23, 42, 0.98));
  padding: 1.6rem 1.4rem;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.08s ease;
}

.dropzone--large {
  width: 100%;
  max-width: 700px;
  min-height: 220px;
}

.dropzone:hover {
  border-color: rgba(96, 165, 250, 0.95);
  transform: translateY(-1px);
}

.dropzone--dragover {
  border-style: solid;
  border-color: rgba(96, 165, 250, 1);
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.25), rgba(15, 23, 42, 1));
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone__content {
  height: 100%;
}

.dropzone__content--center {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 0.4rem;
}

.dropzone__title {
  font-size: 1rem;
  color: #e5e7eb;
  margin: 0;
}

.dropzone__hint {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin: 0;
}

/* LAYOUT UNDER THE DROPZONE */
.tool__layout {
  display: grid;
  gap: 1rem;
}

.tool__topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
}

.tool__group {
  display: grid;
  gap: 0.4rem;
  min-width: 220px;
}

.tool__group label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tool__select {
  background: rgba(15, 23, 42, 0.96);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  padding: 0.55rem 0.9rem;
  color: var(--text-main);

  font-size: 0.85rem;          /* smaller text */
  max-width: 100%;

  /* Try to keep text inside */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.tool__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 0.8rem;
}


.tool__privacy {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* STACK: RESULTS + PREVIEW */
.tool__stack {
  display: grid;
  gap: 1.1rem;
}

/* On wider screens, show list & preview side-by-side */
@media (min-width: 960px) {
  .tool__stack {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
    align-items: start;
  }
}

/* RESULTS CARD */
.results {
  background: var(--bg-card-soft);
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  padding: 1rem 1rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
}

.results__header h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.results__list {
  margin-top: 0.4rem;
  border-radius: 14px;
  border: 1px dashed rgba(51, 65, 85, 0.9);
  padding: 0.5rem;
  min-height: 180px;
  background: rgba(15, 23, 42, 0.8);
  display: grid;
  gap: 0.35rem;
  align-content: flex-start;
}

.results__empty {
  padding: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}

/* Individual row */
.result-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(31, 41, 55, 0.9);
  cursor: pointer;
}

.result-item__thumb {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  overflow: hidden;
  background: #020617;
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.result-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-item__meta {
  font-size: 0.8rem;
}

.result-item__name {
  color: #e5e7eb;
  margin-bottom: 0.05rem;
}

.result-item__sizes {
  color: var(--text-soft);
}

.result-item__badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text-soft);
}

.result-item--active {
  border-color: rgba(96, 165, 250, 1);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

/* PREVIEW CARD */
.preview {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  padding: 1rem 1rem 1.1rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
}

.preview__header h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.preview__meta {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.preview__frame {
  margin-top: 0.7rem;
  border-radius: 18px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: radial-gradient(circle at top, #111827, #020617);
  padding: 0.4rem;
  flex: 1;
  min-height: 220px;

  display: flex;
  align-items: center;
  justify-content: center;
}

.preview__inner {
  border-radius: 14px;
  overflow: hidden;
  background: #020617;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;

  /* Default ratio: portrait 4:5 (1080 × 1350) */
  aspect-ratio: 1080 / 1350;
}

.preview__inner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.preview__placeholder {
  font-size: 0.85rem;
  color: var(--text-soft);
  text-align: center;
  padding: 1rem;
}

.preview__note {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* Crop sliders */
.preview__crop {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.5rem;
}

.preview__crop-row {
  display: grid;
  gap: 0.25rem;
}

.preview__crop-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.preview__crop-row label {
  flex: 1;
}

.preview__crop-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.preview__crop-row input[type="range"]:disabled {
  opacity: 0.4;
  cursor: default;
}

.preview__reset-btn {
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.78rem;
  padding: 0.15rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
}

.preview__reset-btn:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
}

.preview__reset-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* SIZES & FAQ (unchanged) */
.sizes__inner,
.faq__inner {
  display: grid;
  gap: 1.6rem;
}

.sizes__header,
.faq__header {
  max-width: 34rem;
}

.sizes__grid,
.faq__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 900px) {
  .sizes__grid,
  .faq__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .sizes__grid,
  .faq__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.sizes__card,
.faq__item {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 18px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  padding: 1rem;
}

.sizes__card h3,
.faq__item h3 {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.sizes__card p:first-of-type {
  margin-bottom: 0.1rem;
}

/* Layout: uploads box + big preview */
.tool__engine {
  margin-top: 1.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .tool__engine {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Uploaded images card */
.results {
  background: var(--bg-card-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-soft);
}

.results__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.results__header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.results__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.results__list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.results__empty {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* Individual uploaded image row */
.result-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  cursor: pointer;
  transition: background 0.12s ease, border 0.12s ease, transform 0.12s ease;
}

.result-item:hover {
  background: rgba(17, 24, 39, 0.95);
  transform: translateY(-1px);
}

.result-item--active {
  border: 1px solid rgba(129, 140, 248, 0.9);
  background: rgba(17, 24, 39, 0.98);
}

.result-item__thumb {
  width: 52px;
  height: 52px;
  border-radius: 0.6rem;
  overflow: hidden;
  flex-shrink: 0;
}

.result-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-item__meta {
  min-width: 0;
}

.result-item__name {
  font-size: 0.8rem;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-item__sizes {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.result-item__badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text-soft);
  justify-self: flex-end;
}
/* ===========================
   Uploaded images list under dropzone
   =========================== */

.tool__uploads {
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card-soft);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.tool__uploads-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.tool__uploads-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.tool__uploads-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.tool__uploads-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tool__uploads-empty {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* Each uploaded file row */
.tool__uploads-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.95);
}

.tool__uploads-thumb {
  width: 48px;
  height: 48px;
  border-radius: 0.6rem;
  overflow: hidden;
  flex-shrink: 0;
}

.tool__uploads-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tool__uploads-meta {
  min-width: 0;
}

.tool__uploads-name {
  font-size: 0.8rem;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool__uploads-size {
  font-size: 0.75rem;
  color: var(--text-soft);
}

/* Mobile tweak */
@media (max-width: 480px) {
  .tool__uploads {
    padding: 0.8rem 0.85rem;
  }

  .tool__uploads-thumb {
    width: 42px;
    height: 42px;
  }

  .tool__uploads-name {
    font-size: 0.78rem;
  }

  .tool__uploads-size {
    font-size: 0.72rem;
  }
}
/* ===========================
   Tool engine: list + preview
   =========================== */

.tool__engine {
  margin-top: 1.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .tool__engine {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Uploaded images card (used by tool-instagram.js) */
.results {
  background: var(--bg-card-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-soft);
}

.results__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.results__header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.results__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.results__list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.results__empty {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* Each processed image row (clickable) */
.result-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  cursor: pointer;
  transition: background 0.12s ease, border 0.12s ease, transform 0.12s ease;
}

.result-item:hover {
  background: rgba(17, 24, 39, 0.95);
  transform: translateY(-1px);
}

.result-item--active {
  border: 1px solid rgba(129, 140, 248, 0.9);
  background: rgba(17, 24, 39, 0.98);
}

.result-item__thumb {
  width: 52px;
  height: 52px;
  border-radius: 0.6rem;
  overflow: hidden;
  flex-shrink: 0;
}

.result-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-item__meta {
  min-width: 0;
}

.result-item__name {
  font-size: 0.8rem;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-item__sizes {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.result-item__badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text-soft);
  justify-self: flex-end;
}
/* Layout: engine under dropzone */
.tool__engine {
  margin-top: 1.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .tool__engine {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Uploaded images card */
.results {
  background: var(--bg-card-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-soft);
}

.results__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.results__header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.results__hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.results__list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.results__empty {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* Each processed image row (clickable) */
.result-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  cursor: pointer;
  transition: background 0.12s ease, border 0.12s ease, transform 0.12s ease;
}

.result-item:hover {
  background: rgba(17, 24, 39, 0.95);
  transform: translateY(-1px);
}

.result-item--active {
  border: 1px solid rgba(129, 140, 248, 0.9);
  background: rgba(17, 24, 39, 0.98);
}

.result-item__thumb {
  width: 52px;
  height: 52px;
  border-radius: 0.6rem;
  overflow: hidden;
  flex-shrink: 0;
}

.result-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-item__meta {
  min-width: 0;
}

.result-item__name {
  font-size: 0.8rem;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-item__sizes {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.result-item__badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text-soft);
  justify-self: flex-end;
}
/* Show only the uploaded images list (hide big preview in tool section) */
.tool__engine {
  /* force single-column layout */
  grid-template-columns: minmax(0, 1fr);
}

.tool__engine .preview {
  display: none;
}
