/* Tarantula List Keeper - Styles
   A field notebook inspired design with light/dark mode support
*/

/* ===== CSS Variables ===== */
:root {
  /* Light mode colors - warm, natural palette */
  --color-bg: #f5f3e8;
  --color-bg-alt: #ebe8dc;
  --color-surface: #ffffff;
  --color-surface-hover: #fafaf5;
  --color-border: #d4d0c4;
  --color-border-light: #e8e5d8;

  --color-text: #2c3e20;
  --color-text-secondary: #5a6b4d;
  --color-text-muted: #8a9580;

  --color-primary: #2d5016;
  --color-primary-hover: #3d6820;
  --color-primary-light: #e8f0e0;

  --color-accent: #7cb342;
  --color-accent-hover: #8bc34a;

  --color-success: #43a047;
  --color-warning: #fb8c00;
  --color-error: #e53935;
  --color-info: #1e88e5;

  /* Status colors */
  --status-active: #43a047;
  --status-wishlist: #7b1fa2;
  --status-coming: #1976d2;
  --status-memorial: #616161;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  /* Borders & Shadows */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);

  /* Layout */
  --header-height: 56px;
  --sidebar-width: 260px;
  --max-content-width: 1200px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
}

/* Dark mode */
[data-theme="dark"] {
  --color-bg: #1a1f16;
  --color-bg-alt: #222820;
  --color-surface: #2a3024;
  --color-surface-hover: #323830;
  --color-border: #3a4234;
  --color-border-light: #454d40;

  --color-text: #e8e6dc;
  --color-text-secondary: #b8c0a8;
  --color-text-muted: #8a9580;

  --color-primary: #7cb342;
  --color-primary-hover: #8bc34a;
  --color-primary-light: #2a3524;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.4);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  z-index: 1000;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-md);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-md);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

small {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-alt);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}

/* ===== App Layout ===== */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  gap: var(--space-md);
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.app-title {
  font-size: var(--text-lg);
  font-weight: 600;
  flex: 1;
}

.app-title a {
  color: var(--color-text);
  text-decoration: none;
}

.app-title a:hover {
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Menu toggle */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.menu-toggle:hover {
  background: var(--color-bg-alt);
}

.hamburger {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  position: relative;
  transition: background var(--transition-fast);
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  transition: transform var(--transition-fast);
}

.hamburger::before { top: -6px; }
.hamburger::after { bottom: -6px; }

.menu-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .hamburger::before {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .hamburger::after {
  transform: translateY(-6px) rotate(-45deg);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  z-index: 90;
}

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

.sidebar-overlay {
  position: fixed;
  inset: 0;
  top: var(--header-height);
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
  z-index: 80;
}

.sidebar-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.nav-list {
  list-style: none;
  padding: var(--space-md) 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-link:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 500;
}

.nav-icon {
  font-size: var(--text-lg);
  width: 24px;
  text-align: center;
}

.nav-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-sm) var(--space-lg);
}

/* Main content */
.main-content {
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  padding: var(--space-lg);
  transition: margin-left var(--transition-normal);
}

/* Desktop layout */
@media (min-width: 768px) {
  .menu-toggle {
    display: none;
  }

  .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
  }

  .main-content {
    margin-left: var(--sidebar-width);
  }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-bg-alt);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-hover);
  border-color: var(--color-text-muted);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c62828;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-alt);
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-base);
}

.btn-icon {
  padding: var(--space-sm);
  width: 36px;
  height: 36px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.icon-btn:hover {
  background: var(--color-bg-alt);
}

/* Theme toggle */
.theme-icon::before {
  content: '☀️';
  font-size: var(--text-lg);
}

[data-theme="dark"] .theme-icon::before {
  content: '🌙';
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.form-label-required::after {
  content: ' *';
  color: var(--color-error);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: inherit;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
  outline: none;
}

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

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6b4d' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: calc(var(--space-md) * 2 + 12px);
}

.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.form-checkbox input,
.form-radio input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.form-hint {
  margin-top: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.form-error {
  color: var(--color-error);
}

.form-row {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 640px) {
  .form-row-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.form-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border-light);
}

.form-actions-right {
  justify-content: flex-end;
}

/* ===== Cards ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.card-body {
  padding: var(--space-lg);
}

.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg-alt);
}

/* Animal cards */
.animal-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.animal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  cursor: pointer;
}

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

