/* ---------- Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --success: #10B981;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --danger: #EF4444;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.06);
  --radius: 12px;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; }
a { color: var(--primary); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1rem;
}
nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  margin-left: 16px;
}
nav a:hover { color: var(--primary); }

main { flex: 1; padding: 32px 0 48px; }

.hero { text-align: center; margin-bottom: 32px; }
.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- Ad slots ---------- */
.ad-slot {
  background: #EEF2F7;
  border: 1px dashed #CBD5E1;
  color: #94A3B8;
  text-align: center;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin: 24px 0;
}

/* ---------- Card / dropzone ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  background: #fff;
  display: block;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: #EFF6FF;
}
.dropzone svg {
  width: 56px; height: 56px;
  color: var(--primary);
  margin: 0 auto 12px;
}
.dropzone h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.dropzone p { color: var(--text-muted); font-size: 0.95rem; }
.dropzone small { display: block; margin-top: 10px; color: #94A3B8; font-size: 0.8rem; }
.dropzone input[type="file"] { display: none; }

/* ---------- Controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding: 16px;
  background: #F1F5F9;
  border-radius: var(--radius);
}
.controls label {
  font-weight: 500;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.level-group { display: flex; gap: 6px; flex-wrap: wrap; }
.level-btn {
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  transition: all 0.15s ease;
}
.level-btn:hover { border-color: var(--primary); }
.level-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ---------- Upload area toggle ---------- */
#upload-area.hidden { display: none; }

/* ---------- Result ---------- */
.result { display: none; }
.result.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 600px) {
  .preview-grid { grid-template-columns: 1fr; }
}

.preview-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.preview-box .label {
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #F8FAFC;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.preview-box .label .size {
  color: var(--text);
  font-weight: 700;
}
.preview-box .img-wrapper {
  flex: 1;
  display: grid;
  place-items: center;
  background: #F1F5F9;
  min-height: 180px;
  padding: 8px;
}
.preview-box img {
  max-height: 240px;
  object-fit: contain;
  border-radius: 4px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.stat { flex: 1; min-width: 120px; }
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}
.stat-value.success { color: var(--success); }

.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.btn-primary {
  background: var(--success);
  color: #fff;
  flex: 1;
  justify-content: center;
}
.btn-primary:hover { background: #059669; }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Loader & error ---------- */
.loader { display: none; text-align: center; padding: 24px; }
.loader.visible { display: block; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid #E2E8F0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  display: none;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--danger);
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 0.9rem;
}
.error.visible { display: block; }

/* ---------- Features section ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 48px;
}
.feature { text-align: center; padding: 20px; }
.feature-icon {
  width: 48px; height: 48px;
  background: #EFF6FF;
  color: var(--primary);
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  font-size: 1.4rem;
}
.feature h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature p { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Content pages (Sobre / Blog) ---------- */
.content-page { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.content-page h1 { font-size: 1.8rem; margin-bottom: 16px; letter-spacing: -0.02em; }
.content-page h2 { font-size: 1.3rem; margin: 24px 0 10px; }
.content-page p { margin-bottom: 12px; color: var(--text); }
.content-page ul { margin: 0 0 16px 20px; color: var(--text); }
.content-page ul li { margin-bottom: 6px; }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { padding: 16px 0; border-bottom: 1px solid var(--border); }
.post-list li:last-child { border-bottom: none; }
.post-list a { font-weight: 600; font-size: 1.05rem; text-decoration: none; }
.post-list .meta { display: block; color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* ---------- Footer ---------- */
footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: auto;
}
footer a { color: var(--primary); text-decoration: none; }
