/* ============================================================
   style.css v3 — Feira Livre Brasil · Piclescoin Marketplace
   ============================================================ */

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

:root {
  --green:       #2d8a4e;
  --green-dark:  #1a5c35;
  --green-light: #e8f5ee;
  --green-xlight:#f0fdf4;
  --amber:       #f39c12;
  --red:         #e74c3c;
  --text:        #1a1a1a;
  --text-muted:  #666;
  --text-faint:  #aaa;
  --border:      #e5e7eb;
  --bg:          #f5f5f0;
  --white:       #ffffff;
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
  --shadow:      0 1px 8px rgba(0,0,0,.08);
  --shadow-md:   0 4px 20px rgba(0,0,0,.12);
}

body { font-family: 'Segoe UI', system-ui, Arial, sans-serif; font-size: 15px; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ——— Layout ——— */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.page-content { padding: 28px 0 60px; }

/* ——— HEADER ——— */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 16px;
  height: 60px;
}

/* Logo */
.logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 800; color: var(--text);
  flex-shrink: 0; text-decoration: none;
}
.logo img { width: 32px; height: 32px; border-radius: 50%; }
.logo-text { line-height: 1.1; }
.logo-text em { display: block; font-style: normal; font-size: 11px; font-weight: 500; color: var(--green); letter-spacing: .5px; }
.logo:hover { text-decoration: none; }

/* Busca central */
.header-search {
  flex: 1; display: flex; max-width: 480px;
  border: 1.5px solid var(--border); border-radius: 24px;
  overflow: hidden; background: #f9f9f7;
  transition: border-color .2s, box-shadow .2s;
}
.header-search:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45,138,78,.1);
  background: #fff;
}
.search-icon { padding: 0 10px 0 14px; display: flex; align-items: center; font-size: 15px; color: var(--text-faint); }
.header-search input {
  flex: 1; border: none; background: transparent; padding: 9px 0;
  font-size: 14px; outline: none; color: var(--text); min-width: 0;
}
.header-search button {
  padding: 0 18px; background: var(--green); color: #fff;
  border: none; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .2s; white-space: nowrap;
}
.header-search button:hover { background: var(--green-dark); }

/* Nav actions */
.nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.btn-icon-nav {
  position: relative; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 18px;
  transition: background .15s;
}
.btn-icon-nav:hover { background: var(--bg); text-decoration: none; }
.btn-icon-nav .badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: #fff; font-size: 10px;
  font-weight: 700; border-radius: 10px; padding: 1px 5px; min-width: 16px; text-align: center;
}

.btn-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 800; font-size: 15px;
  border: 2px solid var(--green-light); cursor: pointer; transition: transform .15s;
}
.btn-avatar:hover { transform: scale(1.05); }

.btn-outline {
  border: 1.5px solid var(--green); color: var(--green);
  padding: 7px 16px; border-radius: 8px; font-weight: 600; font-size: 13px;
  background: transparent; cursor: pointer; transition: background .2s;
  display: inline-block; white-space: nowrap;
}
.btn-outline:hover { background: var(--green-light); text-decoration: none; }

.btn-anunciar {
  background: var(--green); color: #fff;
  padding: 8px 16px; border-radius: 8px; font-weight: 700; font-size: 13px;
  border: none; cursor: pointer; transition: background .2s;
  display: inline-block; white-space: nowrap;
}
.btn-anunciar:hover { background: var(--green-dark); text-decoration: none; color: #fff; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); min-width: 200px;
  box-shadow: var(--shadow-md); z-index: 300; overflow: hidden;
}
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-header {
  padding: 12px 16px 8px; font-size: 12px; font-weight: 700;
  color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px;
}
.dropdown-menu a {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; color: var(--text); font-size: 14px;
  transition: background .1s;
}
.dropdown-menu a:hover { background: var(--bg); text-decoration: none; }
.dropdown-menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.badge-inline {
  background: var(--red); color: #fff; font-size: 10px;
  padding: 1px 6px; border-radius: 10px; margin-left: auto;
}

