/* =============================================
   TIKNO Mascotas - Guarderia Canina
   Ultra Premium Design System
   Paleta: Esmeralda + Oro + Glassmorphism
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-darker: #065f46;
  --primary-light: #a7f3d0;
  --primary-50: #ecfdf5;
  --primary-glow: rgba(5, 150, 105, 0.4);
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --accent-glow: rgba(245, 158, 11, 0.3);
  --gold: #d97706;
  --bg: #f0f4f3;
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-card-solid: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: rgba(226, 232, 240, 0.8);
  --border-light: rgba(241, 245, 249, 0.6);

  /* Elevation system - 4 levels */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03);
  --shadow: 0 2px 4px rgba(0,0,0,0.04), 0 4px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.04), 0 8px 16px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.06), 0 16px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 16px 32px rgba(0,0,0,0.08), 0 24px 48px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-blur: blur(20px);
}

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

/* ---- CUSTOM SCROLLBAR ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(5, 150, 105, 0.25);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(5, 150, 105, 0.45);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(5, 150, 105, 0.25) transparent;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  /* Subtle geometric pattern background */
  background-image:
    radial-gradient(circle at 25% 25%, rgba(5, 150, 105, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(245, 158, 11, 0.02) 0%, transparent 50%),
    linear-gradient(45deg, transparent 48%, rgba(5, 150, 105, 0.015) 49%, rgba(5, 150, 105, 0.015) 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(5, 150, 105, 0.015) 49%, rgba(5, 150, 105, 0.015) 51%, transparent 52%);
  background-size: 100% 100%, 100% 100%, 60px 60px, 60px 60px;
  background-attachment: fixed;
}

/* ---- LAYOUT ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #0c1220 0%, #132218 40%, #0f1f17 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  border-right: 1px solid rgba(5, 150, 105, 0.1);
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(5, 150, 105, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 100%, rgba(245, 158, 11, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.sidebar-brand {
  padding: 28px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: relative;
}

.sidebar-brand h1 {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand h1 .brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, #34d399 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4), 0 0 20px rgba(5, 150, 105, 0.15);
  animation: brandGlow 3s ease-in-out infinite alternate;
}

@keyframes brandGlow {
  0% { box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4), 0 0 20px rgba(5, 150, 105, 0.15); }
  100% { box-shadow: 0 4px 16px rgba(5, 150, 105, 0.55), 0 0 30px rgba(5, 150, 105, 0.25); }
}

.sidebar-brand p {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  margin-top: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: linear-gradient(180deg, #34d399, var(--primary));
  border-radius: 0 4px 4px 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(5, 150, 105, 0.2) 0%, rgba(5, 150, 105, 0.05) 100%);
  color: #6ee7b7;
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

.nav-item .nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: linear-gradient(135deg, var(--primary) 0%, #34d399 100%);
  color: white;
  font-size: 0.65rem;
  padding: 3px 9px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.sidebar-footer {
  padding: 18px 22px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.25);
  font-weight: 400;
}

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- TOP BAR ---- */
.top-bar {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-bar-left h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}

.top-bar-left p {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-refresh {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
}

.btn-refresh:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.08);
}

.current-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ---- PAGE CONTENT ---- */
.page-content {
  flex: 1;
  padding: 32px;
}

.view { display: none; }
.view.active {
  display: block;
  animation: fadeInView 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Alias for compat */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
}

@keyframes staggerIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Subtle gradient overlay per card */
.stat-card:nth-child(1)::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.stat-card:nth-child(2)::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.stat-card:nth-child(3)::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.stat-card:nth-child(4)::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.stat-card:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(5, 150, 105, 0.08);
  transform: translateY(-4px);
  border-color: rgba(5, 150, 105, 0.15);
}

.stat-card .stat-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ---- TOOLBAR ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--bg-card);
  transition: var(--transition);
  font-family: inherit;
  backdrop-filter: blur(10px);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1), 0 0 20px rgba(5, 150, 105, 0.05);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.search-box input:focus ~ .search-icon,
.search-box:focus-within .search-icon {
  color: var(--primary);
}

