/* Shared image tool presentation. Load after design-tokens.css and before tool-specific styles. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-system);
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 20px 16px;
  line-height: 1.5;
}

.page {
  max-width: 640px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 24px;
}

.header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.header .back a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.header .back a:hover { text-decoration: underline; }

/* Drop zone */
.dropzone {
  border: 2px dashed var(--accent);
  border-radius: 10px;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-inset);
  margin-bottom: 16px;
}

.dropzone:hover {
  border-color: var(--accent-hover);
  background: var(--bg-hover);
}

.dropzone.dragover {
  border-color: var(--accent-hover);
  background: var(--accent-dim);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--border);
  padding: 12px 16px;
}

.dropzone-prompt {
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
}

.dropzone-prompt .formats {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}

.dropzone-file {
  display: none;
  align-items: center;
  gap: 12px;
}

.dropzone.has-file .dropzone-prompt { display: none; }

.dropzone.has-file .dropzone-file { display: flex; }

.file-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.file-meta {
  text-align: left;
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-details {
  font-size: 13px;
  color: var(--text-muted);
}

.file-change {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  flex-shrink: 0;
}

/* Panel */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.panel-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Format buttons */
.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.format-btn {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-content);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}

.format-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-primary);
}

.format-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.format-ext {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.format-note {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.format-btn.active .format-note { color: var(--accent); opacity: 0.7; }

/* Quality row */
.quality-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.quality-row.hidden { display: none; }

.row-label {
  font-size: 14px;
  color: var(--text-content);
  font-weight: 500;
  white-space: nowrap;
}

.quality-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-hover);
  box-shadow: inset 0 0 0 1px var(--text-dim);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.quality-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.quality-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.quality-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  min-width: 28px;
  text-align: right;
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 5px;
}

/* Result */
.result { display: none; }

.result.visible { display: block; }

.size-line {
  text-align: center;
  font-size: 13px;
  color: var(--text-content);
  margin-bottom: 14px;
}

.size-line .arrow {
  color: var(--text-muted);
  margin: 0 4px;
}

.size-line .savings {
  font-weight: 600;
}

.size-line .savings.smaller { color: var(--green); }

.size-line .savings.larger { color: var(--orange); }

.size-line .savings.same { color: var(--text-muted); }

/* Preview */
.preview-container {
  position: relative;
  margin-bottom: 14px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-inset);
  border: 1px solid var(--border);
}

.preview-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
}

.preview-container.has-transparency {
  background-image:
    linear-gradient(45deg, #2a2b30 25%, transparent 25%),
    linear-gradient(-45deg, #2a2b30 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2b30 75%),
    linear-gradient(-45deg, transparent 75%, #2a2b30 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* Actions */
.actions {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-body);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-inset);
  color: var(--text-content);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.btn-secondary.copied {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
}

/* Error message */
.error-msg {
  display: none;
  background: var(--orange-dim);
  border: 1px solid var(--orange);
  color: var(--orange);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  text-align: center;
}

.error-msg.visible { display: block; }

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 480px) {
  body { padding: 12px 10px; }
  .header h1 { font-size: 18px; }
  .panel { padding: 14px; }
  .actions { flex-direction: column; }
}
