@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@300;400;600&family=DM+Sans:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #1B6B3A;
  --green-light: #2ECC71;
  --green-pale: #D5F5E3;
  --green-mid: #82E0AA;
  --yellow: #F4D03F;
  --yellow-pale: #FEF9E7;
  --yellow-dark: #D4AC0D;
  --cream: #FDFEF9;
  --cream-dark: #EEF5EC;
  --charcoal: #1A2E1C;
  --charcoal-mid: #2D5016;
  --muted: #5D7A62;
  --red: #C0392B;
  --red-pale: #FADBD8;
  --white: #FFFFFF;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(27,107,58,0.08);
  --shadow-lg: 0 8px 32px rgba(27,107,58,0.16);
  --whatsapp: #25D366;
  --whatsapp-dark: #128C7E;
}

html { font-size: 16px; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--green);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(27,107,58,0.2);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
}
.topbar-brand .logo-icon {
  width: 34px;
  height: 34px;
  background: var(--white);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.topbar-brand span {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.topbar-brand .brand-tld {
  color: var(--yellow);
}
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-nav a {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 20px;
  padding: 5px 14px;
  transition: all 0.18s;
  white-space: nowrap;
}
.topbar-nav a:hover { color: var(--white); background: rgba(255,255,255,0.12); }
.topbar-icon-btn {
  width: 34px !important; height: 34px !important;
  padding: 0 !important; border-radius: 50% !important;
  display: flex !important; align-items: center !important;
  justify-content: center !important;
}
.topbar-icon-btn svg { width: 17px; height: 17px; stroke: rgba(255,255,255,0.85); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topbar-signup { background: var(--yellow) !important; color: var(--charcoal) !important; border-color: var(--yellow) !important; font-weight: 600 !important; }
.topbar-admin { background: rgba(244,208,63,0.2) !important; color: var(--yellow) !important; border-color: rgba(244,208,63,0.4) !important; }

/* ── HERO ── */
.hero { text-align: center; padding: 4rem 1rem 2rem; }
.hero-icon {
  width: 72px; height: 72px;
  background: var(--green);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; margin: 0 auto 1.5rem;
}
.hero h1 {
  font-family: 'Fraunces', serif;
  font-size: 2.4rem; font-weight: 600;
  color: var(--charcoal); letter-spacing: -0.03em; line-height: 1.2;
}
.hero p { font-size: 1rem; color: var(--muted); margin-top: 0.5rem; }

/* ── CONTAINERS ── */
.container { max-width: 720px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.container-wide { max-width: 1000px; margin: 0 auto; padding: 2rem 1rem 4rem; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--cream-dark);
  padding: 1.8rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.2rem; }
.card-title {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem; font-weight: 600;
  color: var(--charcoal); margin-bottom: 1.2rem;
  padding-bottom: 0.8rem; border-bottom: 1px solid var(--cream-dark);
}

/* ── FORMS ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 0.4rem;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%; padding: 0.7rem 1rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem; color: var(--charcoal);
  background: var(--cream); transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(46,204,113,0.15);
  background: var(--white);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem; font-weight: 600;
  border-radius: 20px; padding: 0.6rem 1.4rem;
  cursor: pointer; border: none; text-decoration: none;
  transition: all 0.18s;
}
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--charcoal-mid); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(27,107,58,0.3); }
.btn-yellow { background: var(--yellow); color: var(--charcoal); }
.btn-yellow:hover { background: var(--yellow-dark); transform: translateY(-1px); }
.btn-whatsapp { background: var(--whatsapp); color: var(--white); }
.btn-whatsapp:hover { background: var(--whatsapp-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,211,102,0.35); }
.btn-secondary { background: var(--cream); color: var(--charcoal-mid); border: 1.5px solid var(--cream-dark); }
.btn-secondary:hover { background: var(--cream-dark); }
.btn-danger { background: transparent; color: var(--red); border: 1.5px solid transparent; padding: 0.3rem 0.7rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-danger:hover { background: var(--red-pale); border-color: var(--red); }
.btn-full { width: 100%; justify-content: center; border-radius: var(--radius-sm); padding: 0.8rem; }
.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.82rem; }

/* ── ALERTS ── */
.alert { padding: 0.8rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 1rem; }
.alert-error { background: var(--red-pale); color: var(--red); border-left: 3px solid var(--red); }
.alert-success { background: var(--green-pale); color: var(--green); border-left: 3px solid var(--green-light); }
.alert-info { background: var(--yellow-pale); color: var(--yellow-dark); border-left: 3px solid var(--yellow); }

/* ── AUTH ── */
.auth-links { text-align: center; margin-top: 1.2rem; font-size: 0.88rem; color: var(--muted); }
.auth-links a { color: var(--green); font-weight: 600; text-decoration: none; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 1.5rem;
}
.page-header h2 {
  font-family: 'Fraunces', serif; font-size: 1.6rem;
  font-weight: 600; color: var(--charcoal); letter-spacing: -0.02em;
}

/* ── DASHBOARD GRID ── */
.lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.list-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--cream-dark); padding: 1.3rem;
  box-shadow: var(--shadow); text-decoration: none;
  color: inherit; transition: transform 0.18s, box-shadow 0.18s;
  display: flex; flex-direction: column; gap: 10px;
}
.list-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.list-card-icon {
  width: 42px; height: 42px; background: var(--green-pale);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 22px;
}
.list-card-name { font-family: 'Fraunces', serif; font-size: 1.05rem; font-weight: 600; color: var(--charcoal); }
.list-card-meta { font-size: 0.8rem; color: var(--muted); }
.list-card-actions {
  display: flex; gap: 6px; margin-top: auto;
  padding-top: 10px; border-top: 1px solid var(--cream-dark);
  align-items: center;
}
.card-icon-btn {
  width: 32px; height: 32px; display: flex; align-items: center;
  justify-content: center; border-radius: var(--radius-sm);
  border: 1.5px solid var(--cream-dark); background: var(--cream);
  color: var(--muted); text-decoration: none; transition: all 0.15s; flex-shrink: 0;
}
.card-icon-btn:hover { background: var(--cream-dark); color: var(--charcoal); }
.card-icon-btn-danger:hover { background: var(--red-pale); border-color: var(--red); color: var(--red); }
.card-icon-btn-whatsapp:hover { background: #dcfce7; border-color: var(--whatsapp); color: var(--whatsapp); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }

/* ── PROGRESS ── */
.progress-bar-wrap { background: var(--cream-dark); border-radius: 20px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--green-light), var(--green)); border-radius: 20px; transition: width 0.3s ease; }
.progress-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem; display: flex; justify-content: space-between; }