.filter-group {
  display: flex;
  gap: 3px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.filter-btn {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.filter-btn.active, .filter-btn:hover {
  background: var(--bg-card-solid);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.filter-btn.active {
  font-weight: 600;
}

/* ---- BUTTONS ---- */
.btn {
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #34d399 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

/* Shimmer on primary button */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: none;
  animation: btnShimmer 3s ease-in-out infinite;
}

@keyframes btnShimmer {
  0%, 100% { left: -100%; }
  50% { left: 120%; }
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #059669 100%);
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.06);
}

.btn-danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
  transform: translateY(-2px);
}

.btn-danger:active {
  transform: translateY(0) scale(0.98);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.75rem;
  border-radius: 8px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.08);
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: translateY(0) scale(0.95);
}

/* ---- TABLE ---- */
.table-container {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
}

.table-container th {
  padding: 14px 18px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.04) 0%, rgba(5, 150, 105, 0.01) 100%);
  border-bottom: 1px solid var(--border);
}

.table-container td {
  padding: 14px 18px;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(241, 245, 249, 0.5);
  vertical-align: middle;
  transition: var(--transition-fast);
}

.table-container tr:last-child td { border-bottom: none; }

/* Subtle alternating stripe */
.table-container tbody tr:nth-child(even) td {
  background: rgba(5, 150, 105, 0.015);
}

.table-container tr:hover td {
  background: rgba(5, 150, 105, 0.05);
}

.dog-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dog-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary-light) 0%, #d1fae5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.12);
  border: 2px solid rgba(5, 150, 105, 0.1);
}

.dog-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.dog-name { font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.dog-breed { font-size: 0.73rem; color: var(--text-muted); font-weight: 400; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.01em;
  position: relative;
}

/* Animated pulse dot inside status badges */
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}

.status-badge:hover { opacity: 0.85; transform: scale(1.04); }

.time-badge {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.actions-cell {
  display: flex;
  gap: 6px;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3.5rem;
  margin-bottom: 18px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 22px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}

.modal {
  background: var(--bg-card-solid);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalSpring 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255,255,255,0.6);
}

@keyframes modalSpring {
  0% { opacity: 0; transform: translateY(30px) scale(0.95); }
  60% { transform: translateY(-4px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Keep old keyframe for compat */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.04) 0%, transparent 100%);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text);
  background: rgba(0,0,0,0.04);
}

.modal-body { padding: 26px; }

.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(248, 250, 252, 0.5);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ---- FORMS ---- */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
  transition: var(--transition);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--bg-card-solid);
  color: var(--text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1), 0 0 16px rgba(5, 150, 105, 0.06);
}

.form-group input:focus + label,
.form-group:focus-within label {
  color: var(--primary);
}

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

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

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  border-radius: 4px;
}

.form-check span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- PHOTO UPLOAD ---- */
.photo-upload {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.photo-preview {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light) 0%, #d1fae5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  overflow: hidden;
  flex-shrink: 0;
  border: 3px solid rgba(5, 150, 105, 0.15);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.1);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-upload-btn {
  padding: 10px 18px;
  border: 2px dashed rgba(5, 150, 105, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(5, 150, 105, 0.03);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: var(--transition);
  font-weight: 500;
}

.photo-upload-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(5, 150, 105, 0.06);
}

/* ---- DOG PROFILE CARD ---- */
.dogs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.dog-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: staggerIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.dog-card:nth-child(1) { animation-delay: 0ms; }
.dog-card:nth-child(2) { animation-delay: 60ms; }
.dog-card:nth-child(3) { animation-delay: 120ms; }
.dog-card:nth-child(4) { animation-delay: 180ms; }
.dog-card:nth-child(5) { animation-delay: 240ms; }
.dog-card:nth-child(6) { animation-delay: 300ms; }

.dog-card:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(5, 150, 105, 0.1);
  transform: translateY(-4px);
  border-color: rgba(5, 150, 105, 0.2);
}

.dog-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.dog-card-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light) 0%, #d1fae5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.12);
  border: 2px solid rgba(5, 150, 105, 0.1);
}

