/* tira.fundo — Utilitário Honesto e Limpo (padrão UX Hub imgpronta) */

:root {
  --bg: #f5f5f7;
  --bg-panel: #ffffff;
  --panel: #ffffff;
  --border: #e5e5ea;
  --text: #1a1a1a;
  --text-muted: #666666;
  --accent: #0066cc;
  --accent-hover: #005bb5;
  --accent-contrast: #ffffff;
  --checkerboard: repeating-conic-gradient(#e0e0e0 0% 25%, #f4f4f4 0% 50%) 50% / 20px 20px;
  
  --radius: 12px;
  --radius-sm: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ===== Header App (padrão Hub — unificado) ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 20;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header__logo {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.app-header__subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Global Nav (padrão Hub — integrada ao header) */
.global-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0;
  background: transparent;
  border-bottom: none;
  border-radius: 0;
}

.nav-item {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--border);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* Botões (padrão Hub) */
.btn {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover:not(:disabled) {
  border-color: var(--text-muted);
  background: #fdfdfd;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}
.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}

/* Tool Hero (padrão DeepSeek/Google — gradiente como o Hub) */
.tool-hero {
  padding: 40px 32px 32px;
  text-align: center;
  background: linear-gradient(180deg, #ebf3ff 0%, var(--bg) 100%);
  border-bottom: none;
}

.tool-hero .brand {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
  background: linear-gradient(90deg, #0066cc, #0a84ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: inline-block;
}

.tool-hero .subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0 0 6px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.tool-hero .hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 auto;
  opacity: 0.8;
  max-width: 500px;
}

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.container {
  width: 100%;
  max-width: 900px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 500px;
}

.dropzone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: background 0.2s;
}
.dropzone.is-dragover {
  background: #f0f0f0;
  border: 2px dashed #999;
}

.dropzone p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.preview-area {
  flex: 1;
  background: var(--checkerboard);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  min-height: 300px;
}

canvas {
  max-width: 100%;
  max-height: 50vh;
  display: block;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.status-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  pointer-events: none;
}

.controls {
  padding: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--panel);
}

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

.file-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.file-info strong {
  color: var(--text);
  font-weight: 600;
}

.actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.actions-row.centered {
  justify-content: center;
}

.view-toggles {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.toggle-btn {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
}
.toggle-btn.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
input[type="color"] {
  padding: 0;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .app-header { padding: 12px 16px; flex-wrap: wrap; }
  .app-header__subtitle { display: none; }
  .global-nav { flex-wrap: wrap; gap: 6px; }
  .nav-item { font-size: 0.75rem; padding: 4px 8px; }
  .tool-hero { padding: 24px 16px 20px; }
  .tool-hero .brand { font-size: 1.5rem; }
  main { padding: 16px; }
  .controls-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .actions-row { flex-direction: column; }
  .btn { width: 100%; }
}

/* Dark Theme — sobrescreve variáveis para os novos componentes */
html[data-theme="dark"] {
  --bg: #1c1c1e;
  --bg-panel: #2c2c2e;
  --panel: #2c2c2e;
  --border: #3a3a3c;
  --text: #f5f5f7;
  --text-muted: #98989f;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-contrast: #ffffff;
  --checkerboard: repeating-conic-gradient(#2c2c2e 0% 25%, #343436 0% 50%) 50% / 20px 20px;
}
html[data-theme="dark"] .app-header { background: var(--bg-panel); }
html[data-theme="dark"] .btn { background: var(--bg-panel); border-color: var(--border); }
html[data-theme="dark"] .btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme="dark"] .nav-item.is-active { background: var(--accent); color: #fff; }
html[data-theme="dark"] .tool-hero { background: linear-gradient(180deg, #14304a 0%, var(--bg) 100%); }
html[data-theme="dark"] .tool-hero .brand { background: linear-gradient(90deg, #0a84ff, #409cff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
html[data-theme="dark"] input[type="color"] { border-color: var(--border); }
html[data-theme="dark"] select, html[data-theme="dark"] input[type="number"] { background: var(--panel); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .dropzone { background: var(--bg); }
html[data-theme="dark"] .toggle-btn.is-active { background: var(--panel); color: var(--text); }
html[data-theme="dark"] canvas { background: #000; }
html[data-theme="dark"] .container { background: var(--panel); border-color: var(--border); }
html[data-theme="dark"] .workspace { background: var(--panel); }
html[data-theme="dark"] .preview-area { background: var(--checkerboard); }