/* ── VIEW LIST ── */
.list-title { font-family: 'Fraunces', serif; font-size: 1.8rem; font-weight: 600; color: var(--charcoal); letter-spacing: -0.03em; }
.list-subtitle { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.add-item-row {
  display: flex; gap: 8px; margin-bottom: 1.8rem;
  background: var(--white); border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius); padding: 0.8rem; box-shadow: var(--shadow);
}
.add-item-row input[type="text"] {
  flex: 1; border: none; background: none;
  font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  color: var(--charcoal); outline: none; padding: 0 0.4rem;
}
.qty-input {
  width: 56px; border: 1.5px solid var(--cream-dark) !important;
  border-radius: var(--radius-sm) !important; padding: 0.4rem 0.5rem !important;
  font-size: 0.9rem !important; text-align: center; background: var(--cream) !important;
}

/* ── ITEMS ── */
.items-list { display: flex; flex-direction: column; gap: 0; }
.item-row {
  display: flex; align-items: center; gap: 12px;
  padding: 0.9rem 1.1rem; background: var(--white);
  border: 1px solid var(--cream-dark); margin-bottom: -1px;
  transition: background 0.15s; position: relative;
}
.item-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.item-row:last-child { border-radius: 0 0 var(--radius) var(--radius); margin-bottom: 0; }
.item-row:only-child { border-radius: var(--radius); }
.item-row:hover { background: var(--cream); z-index: 1; }
.item-row.checked { opacity: 0.45; }
.item-row.checked .item-name { text-decoration: line-through; }
.item-check {
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--green-mid); appearance: none;
  cursor: pointer; background: var(--white); position: relative;
  transition: all 0.15s; flex-shrink: 0;
}
.item-check:checked { background: var(--green); border-color: var(--green); }
.item-check:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 8px; height: 13px; border: 2px solid white;
  border-top: none; border-left: none; transform: rotate(45deg);
}
.item-name { flex: 1; font-size: 0.95rem; color: var(--charcoal); }
.item-unit { font-size: 0.75rem; color: var(--muted); margin-left: 4px; }
.item-price { font-size: 0.82rem; font-weight: 600; color: var(--green); min-width: 60px; text-align: right; }
.item-qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--cream-dark); background: var(--cream);
  color: var(--charcoal-mid); font-size: 1rem; font-weight: 600;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all 0.15s; line-height: 1;
}
.qty-btn:hover { background: var(--green-pale); border-color: var(--green-light); color: var(--green); }
.qty-display { min-width: 22px; text-align: center; font-size: 0.88rem; font-weight: 600; color: var(--charcoal-mid); }
.item-delete {
  width: 28px; height: 28px; border-radius: 6px; border: none;
  background: none; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all 0.15s; opacity: 0;
}
.item-row:hover .item-delete { opacity: 1; }
.item-delete:hover { background: var(--red-pale); color: var(--red); }

/* ── TOTAL BAR ── */
.total-bar {
  background: var(--green);
  color: var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  box-shadow: var(--shadow);
}
.total-bar-label { font-size: 0.85rem; opacity: 0.85; }
.total-bar-value { font-family: 'Fraunces', serif; font-size: 1.4rem; font-weight: 600; }