.dog-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dog-card-info h3 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dog-card-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.dog-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  background: rgba(5, 150, 105, 0.05);
  border: 1px solid rgba(5, 150, 105, 0.08);
  border-radius: 8px;
  font-size: 0.73rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.dog-card-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--border), transparent) 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.visit-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- DOG DETAIL ---- */
.dog-detail-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.dog-detail-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light) 0%, #d1fae5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 4px solid rgba(5, 150, 105, 0.15);
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.15);
}

.dog-detail-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-section {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
  transition: var(--transition);
}

.detail-section:hover {
  box-shadow: var(--shadow-sm);
}

.detail-section h4 {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

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

.detail-item label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  font-weight: 600;
}

.detail-item span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

/* ---- HISTORY TABLE ---- */
.history-list {
  max-height: 300px;
  overflow-y: auto;
}

/* ---- STATUS DROPDOWN ---- */
.status-dropdown {
  position: absolute;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  padding: 6px;
  z-index: 60;
  min-width: 170px;
  animation: dropdownIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.status-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: var(--text);
}

.status-option:hover {
  background: rgba(5, 150, 105, 0.06);
  color: var(--primary-dark);
}

/* ---- TOAST / NOTIFICATIONS ---- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), fadeOut 0.3s ease 2.7s;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}

.toast-success {
  background: linear-gradient(135deg, #059669 0%, #34d399 100%);
  color: white;
}

.toast-error {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: white;
}

.toast-info {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: white;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100px) scale(0.9); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* Keep old keyframe for compat */
@keyframes slideIn {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ---- LOADING ---- */
.loading-spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(5, 150, 105, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg,
    rgba(5, 150, 105, 0.04) 25%,
    rgba(5, 150, 105, 0.08) 50%,
    rgba(5, 150, 105, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; }

  .menu-toggle { display: block; }

  .top-bar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .top-bar-right {
    gap: 8px;
  }

  .page-content { padding: 16px; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
    gap: 10px;
  }

  .stat-card .stat-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
  }

  .stat-card .stat-icon svg {
    width: 18px;
    height: 18px;
  }

  .stat-card .stat-value {
    font-size: 1.35rem;
  }

  .stat-card .stat-label {
    font-size: 0.65rem;
  }

  /* Hide trend arrow on mobile */
  .stat-card > .ml-auto {
    display: none;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search-box { min-width: auto; }

  .filter-group {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .filter-group::-webkit-scrollbar { display: none; }

  .filter-btn {
    padding: 6px 10px;
    font-size: 0.7rem;
  }

  .form-row { grid-template-columns: 1fr; }

  .dogs-grid { grid-template-columns: 1fr; }

  .dog-detail-header { flex-direction: column; align-items: center; text-align: center; }
  .detail-grid { grid-template-columns: 1fr; }

  .modal {
    max-width: 100%;
    margin: 10px;
    border-radius: var(--radius-lg);
    max-height: 95vh;
  }
  .modal-header { border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-footer { border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 14px 18px; }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
  }
  .table-container table { min-width: 580px; }

  .table-container th { padding: 10px 12px; font-size: 0.65rem; }
  .table-container td { padding: 10px 12px; font-size: 0.8rem; }

  .stat-card { border-radius: var(--radius); }
  .dog-card { border-radius: var(--radius); }

  .btn { padding: 8px 16px; font-size: 0.8rem; }
  .btn-sm { padding: 5px 10px; font-size: 0.7rem; }

  .toast-container { top: 10px; right: 10px; left: 10px; }
  .toast { font-size: 0.8rem; padding: 10px 14px; }
}

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

  .stat-card {
    padding: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .stat-card .stat-value { font-size: 1.5rem; }
  .stat-card .stat-label { font-size: 0.65rem; }

  .top-bar-left h2 { font-size: 1.1rem; }
  .page-content { padding: 12px; }

  .dog-card { padding: 16px; }
}

/* ---- SIDEBAR OVERLAY (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 45;
}

.sidebar-overlay.active { display: block; }
