@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=Courier+Prime:wght@400;700&display=swap');

:root {
  --brand: #C4714A;
  --brand-2: #8B3A2A;
  --brand-3: #A85C3E;
  --accent: #D4956A;
  --bg: #FDF6EE;
  --surface: #FFF8F0;
  --border: #E8C9B0;
  --text: #3D1F10;
  --text-muted: #7A4A35;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(196,113,74,0.13);
}

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

body {
  font-family: 'Courier Prime', 'Courier New', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── AUTH ── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.auth-title {
  font-family: 'Special Elite', serif;
  font-size: 32px;
  color: var(--brand);
  text-align: center;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-family: 'Courier Prime', monospace;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}

.auth-error {
  font-family: 'Courier Prime', monospace;
  font-size: 13px;
  color: #C0392B;
  background: #fdecea;
  border: 1px solid #f5c6c6;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── HEADER ── */
.app-header {
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.header-title {
  font-family: 'Special Elite', serif;
  font-size: 30px;
  color: #fff;
  letter-spacing: 1.5px;
  text-shadow: 1px 2px 6px rgba(0,0,0,0.35);
}

.btn-new {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 13px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 20px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.btn-new:hover { background: rgba(255,255,255,0.3); }

.btn-logout {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 12px;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 20px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ── MAIN ── */
.main-content {
  padding: 24px 16px 60px;
  max-width: 680px;
  margin: 0 auto;
}

/* ── BUSCA ── */
.search-wrap { margin-bottom: 28px; }

.search-input {
  width: 100%;
  font-family: 'Courier Prime', monospace;
  font-size: 15px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}

.search-input::placeholder { color: var(--text-muted); opacity: 0.75; }
.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(196,113,74,0.15);
}

/* ── SEÇÃO POR ESPÉCIE ── */
.species-section {
  margin-bottom: 36px;
}

.species-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px dashed var(--border);
}

.species-title {
  font-family: 'Special Elite', serif;
  font-size: 20px;
  color: var(--brand);
  letter-spacing: 0.5px;
}

/* ── GRID DE CARDS ── */
.cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.cat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: var(--shadow);
}

.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(196,113,74,0.22);
}

.cat-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--border);
  background: var(--bg);
}

.cat-name {
  font-family: 'Special Elite', serif;
  font-size: 15px;
  color: var(--brand);
  text-align: center;
  line-height: 1.3;
}

/* ── BADGE VACINA NO CARD ── */
.vaccine-badge {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-align: center;
  line-height: 1.4;
}

.vaccine-overdue {
  background: #C0392B;
  color: #fff;
}

.vaccine-soon {
  background: #E67E22;
  color: #fff;
}

/* ── EMPTY SECTION ── */
.empty-section {
  font-family: 'Courier Prime', monospace;
  font-size: 13px;
  color: var(--text-muted);
  padding: 14px 0 4px;
  opacity: 0.75;
}

/* ── EMPTY STATE GERAL ── */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
  font-family: 'Special Elite', serif;
  font-size: 17px;
  line-height: 2;
}

/* ── MODAL OVERLAY ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(61,31,16,0.5);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

/* ── MODAL SHEET ── */
.modal-sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.28s ease;
  overflow: hidden;
}

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

/* ── MODAL HEADER ── */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1.5px solid var(--border);
  flex-shrink: 0;
}

.modal-pet-info { display: flex; align-items: center; gap: 14px; }

.modal-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.modal-pet-name {
  font-family: 'Special Elite', serif;
  font-size: 20px;
  color: var(--brand);
}

.modal-pet-sub {
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.modal-close {
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.modal-close:hover { background: var(--border); }

/* ── TABS ── */
.modal-tabs {
  display: flex;
  padding: 0 20px;
  gap: 4px;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.tab-btn {
  font-family: 'Courier Prime', monospace;
  font-size: 13px;
  font-weight: 700;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  color: var(--text-muted);
  padding: 11px 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.3px;
}

.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-btn:hover:not(.active) { color: var(--text); }

/* ── MODAL BODY ── */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── KV GRID ── */
.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.kv-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.kv-label {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 4px;
}

.kv-value {
  font-family: 'Courier Prime', monospace;
  font-size: 14px;
  color: var(--text);
}

/* ── BADGES FIV/FELV ── */
.badges-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  margin-bottom: 16px;
}

.badge {
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  color: #fff;
  letter-spacing: 0.3px;
}

.badge-pos { background: #C0392B; }
.badge-neg { background: #6B8F5E; }
.badge-unk { background: #B0947A; }

/* ── SEÇÕES SAÚDE / HISTÓRICO ── */
.section-title {
  font-family: 'Special Elite', serif;
  font-size: 15px;
  color: var(--brand);
  margin-bottom: 8px;
  margin-top: 20px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 5px;
  letter-spacing: 0.5px;
}

.section-title:first-child { margin-top: 0; }

.section-text {
  font-family: 'Courier Prime', monospace;
  font-size: 14px;
  color: var(--text);
  white-space: pre-line;
  line-height: 1.7;
}

/* ── MODAL FOOTER ── */
.modal-footer {
  padding: 14px 20px;
  border-top: 1.5px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.footer-actions-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-edit {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 22px;
  padding: 10px 28px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-edit:hover { background: var(--brand); }

.btn-delete {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 14px;
  background: transparent;
  color: #C0392B;
  border: 1.5px solid #C0392B;
  border-radius: 22px;
  padding: 10px 22px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-delete:hover { background: #C0392B; color: #fff; }

.btn-share {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 14px;
  background: transparent;
  color: #25A244;
  border: 1.5px solid #25A244;
  border-radius: 22px;
  padding: 10px 22px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-share:hover { background: #25A244; color: #fff; }

/* ── FORMULÁRIO ── */
.form-sheet { border-radius: 20px 20px 0 0; }

.form-title {
  font-family: 'Special Elite', serif;
  font-size: 21px;
  color: var(--brand);
}

.form-body {
  overflow-y: auto;
  padding: 20px 20px 32px;
  flex: 1;
}

/* ── TOGGLE ESPÉCIE ── */
.species-toggle {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.species-btn {
  flex: 1;
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.species-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.species-btn:hover:not(.active) {
  border-color: var(--brand);
  color: var(--brand);
}

/* ── UPLOAD DE FOTO ── */
.photo-upload-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 4px;
}

.photo-preview {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  background: var(--surface);
  display: none;
}

.photo-preview.has-image { display: block; }

.photo-upload-btn {
  display: inline-block;
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 13px;
  background: var(--brand);
  color: #fff;
  border-radius: 20px;
  padding: 9px 22px;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.3px;
  text-align: center;
}

.photo-upload-btn:hover { background: var(--brand-2); }

.photo-hint {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* ── GRUPOS DE CAMPO ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-input {
  width: 100%;
  font-family: 'Courier Prime', monospace;
  font-size: 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(196,113,74,0.12);
}

.form-input::placeholder { color: var(--text-muted); opacity: 0.65; }

select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A4A35' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── AÇÕES DO FORM ── */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.btn-cancel {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 14px;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: 22px;
  padding: 10px 22px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-cancel:hover { background: var(--border); }

.btn-save {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 22px;
  padding: 10px 28px;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.4px;
}

.btn-save:hover { background: var(--brand-2); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
