/* ============================================================
   RESET & VARIÁVEIS
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --verde:      #1db954;
  --verde-esc:  #17a347;
  --verde-cl:   #d4f5e2;
  --amarelo:    #f5c518;
  --vermelho:   #e63946;
  --azul:       #457b9d;
  --bg:         #f0f4f0;
  --card:       #ffffff;
  --texto:      #1a2e1a;
  --texto-cl:   #5a7060;
  --borda:      #d8e8d8;
  --sombra:     0 4px 24px rgba(29,185,84,.12);
  --sombra-lg:  0 12px 48px rgba(29,185,84,.18);
  --radius:     18px;
  --radius-sm:  10px;
  --font:       'Segoe UI', system-ui, sans-serif;
  --trans:      .22s cubic-bezier(.4,0,.2,1);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--texto);
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(29,185,84,.08) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(245,197,24,.06) 0%, transparent 50%);
}

/* ============================================================
   HEADER
   ============================================================ */
header {
  background: var(--card);
  border-bottom: 2px solid var(--verde-cl);
  padding: 0 2rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(29,185,84,.1);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.logo {
  display: flex; align-items: center; gap: .6rem;
  font-size: 1.5rem; font-weight: 800;
  color: var(--verde);
  text-decoration: none; letter-spacing: -.5px;
}
.logo span { font-size: 1.8rem; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.3rem; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-size: .9rem; font-weight: 600;
  font-family: var(--font); transition: var(--trans);
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--verde); color: #fff; }
.btn-primary:hover { background: var(--verde-esc); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(29,185,84,.35); }
.btn-outline { background: transparent; color: var(--verde); border: 2px solid var(--verde); }
.btn-outline:hover { background: var(--verde-cl); }
.btn-danger { background: var(--vermelho); color: #fff; }
.btn-danger:hover { background: #c0303b; }
.btn-sm { padding: .4rem .9rem; font-size: .82rem; }
.btn-lg { padding: .85rem 2rem; font-size: 1rem; border-radius: var(--radius); }
.btn-amarelo { background: var(--amarelo); color: var(--texto); }
.btn-amarelo:hover { background: #e0b010; transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ============================================================
   MAIN / CONTAINER
   ============================================================ */
main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ============================================================
   HERO / STATS BAR
   ============================================================ */
.hero {
  background: linear-gradient(135deg, var(--verde) 0%, #15a343 100%);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  color: #fff; margin-bottom: 2rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  box-shadow: var(--sombra-lg);
  position: relative; overflow: hidden;
}
.hero::before {
  content: '🐄';
  position: absolute; right: -20px; top: -20px;
  font-size: 120px; opacity: .12;
  transform: rotate(15deg);
}
.hero-text h1 { font-size: 2rem; font-weight: 800; margin-bottom: .3rem; }
.hero-text p  { opacity: .88; font-size: 1rem; }
.hero-stats { display: flex; gap: 2rem; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .78rem; opacity: .8; text-transform: uppercase; letter-spacing: .5px; margin-top: .2rem; }

/* ============================================================
   FILTROS / TOOLBAR
   ============================================================ */
.toolbar {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.8rem; flex-wrap: wrap;
}
.toolbar input {
  flex: 1; min-width: 200px;
  padding: .65rem 1rem; border-radius: var(--radius-sm);
  border: 2px solid var(--borda); font-size: .9rem;
  background: var(--card); color: var(--texto); font-family: var(--font);
  transition: var(--trans);
}
.toolbar input:focus { outline: none; border-color: var(--verde); box-shadow: 0 0 0 3px rgba(29,185,84,.15); }
.toolbar select {
  padding: .65rem 1rem; border-radius: var(--radius-sm);
  border: 2px solid var(--borda); font-size: .9rem;
  background: var(--card); color: var(--texto); cursor: pointer;
  font-family: var(--font); transition: var(--trans);
}
.toolbar select:focus { outline: none; border-color: var(--verde); }

/* ============================================================
   GRID DE CARDS
   ============================================================ */
#grid-vaquinhas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--sombra); overflow: hidden;
  transition: var(--trans); border: 1.5px solid var(--borda);
  display: flex; flex-direction: column;
  animation: fadeUp .4s ease both;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--sombra-lg); border-color: var(--verde); }

@keyframes fadeUp {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}

.card-img {
  width: 100%; height: 185px; object-fit: cover;
  background: linear-gradient(135deg, var(--verde-cl), #e8f5e9);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 1.4rem; flex: 1; display: flex; flex-direction: column; gap: .75rem; }

.card-badge {
  display: inline-block;
  background: var(--verde-cl); color: var(--verde-esc);
  padding: .2rem .75rem; border-radius: 100px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  align-self: flex-start;
}
.badge-encerrada { background: #ffe4e4; color: var(--vermelho); }
.badge-pausada   { background: #fff3d0; color: #a07800; }

.card h3 { font-size: 1.1rem; font-weight: 700; line-height: 1.35; color: var(--texto); }
.card p  { font-size: .87rem; color: var(--texto-cl); line-height: 1.55;
           display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Progress bar */
.progress-wrap { margin-top: auto; }
.progress-info { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .4rem; }
.progress-valor { font-size: 1.1rem; font-weight: 800; color: var(--verde); }
.progress-meta  { font-size: .8rem; color: var(--texto-cl); }
.progress-bar-bg { background: var(--verde-cl); border-radius: 100px; height: 8px; overflow: hidden; }
.progress-bar    { background: linear-gradient(90deg, var(--verde), #5de08a); height: 100%; border-radius: 100px; transition: width .6s ease; }
.progress-pct    { font-size: .75rem; color: var(--texto-cl); margin-top: .3rem; }

.card-actions { display: flex; gap: .6rem; padding: 1rem 1.4rem; border-top: 1.5px solid var(--borda); flex-wrap: wrap; }

.contrib-count { font-size: .8rem; color: var(--texto-cl); display: flex; align-items: center; gap: .3rem; margin-left: auto; align-self: center; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty { text-align: center; padding: 4rem 2rem; color: var(--texto-cl); }
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty h3   { font-size: 1.3rem; margin-bottom: .5rem; color: var(--texto); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10,30,10,.55); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--card); border-radius: var(--radius);
  width: 100%; max-width: 580px; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
  animation: slideUp .28s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slideUp { from { transform: translateY(40px) scale(.97); opacity:0; } to { transform: none; opacity:1; } }

.modal-header {
  padding: 1.5rem 1.8rem 1rem;
  border-bottom: 1.5px solid var(--borda);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.modal-header h2 { font-size: 1.2rem; font-weight: 800; }
.modal-close {
  background: var(--bg); border: none; border-radius: 50%;
  width: 36px; height: 36px; cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans); color: var(--texto);
}
.modal-close:hover { background: var(--verde-cl); color: var(--verde); }

.modal-body { padding: 1.5rem 1.8rem; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group { margin-bottom: 1.2rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: .4rem; color: var(--texto); }
label .req { color: var(--vermelho); }

input[type="text"],
input[type="email"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%; padding: .7rem 1rem;
  border: 2px solid var(--borda); border-radius: var(--radius-sm);
  font-size: .92rem; font-family: var(--font); color: var(--texto);
  background: #fff; transition: var(--trans); resize: vertical;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--verde); box-shadow: 0 0 0 4px rgba(29,185,84,.12);
}
input.invalid, select.invalid, textarea.invalid {
  border-color: var(--vermelho); box-shadow: 0 0 0 4px rgba(230,57,70,.12);
}
.form-hint { font-size: .78rem; color: var(--texto-cl); margin-top: .3rem; }

.check-label {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer; font-size: .9rem; font-weight: 600;
}
.check-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--verde); cursor: pointer; }

.form-actions { display: flex; gap: .8rem; justify-content: flex-end; margin-top: 1.5rem; flex-wrap: wrap; }

/* ============================================================
   ALERT / TOAST
   ============================================================ */
.toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 9999;
  background: var(--card); border-radius: var(--radius-sm);
  padding: 1rem 1.4rem; box-shadow: 0 8px 32px rgba(0,0,0,.18);
  display: flex; align-items: center; gap: .8rem;
  max-width: 380px; border-left: 5px solid var(--verde);
  animation: toastIn .3s ease;
  font-size: .9rem; font-weight: 600;
}
.toast.erro { border-color: var(--vermelho); }
.toast-icon { font-size: 1.3rem; }
@keyframes toastIn { from { transform: translateX(100%); opacity:0; } to { transform:none; opacity:1; } }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastOut { to { transform: translateX(110%); opacity:0; } }

/* ============================================================
   MODAL DETALHE
   ============================================================ */
.detalhe-img {
  width: 100%; height: 220px; object-fit: cover;
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1.2rem;
  background: var(--verde-cl); display: flex; align-items: center; justify-content: center; font-size: 5rem;
}
.detalhe-img img { width: 100%; height: 100%; object-fit: cover; }

.detalhe-section { margin: 1.4rem 0; }
.detalhe-section h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .7px; color: var(--texto-cl); margin-bottom: .8rem; font-weight: 700; }

.contrib-list { display: flex; flex-direction: column; gap: .6rem; max-height: 240px; overflow-y: auto; }
.contrib-item {
  background: var(--bg); border-radius: var(--radius-sm); padding: .8rem 1rem;
  display: flex; align-items: flex-start; gap: .8rem;
  border: 1px solid var(--borda);
}
.contrib-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--verde); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; flex-shrink: 0;
}
.contrib-info { flex: 1; }
.contrib-nome  { font-weight: 700; font-size: .9rem; }
.contrib-msg   { font-size: .82rem; color: var(--texto-cl); margin-top: .15rem; }
.contrib-valor { font-weight: 800; color: var(--verde); font-size: 1rem; white-space: nowrap; }
.contrib-data  { font-size: .75rem; color: var(--texto-cl); }

/* ============================================================
   LOADING
   ============================================================ */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 4rem; gap: 1rem; color: var(--texto-cl);
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--verde-cl); border-top-color: var(--verde);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 768px) {
  .hero { padding: 1.5rem; }
  .hero-text h1 { font-size: 1.4rem; }
  .hero-stats { gap: 1.2rem; }
  .stat-num { font-size: 1.5rem; }
  #grid-vaquinhas { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
}