/* =========================================================
   Converse Animal Shelter — Catppuccin Latte Theme
   Base:    #eff1f5  Mantle: #e6e9ef  Crust:  #dce0e8
   Surface: #ccd0da  Text:   #4c4f69  Muted:  #6c6f85
   Teal:    #179299  Green:  #40a02b  Red:    #d20f39
   Yellow:  #df8e1d  Blue:   #1e66f5  Mauve:  #8839ef
   ========================================================= */

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

:root {
  --primary:      #179299;
  --primary-dk:   #117a7f;
  --secondary:    #40a02b;
  --secondary-dk: #317a21;
  --bg:           #eff1f5;
  --surface:      #ffffff;
  --mantle:       #e6e9ef;
  --crust:        #dce0e8;
  --text:         #4c4f69;
  --text-muted:   #6c6f85;
  --border:       #ccd0da;
  --shadow:       0 2px 8px rgba(76,79,105,.08);
  --shadow-md:    0 4px 16px rgba(76,79,105,.14);
  --radius:       8px;
  --font:         'Nunito', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

h1,h2,h3,h4 { line-height: 1.25; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

main { flex: 1; }

/* ---------- Navigation ---------- */
.site-nav {
  background: var(--surface);
  border-bottom: 2px solid var(--crust);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.nav-logo img {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.nav-logo-text { display: inline; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  color: var(--text);
  font-weight: 500;
  transition: color .2s;
}

.nav-links a:hover { color: var(--primary); text-decoration: none; }

.nav-links .btn-primary,
.nav-links .btn-primary:hover { color: #fff; text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: .55rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  border: none;
  transition: background .2s, transform .1s;
  text-align: center;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary);   color: #fff; }
.btn-primary:hover { background: var(--primary-dk); color: #fff; }

.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-dk); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: .35rem .85rem; font-size: .85rem; }

.btn-danger { background: #d20f39; color: #fff; }
.btn-danger:hover { background: #a80c2d; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--crust); color: var(--text); }

/* ---------- Flash messages ---------- */
.flash-messages { margin: 1rem 0 0; }

.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: .5rem;
  font-weight: 500;
}

.alert-success { background: rgba(64,160,43,.12);  color: #317a21; border: 1px solid rgba(64,160,43,.25); }
.alert-danger  { background: rgba(210,15,57,.12);  color: #a80c2d; border: 1px solid rgba(210,15,57,.25); }
.alert-warning { background: rgba(223,142,29,.12); color: #a06a10; border: 1px solid rgba(223,142,29,.25); }
.alert-info    { background: rgba(23,146,153,.12); color: #117a7f; border: 1px solid rgba(23,146,153,.25); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--mantle) 0%, #ddf0dd 100%);
  padding: 5rem 0 4rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  color: var(--text);
  margin-bottom: 1rem;
}

.hero h1 span { color: var(--primary); }

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 2rem;
}

/* ---------- Highlights ---------- */
.highlights-section {
  padding: 3rem 0;
  background: var(--surface);
  border-bottom: 1px solid var(--crust);
}

.highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  text-align: center;
}

.highlight-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}

.highlight-icon {
  font-size: 2.2rem;
  margin-bottom: .25rem;
}

.highlight-item strong {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.highlight-item p {
  font-size: .9rem;
  color: var(--text-muted);
  max-width: 240px;
}

.hero-badges {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.hero-badge {
  background: var(--surface);
  color: var(--text);
  font-size: .85rem;
  font-weight: 700;
  padding: .35rem .9rem;
  border-radius: 20px;
  border: 1.5px solid var(--crust);
  box-shadow: var(--shadow);
}

.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Section headings ---------- */
.section-heading {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-heading h2 { font-size: 1.9rem; margin-bottom: .4rem; }
.section-heading p { color: var(--text-muted); }

/* ---------- Info strip ---------- */
.info-strip {
  background: var(--primary);
  color: #fff;
  padding: 2rem 0;
}

.info-strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  text-align: center;
}

.info-item .icon { font-size: 1.8rem; margin-bottom: .4rem; }
.info-item strong { display: block; font-size: 1rem; }
.info-item span { font-size: .9rem; opacity: .85; }

/* ---------- About blurb ---------- */
.about-section {
  padding: 4rem 0;
  text-align: center;
}

.about-section p {
  max-width: 680px;
  margin: 0 auto 1.75rem;
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* ---------- Animal cards grid ---------- */
.animals-section { padding: 3.5rem 0; }

.animals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.animal-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--crust);
}

.animal-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.animal-card a { text-decoration: none; color: inherit; }

.card-photo {
  height: 300px;
  overflow: hidden;
  background: var(--mantle);
  position: relative;
}

.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s;
}

.animal-card:hover .card-photo img { transform: scale(1.04); }

.card-body {
  padding: 1rem 1.1rem 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.card-name { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.card-breed { font-size: .9rem; color: var(--text-muted); }

.card-meta {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: .5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Status badges ---------- */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.badge-available { background: rgba(64,160,43,.15);  color: #317a21; }
.badge-adopted   { background: var(--crust);          color: var(--text-muted); }
.badge-foster    { background: rgba(223,142,29,.15);  color: #a06a10; }
.badge-hold      { background: rgba(210,15,57,.15);   color: #a80c2d; }
.badge-archived  { background: var(--crust);          color: var(--text-muted); }

/* ---------- Filter bar ---------- */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 64px;
  z-index: 90;
}

.filter-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-tabs { display: flex; gap: .5rem; }

.filter-tab {
  padding: .4rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  border: 2px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  text-decoration: none;
  transition: all .2s;
}

.filter-tab:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.filter-divider { width: 1px; height: 24px; background: var(--border); }

.filter-toggle { font-size: .9rem; color: var(--text-muted); display: flex; align-items: center; gap: .4rem; }
.filter-toggle a { color: var(--primary); font-weight: 600; }

.result-count { font-size: .9rem; color: var(--text-muted); margin-left: auto; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.4rem; margin-bottom: .5rem; color: var(--text); }
.empty-state p { margin-bottom: 1.5rem; }

/* ---------- Animal profile ---------- */
.profile-page { padding: 2.5rem 0 4rem; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 1.5rem;
  transition: color .2s;
}
.back-link:hover { color: var(--primary); text-decoration: none; }

.profile-top {
  display: flex;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2rem;
}

.profile-gallery    { flex-shrink: 0; width: 380px; }
.profile-bio-card   { flex: 0 1 420px; min-width: 0; }
.profile-stats-card { flex-shrink: 0; width: 280px; }

.adopt-cta {
  background: rgba(64,160,43,.08);
  border-left: 4px solid var(--secondary);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.adopt-cta strong { color: var(--secondary); display: block; margin-bottom: .4rem; }
.adopt-cta p { font-size: .9rem; color: var(--text-muted); margin: 0; }

.gallery-main {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--mantle);
  height: 560px;
  margin-bottom: .75rem;
  cursor: zoom-in;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.88);
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  opacity: .7;
  background: none;
  border: none;
  padding: 0;
}
.lightbox-close:hover { opacity: 1; }

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumbs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.gallery-thumb {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: border-color .2s;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb.active,
.gallery-thumb:hover { border-color: var(--primary); }

.profile-video {
  margin-top: 1.25rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.profile-video video {
  width: 100%;
  max-height: 400px;
  background: #000;
  display: block;
}

.profile-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  margin-top: 2rem;
}

.profile-bio h2 { font-size: 1.5rem; margin-bottom: .75rem; }
.profile-bio p  { color: var(--text-muted); line-height: 1.8; }

.profile-name {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: .25rem;
}

.profile-subhead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--crust);
  padding: 1.5rem;
  height: fit-content;
}

.stat-card h3 {
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .8rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .95rem;
}

.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-muted); }
.stat-value { font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
  background: #4c4f69;
  color: #cdd6f4;
  padding: 2.5rem 0 1.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-col h4 {
  color: #fff;
  margin-bottom: .75rem;
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.footer-col p,
.footer-col address {
  font-style: normal;
  font-size: .9rem;
  line-height: 1.8;
}

.footer-col a { color: #b5bfe2; }
.footer-col a:hover { color: #fff; text-decoration: none; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 1rem;
  text-align: center;
  font-size: .82rem;
  color: rgba(255,255,255,.45);
}

/* ---------- 404 ---------- */
.not-found {
  text-align: center;
  padding: 6rem 1rem;
}

.not-found h1 { font-size: 5rem; color: var(--primary); }
.not-found h2 { font-size: 1.5rem; margin-bottom: 1rem; }

/* =========================================================
   Admin Panel
   ========================================================= */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: #4c4f69;
  color: #cdd6f4;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.1);
  line-height: 1.35;
}

.sidebar-brand small {
  display: block;
  font-weight: 400;
  font-size: .78rem;
  color: rgba(255,255,255,.5);
  margin-top: .15rem;
}

.sidebar-nav {
  list-style: none;
  padding: 1rem 0;
  flex: 1;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .7rem 1.5rem;
  color: #b5bfe2;
  font-size: .95rem;
  transition: background .15s, color .15s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}

.sidebar-nav .nav-icon { font-size: 1.05rem; width: 1.2rem; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .82rem;
  color: rgba(255,255,255,.4);
}

.sidebar-footer a { color: rgba(255,255,255,.5); }
.sidebar-footer a:hover { color: #fff; }

.admin-content {
  flex: 1;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--crust);
  padding: .9rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-topbar h1 { font-size: 1.3rem; font-weight: 700; color: var(--text); }

.admin-body {
  padding: 1.75rem;
  flex: 1;
}

/* Admin tables */
.admin-table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--crust);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .93rem;
}

.admin-table th {
  text-align: left;
  padding: .85rem 1rem;
  background: var(--mantle);
  border-bottom: 2px solid var(--crust);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

.admin-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--mantle); }

/* Admin forms */
.admin-form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--crust);
  padding: 1.75rem;
  max-width: 820px;
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: .4rem;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: .55rem .85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23,146,153,.15);
}

textarea.form-control { resize: vertical; min-height: 120px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

.form-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .95rem;
}

.form-check input { width: 1.1rem; height: 1.1rem; cursor: pointer; accent-color: var(--primary); }

.form-actions {
  display: flex;
  gap: .75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* Media grid in edit form */
.media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: .75rem;
}

.media-item {
  position: relative;
  width: 130px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  background: var(--mantle);
}

.media-item.is-primary { border-color: var(--primary); }
.media-item[draggable="true"] { cursor: grab; }
.media-item.drag-over { border-color: var(--secondary); opacity: .6; }

.media-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.media-item-actions {
  background: rgba(0,0,0,.55);
  display: flex;
  gap: .3rem;
  padding: .35rem .4rem;
  justify-content: center;
}

.media-item-actions form { margin: 0; }
.media-item-actions .btn { font-size: .72rem; padding: .2rem .5rem; }

.media-primary-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Preview images */
.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: .75rem;
}

.upload-preview img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--border);
}

/* Star toggle */
.btn-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0 .25rem;
  line-height: 1;
  transition: transform .15s;
}

.btn-star:hover { transform: scale(1.25); }
.star-on  { color: #df8e1d; }
.star-off { color: var(--border); }

/* Admin login */
.admin-login-wrap {
  min-height: 100vh;
  background: var(--mantle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-login-card {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--crust);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
}

.admin-login-card h1 { font-size: 1.4rem; margin-bottom: .25rem; }
.admin-login-card p { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.75rem; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 768px) {
  .nav-links { gap: 1rem; }
  .nav-logo-text { display: none; }

  .profile-top { flex-direction: column; }
  .profile-gallery, .profile-bio-card, .profile-stats-card { width: 100%; flex-shrink: unset; }
  .gallery-main { height: 380px; }

  .admin-sidebar { display: none; }
  .admin-shell   { flex-direction: column; }
  .admin-topbar  { padding: .75rem 1rem; }
  .admin-body    { padding: 1rem; }
}

@media (max-width: 500px) {
  .hero { padding: 3rem 0 2.5rem; }
  .filter-inner { gap: .5rem; }
  .info-strip-grid { grid-template-columns: 1fr 1fr; }
}