/* ── WHATSAPP SHARE ── */
.whatsapp-share-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--whatsapp); color: var(--white);
  border-radius: var(--radius); padding: 0.85rem 1.2rem;
  text-decoration: none; font-weight: 600; font-size: 0.92rem;
  transition: all 0.18s; justify-content: center;
  box-shadow: 0 4px 14px rgba(37,211,102,0.3);
}
.whatsapp-share-btn:hover { background: var(--whatsapp-dark); transform: translateY(-2px); }
.whatsapp-share-btn svg { flex-shrink: 0; }

/* ── AD SLOTS ── */
.ad-slot {
  background: var(--cream-dark); border: 1px dashed #a8c5a0;
  border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; color: var(--muted);
  font-size: 0.75rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em; overflow: hidden;
}
.ad-slot-banner { height: 90px; width: 100%; margin: 1.2rem 0; }
.ad-slot-rectangle { height: 250px; width: 300px; }

/* ── BLOG ── */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
.blog-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--cream-dark); overflow: hidden;
  box-shadow: var(--shadow); text-decoration: none; color: inherit;
  transition: transform 0.18s, box-shadow 0.18s; display: flex; flex-direction: column;
}
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.blog-card-thumb {
  height: 160px; background: var(--green-pale);
  display: flex; align-items: center; justify-content: center; font-size: 4rem;
}
.blog-card-body { padding: 1.2rem; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.blog-card-tag {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--green);
}
.blog-card-title { font-family: 'Fraunces', serif; font-size: 1.05rem; font-weight: 600; color: var(--charcoal); line-height: 1.35; }
.blog-card-excerpt { font-size: 0.85rem; color: var(--muted); line-height: 1.55; flex: 1; }
.blog-card-meta { font-size: 0.75rem; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--cream-dark); }
.blog-post-header { margin-bottom: 2rem; }
.blog-post-header h1 { font-family: 'Fraunces', serif; font-size: 2rem; font-weight: 600; color: var(--charcoal); letter-spacing: -0.03em; line-height: 1.25; }
.blog-post-body { font-size: 0.98rem; line-height: 1.8; color: var(--charcoal); }
.blog-post-body h2 { font-family: 'Fraunces', serif; font-size: 1.3rem; font-weight: 600; margin: 2rem 0 0.8rem; }
.blog-post-body p { margin-bottom: 1rem; }
.blog-post-body ul { margin: 0.8rem 0 1rem 1.5rem; }
.blog-post-body li { margin-bottom: 0.4rem; }

/* ── SECTION LABEL ── */
.section-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.8rem; }

/* ── ADMIN ── */
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.admin-stat { background: var(--white); border: 1px solid var(--cream-dark); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.admin-stat-value { font-family: 'Fraunces', serif; font-size: 2rem; font-weight: 600; color: var(--green); line-height: 1; margin-bottom: 4px; }
.admin-stat-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th { text-align: left; padding: 0.6rem 0.8rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 2px solid var(--cream-dark); }
.admin-table td { padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--cream-dark); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--cream); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-green { background: var(--green-pale); color: var(--green); }
.badge-red { background: var(--red-pale); color: var(--red); }
.badge-gray { background: var(--cream-dark); color: var(--muted); }
.badge-yellow { background: var(--yellow-pale); color: var(--yellow-dark); }
.admin-nav { display: flex; gap: 6px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.admin-nav a { font-size: 0.83rem; font-weight: 600; padding: 6px 14px; border-radius: 20px; text-decoration: none; border: 1.5px solid var(--cream-dark); color: var(--charcoal-mid); background: var(--white); transition: all 0.15s; }
.admin-nav a:hover, .admin-nav a.active { background: var(--green); color: var(--white); border-color: var(--green); }

/* ── PRICETAG (mercado feature) ── */
.price-input-wrap { position: relative; }
.price-input-wrap::before { content: 'R$'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.price-input-wrap input { padding-left: 32px !important; }

/* ── FOOTER ── */
footer { background: var(--charcoal); color: rgba(255,255,255,0.6); padding: 2.5rem 1rem; text-align: center; font-size: 0.82rem; margin-top: 3rem; }
footer a { color: var(--green-light); text-decoration: none; }
footer .footer-links { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }

/* ── PRINT ── */
@media print {
  .topbar, .btn, .add-item-row, .qty-btn, .item-delete, .ad-slot, footer { display: none !important; }
  body { background: white; }
  .item-row { border: none; border-bottom: 1px solid #eee; }
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .topbar { padding: 0 0.85rem; }
  .topbar-nav a:not(.topbar-icon-btn):not(.topbar-signup):not(.topbar-admin) { display: none; }
  .hero h1 { font-size: 1.75rem; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  .lists-grid { grid-template-columns: 1fr 1fr; }
  .container, .container-wide { padding: 1.2rem 0.85rem 3rem; }
  .blog-grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .lists-grid { grid-template-columns: 1fr; }
}