.animal-card:focus-within {
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.animal-card-status {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.animal-card-status.active { background: var(--status-active); }
.animal-card-status.wishlist { background: var(--status-wishlist); }
.animal-card-status.coming { background: var(--status-coming); }
.animal-card-status.memorial { background: var(--status-memorial); }

.animal-card-photo {
  height: 140px;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.animal-card-photo-placeholder {
  font-size: 3rem;
  opacity: 0.5;
}

.animal-card-body {
  padding: var(--space-md);
  flex: 1;
}

.animal-card-name {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.animal-card-species {
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.animal-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.animal-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px var(--space-xs);
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
}

/* ===== Page sections ===== */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.page-title {
  flex: 1;
  min-width: 200px;
}

.page-actions {
  display: flex;
  gap: var(--space-sm);
}

.section {
  margin-bottom: var(--space-xl);
}

.section-title {
  font-size: var(--text-lg);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}

/* ===== Dashboard ===== */
.dashboard-grid {
  display: grid;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dashboard-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.dashboard-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.dashboard-card-icon {
  font-size: var(--text-xl);
}

.due-list {
  list-style: none;
}

.due-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.due-item:last-child {
  border-bottom: none;
}

.due-item-name {
  flex: 1;
  font-weight: 500;
}

.due-item-type {
  font-size: var(--text-xs);
  padding: 2px var(--space-xs);
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
}

.due-item-overdue {
  color: var(--color-error);
}

.stat-number {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-primary);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ===== Tabs ===== */
.tabs {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-lg);
}

.tab-list {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tab-list::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: var(--space-sm) var(--space-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-panel {
  display: none;
}

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

/* ===== Tables ===== */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th,
.table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

.table th {
  font-weight: 600;
  background: var(--color-bg-alt);
  white-space: nowrap;
}

.table tr:hover td {
  background: var(--color-surface-hover);
}

.table-actions {
  display: flex;
  gap: var(--space-xs);
}

/* ===== Log entries ===== */
.log-list {
  list-style: none;
}

.log-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.log-item:last-child {
  border-bottom: none;
}

.log-date {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  min-width: 90px;
}

.log-content {
  flex: 1;
}

.log-type {
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.log-notes {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ===== Filters & Search ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.filter-select {
  min-width: 140px;
}

/* ===== Modal ===== */
.modal-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-container.open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal {
  position: relative;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.modal-container.open .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg-alt);
}

/* ===== Toast notifications ===== */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideIn var(--transition-normal) ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast-error {
  border-left: 4px solid var(--color-error);
}

.toast-warning {
  border-left: 4px solid var(--color-warning);
}

.toast-info {
  border-left: 4px solid var(--color-info);
}

/* ===== Empty states ===== */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.empty-state-text {
  margin-bottom: var(--space-lg);
}

/* ===== Photo gallery ===== */
.gallery-grid {
  display: grid;
  gap: var(--space-sm);
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.gallery-item {
  aspect-ratio: 1;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-add {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  border: 2px dashed var(--color-border);
  font-size: var(--text-2xl);
  color: var(--color-text-muted);
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.gallery-add:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ===== Labels / Print ===== */
.label-preview {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.label-item {
  padding: var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
}

.label-qr {
  margin: 0 auto var(--space-sm);
}

.label-qr svg {
  max-width: 100px;
}

.label-name {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.label-species {
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.label-location {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

@media print {
  body {
    background: white;
    color: black;
  }

  .app-header,
  .sidebar,
  .sidebar-overlay,
  .toast-container,
  .modal-container,
  .page-header .btn,
  .no-print {
    display: none !important;
  }

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

  .label-preview {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5cm;
  }

  .label-item {
    break-inside: avoid;
    border: 1px solid #000;
  }
}

/* ===== QR Scanner ===== */
.scanner-container {
  max-width: 400px;
  margin: 0 auto;
}

.scanner-video {
  width: 100%;
  aspect-ratio: 1;
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.scanner-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-frame {
  width: 60%;
  aspect-ratio: 1;
  border: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
}

/* ===== Settings ===== */
.settings-section {
  margin-bottom: var(--space-xl);
}

.settings-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item-info {
  flex: 1;
}

.settings-item-title {
  font-weight: 500;
}

.settings-item-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.toggle-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  pointer-events: none;
}

.toggle input:checked + .toggle-slider {
  transform: translateX(20px);
}

.toggle:has(input:checked) {
  background: var(--color-primary);
}

.toggle:has(input:focus-visible) {
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
}

.badge-active {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-wishlist {
  background: #f3e5f5;
  color: #7b1fa2;
}

.badge-coming {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-memorial {
  background: #f5f5f5;
  color: #616161;
}

[data-theme="dark"] .badge-active {
  background: #1b3a1a;
  color: #81c784;
}

[data-theme="dark"] .badge-wishlist {
  background: #2a1a2e;
  color: #ce93d8;
}

[data-theme="dark"] .badge-coming {
  background: #1a2a3a;
  color: #90caf9;
}

[data-theme="dark"] .badge-memorial {
  background: #2a2a2a;
  color: #bdbdbd;
}

/* ===== Animal detail ===== */
.animal-profile {
  display: grid;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

@media (min-width: 768px) {
  .animal-profile {
    grid-template-columns: 200px 1fr;
  }
}

.animal-photo-main {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1;
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.animal-photo-placeholder {
  font-size: 4rem;
  opacity: 0.5;
}

.animal-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.animal-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.animal-name {
  font-size: var(--text-2xl);
  font-weight: 600;
}

.animal-species-name {
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-text-secondary);
}

.animal-meta-grid {
  display: grid;
  gap: var(--space-sm);
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin-top: var(--space-sm);
}

.animal-meta-item {
  padding: var(--space-sm);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
}

.animal-meta-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.animal-meta-value {
  font-weight: 500;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* ===== Vendor link (subtle) ===== */
.vendor-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-primary-light);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-lg);
}

.vendor-link a {
  color: var(--color-primary);
  font-weight: 500;
}

/* ===== Loading ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Utilities ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.hidden { display: none !important; }