/* ——— CAT NAV ——— */
.cat-nav { border-top: 1px solid var(--border); background: var(--white); }
.cat-nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
}
.cat-nav-inner::-webkit-scrollbar { display: none; }
.cat-link {
  white-space: nowrap; padding: 8px 14px; font-size: 13px;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s; flex-shrink: 0;
}
.cat-link:hover { color: var(--green); text-decoration: none; border-bottom-color: var(--green); }
.cat-link.ativa { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.cat-link.cat-destaque {
  color: var(--green); font-weight: 700;
  background: var(--green-xlight); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* ——— BUTTONS ——— */
.btn-primary {
  background: var(--green); color: #fff; padding: 10px 20px;
  border-radius: var(--radius); font-weight: 700; font-size: 14px;
  border: none; cursor: pointer; display: inline-block;
  transition: background .2s; text-align: center;
}
.btn-primary:hover { background: var(--green-dark); text-decoration: none; color: #fff; }
.btn-block { width: 100%; display: block; padding: 13px; font-size: 15px; }
.btn-amber { background: var(--amber); color: #fff; padding: 10px 20px; border-radius: var(--radius); font-weight: 700; font-size: 14px; border: none; cursor: pointer; display: inline-block; }
.btn-amber:hover { background: #d68910; text-decoration: none; color: #fff; }

/* ——— CARDS ——— */
.anuncios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-top: 16px;
}
.card-anuncio {
  background: var(--white); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s; position: relative;
}
.card-anuncio:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card-anuncio > a { color: inherit; text-decoration: none; display: block; }
.card-foto { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #f0f0eb; }
.card-foto-placeholder {
  width: 100%; aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
  font-size: 52px; background: var(--green-xlight);
}
.card-body { padding: 12px 14px 14px; }
.card-cat { font-size: 11px; color: var(--green); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.card-titulo {
  font-size: 14px; font-weight: 600; margin: 4px 0 8px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-preco { font-size: 18px; font-weight: 800; color: var(--green); line-height: 1.2; }
.card-preco small, .card-preco span { font-size: 12px; font-weight: 400; }
.card-local { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.card-troca {
  background: #fff8e1; color: #b7760a; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; display: inline-block; margin-top: 5px;
}
.card-fav {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,.9); border: none; border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.12); z-index: 1;
  transition: transform .15s;
}
.card-fav:hover { transform: scale(1.15); }

/* ——— FORMULÁRIOS ——— */
.form-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 36px; box-shadow: var(--shadow); max-width: 520px; margin: 0 auto;
}
.form-card h2 { margin-bottom: 6px; font-size: 22px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text-muted); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; background: #fafaf8; font-family: inherit;
  transition: border-color .2s, background .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--green); background: #fff; }
.form-group textarea { min-height: 110px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.form-footer { margin-top: 20px; text-align: center; font-size: 14px; color: var(--text-muted); }

/* ——— ALERTAS ——— */
.alert { padding: 13px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; }
.alert-success { background: var(--green-xlight); color: #166534; border-left: 3px solid var(--green); }
.alert-error   { background: #fef2f2; color: #991b1b; border-left: 3px solid var(--red); }
.alert-info    { background: #eff6ff; color: #1e40af; border-left: 3px solid #3b82f6; }
.alert ul { margin: 6px 0 0 16px; }

/* ——— SEÇÕES ——— */
.section-title { font-size: 20px; font-weight: 800; margin-bottom: 2px; }
.section-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

/* ——— ANÚNCIO DETALHE ——— */
.anuncio-detail { display: grid; grid-template-columns: 1fr 360px; gap: 28px; }
.foto-principal { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-lg); background: #eee; }
.fotos-thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.fotos-thumbs img { width: 68px; height: 68px; object-fit: cover; border-radius: var(--radius); cursor: pointer; border: 2px solid transparent; opacity: .7; transition: all .2s; }
.fotos-thumbs img.ativa { opacity: 1; border-color: var(--green); }
.anuncio-sidebar { display: flex; flex-direction: column; gap: 14px; }
.card-white { background: var(--white); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.preco-destaque { font-size: 32px; font-weight: 900; color: var(--green); line-height: 1.1; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--green); color: #fff; font-size: 18px; font-weight: 800; display: flex; align-items: center; justify-content: center; }

/* ——— CHAT ——— */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - 130px); background: var(--white); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.chat-lista { border-right: 1px solid var(--border); overflow-y: auto; }
.chat-item { padding: 13px 15px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.chat-item:hover, .chat-item.ativa { background: var(--green-xlight); }
.chat-item-nome { font-weight: 700; font-size: 14px; }
.chat-item-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-main { display: flex; flex-direction: column; }
.chat-header { padding: 13px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; background: #fafaf8; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.msg-recebida { background: #f0f0eb; align-self: flex-start; border-radius: 4px 12px 12px 12px; }
.msg-enviada  { background: var(--green); color: #fff; align-self: flex-end; border-radius: 12px 12px 4px 12px; }
.msg-hora { font-size: 10px; opacity: .55; margin-top: 3px; }
.chat-input-area { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input-area input { flex: 1; padding: 10px 15px; border: 1.5px solid var(--border); border-radius: 22px; outline: none; font-size: 14px; }
.chat-input-area input:focus { border-color: var(--green); }
.chat-input-area button { background: var(--green); color: #fff; border: none; border-radius: 22px; padding: 10px 20px; font-weight: 700; cursor: pointer; font-size: 14px; }

/* ——— UPLOAD ——— */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 28px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-area:hover, .upload-area.drag { border-color: var(--green); background: var(--green-xlight); }
.fotos-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.foto-thumb-edit { position: relative; }
.foto-thumb-edit img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius); }

/* ——— PAGINAÇÃO ——— */
.paginacao { display: flex; gap: 4px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.paginacao a, .paginacao span { padding: 7px 13px; border-radius: var(--radius); border: 1px solid var(--border); font-size: 13px; }
.paginacao a { background: var(--white); color: var(--text); }
.paginacao a:hover { background: var(--green-light); border-color: var(--green); text-decoration: none; }
.paginacao .atual { background: var(--green); color: #fff; border-color: var(--green); }

/* ——— FOOTER ——— */
.site-footer { background: #111; color: #aaa; padding: 48px 0 24px; margin-top: 60px; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.site-footer strong { color: #fff; display: block; margin-bottom: 12px; font-size: 14px; }
.site-footer a { display: block; color: #888; font-size: 13px; margin-bottom: 6px; }
.site-footer a:hover { color: #fff; text-decoration: none; }
.site-footer p { font-size: 13px; color: #666; line-height: 1.6; }
.footer-copy { text-align: center; color: #444; font-size: 12px; border-top: 1px solid #222; padding-top: 20px; margin-top: 8px; }

/* ——— RESPONSIVE ——— */
@media (max-width: 960px) {
  .anuncio-detail { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr; gap: 20px; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-lista { display: none; }
}
@media (max-width: 680px) {
  .header-search { display: none; }
  .logo-text em { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .anuncios-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}
