@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Playfair+Display:wght@700&display=swap');

/* ── Variables ── */
:root {
  --navy:      #0B2D72;
  --blue:      #0992C2;
  --cyan:      #0AC4E0;
  --cream:     #F6E7BC;
  --white:     #ffffff;
  --bg:        #f0f4fa;
  --sidebar-w: 240px;
  --text:      #1a1a2e;
  --muted:     #6b7a99;
  --border:    #d0e4f0;
  --success:   #10b981;
  --error:     #ef4444;
  --warning:   #f59e0b;
  --radius:    12px;
  --shadow:    0 2px 16px rgba(11,45,114,0.09);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ══════════════════════════════════
   LOGIN PAGE
══════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.login-logo img {
  height: 42px;
  background: var(--white);
  padding: 5px 10px;
  border-radius: 8px;
}
.login-logo span {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 0.5px;
}

.login-card {
  width: 100%;
  background: var(--white);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-card-header {
  background: var(--navy);
  padding: 28px 32px 24px;
}
.login-card-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 4px;
}
.login-card-header p {
  font-size: 0.87rem;
  color: rgba(255,255,255,0.65);
}

.login-form {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field-group input {
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.field-group input:focus { border-color: var(--blue); }

.field-error {
  font-size: 0.82rem;
  color: var(--error);
  display: none;
}
.field-error.visible { display: block; }

.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-login:hover    { opacity: 0.92; transform: translateY(-1px); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.login-footer {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
}

/* ══════════════════════════════════
   ADMIN LAYOUT (all inner pages)
══════════════════════════════════ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo img {
  height: 34px;
  background: var(--white);
  padding: 4px 8px;
  border-radius: 6px;
}
.sidebar-logo span {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--white);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.18s;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--white);
}
.nav-item.active {
  background: rgba(9,196,224,0.12);
  color: var(--cyan);
  border-left-color: var(--cyan);
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.btn-logout {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
}
.btn-logout:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top bar ── */
.topbar {
  background: var(--white);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--blue);
  background: rgba(9,146,194,0.1);
  padding: 4px 12px;
  border-radius: 99px;
}

/* ── Page body ── */
.page-body {
  padding: 32px;
  flex: 1;
}

/* ══════════════════════════════════
   STAT CARDS
══════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--blue);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card.accent-cyan   { border-top-color: var(--cyan); }
.stat-card.accent-navy   { border-top-color: var(--navy); }
.stat-card.accent-cream  { border-top-color: var(--warning); }

.stat-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.stat-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ══════════════════════════════════
   TABLE SECTION
══════════════════════════════════ */
.section-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 28px;
}

.section-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.section-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
}

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-select {
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--white);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--blue); }

/* Buttons */
.btn-export {
  padding: 9px 20px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-export:hover { background: var(--blue); }

/* Table */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead tr {
  background: #f8fafd;
  border-bottom: 2px solid var(--border);
}
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid #f0f4f8;
  transition: background 0.15s;
}
tbody tr:hover { background: #f8fafd; }
tbody td {
  padding: 13px 16px;
  font-size: 0.88rem;
  color: var(--text);
  vertical-align: middle;
}
.td-muted { color: var(--muted); font-size: 0.82rem; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-green  { background: #ecfdf5; color: #059669; }
.badge-blue   { background: rgba(9,146,194,0.12); color: var(--blue); }
.badge-navy   { background: rgba(11,45,114,0.1); color: var(--navy); }
.badge-yellow { background: #fffbeb; color: #d97706; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state p { font-size: 0.9rem; margin-top: 8px; }

/* Loading spinner */
.loading-row td {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ══════════════════════════════════
   MOBILE
══════════════════════════════════ */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--navy);
  border-radius: 2px;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .hamburger-btn {
    display: flex;
  }
  .page-body {
    padding: 20px 16px;
  }
  .topbar {
    padding: 14px 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .stat-value { font-size: 1.6rem; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
}


/* ══════════════════════════════════
   TOPBAR LAYOUT
══════════════════════════════════ */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ══════════════════════════════════
   STATS GRID VARIANTS
══════════════════════════════════ */
.stats-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  max-width: 520px;
  gap: 20px;
  margin-bottom: 28px;
}

/* ══════════════════════════════════
   SECTION CARD ACTIONS
══════════════════════════════════ */
.section-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.section-card-view-all {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--blue);
  text-decoration: none;
}
.section-card-view-all:hover { text-decoration: underline; }

/* ══════════════════════════════════
   PROGRESS BAR (pet type breakdown)
══════════════════════════════════ */
.progress-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-track {
  flex: 1;
  height: 6px;
  background: #f0f4f8;
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 99px;
}

/* ══════════════════════════════════
   MESSAGE MODAL
══════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
}
.modal-overlay.open { display: block; }

.modal-box {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  max-width: 520px;
  width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-box.open { display: block; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.modal-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
}
.modal-email {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 2px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 16px;
}
.modal-message {
  font-size: 0.93rem;
  color: var(--text);
  line-height: 1.8;
  white-space: pre-wrap;
}
.modal-date {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 16px;
}

/* ══════════════════════════════════
   PAGINATION INFO
══════════════════════════════════ */
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-info {
  font-size: 0.83rem;
  color: var(--muted);
}
.pagination-btns { display: flex; gap: 8px; }

.btn-page {
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.18s;
}
.btn-page:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.btn-page:disabled { opacity: 0.35; cursor: not-allowed; }

@media (max-width: 900px) {
  .stats-grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
  .stats-grid-2 { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════
   CONTACTS PAGE
══════════════════════════════════ */
.msg-preview {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 0.85rem;
  display: block;
}
.contacts-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  vertical-align: middle;
}
.btn-view {
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-view:hover { background: var(--blue); color: var(--white); border-color: var(--blue); }

.section-card--gap { margin-bottom: 28px; }