:root {
  /* Dark Mode (default) */
  --bg: #0a1f1a;
  --bg-alt: #112d26;
  --text: #e8f5f0;
  --text-dim: rgba(232, 245, 240, 0.6);
  --primary: #4ade80;
  --primary-strong: #22c55e;
  --accent: #fbbf24;
  --danger: #ef4444;
  --card: rgba(17, 45, 38, 0.85);
  --card-bg: rgba(17, 45, 38, 0.9);
  --border: rgba(74, 222, 128, 0.2);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --bg-gradient-1: rgba(34, 197, 94, 0.15);
  --bg-gradient-2: rgba(251, 191, 36, 0.1);
  --bg-shape-1: #22c55e;
  --bg-shape-2: #fbbf24;
  --stat-bg: rgba(74, 222, 128, 0.08);
  --table-bg: rgba(17, 45, 38, 0.4);
  --table-header-bg: rgba(74, 222, 128, 0.15);
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-bg-focus: rgba(255, 255, 255, 0.08);
  --tab-bg: rgba(17, 45, 38, 0.6);
  --tab-hover-bg: rgba(74, 222, 128, 0.15);
  --tabs-container-bg: rgba(74, 222, 128, 0.05);
}

[data-theme="light"] {
  /* Light Mode - Agricultural Theme */
  --bg: #f5f3e8;
  --bg-alt: #fdfcf7;
  --text: #2d3a2e;
  --text-dim: rgba(45, 58, 46, 0.65);
  --primary: #2d7a3f;
  --primary-strong: #1f5c2f;
  --accent: #d68c00;
  --danger: #c53030;
  --card: rgba(253, 252, 247, 0.95);
  --card-bg: rgba(253, 252, 247, 0.98);
  --border: rgba(45, 122, 63, 0.2);
  --shadow: 0 8px 32px rgba(45, 58, 46, 0.12);
  --bg-gradient-1: rgba(139, 195, 74, 0.25);
  --bg-gradient-2: rgba(255, 193, 7, 0.2);
  --bg-shape-1: #8bc34a;
  --bg-shape-2: #ffc107;
  --stat-bg: rgba(139, 195, 74, 0.15);
  --table-bg: rgba(255, 255, 255, 0.7);
  --table-header-bg: rgba(139, 195, 74, 0.2);
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-bg-focus: rgba(255, 255, 255, 1);
  --tab-bg: rgba(253, 252, 247, 0.8);
  --tab-hover-bg: rgba(139, 195, 74, 0.2);
  --tabs-container-bg: rgba(139, 195, 74, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(10, 31, 26, 0.95) 0%, rgba(17, 45, 38, 0.9) 100%),
    repeating-linear-gradient(90deg, transparent 0px, transparent 2px, rgba(74, 222, 128, 0.03) 2px, rgba(74, 222, 128, 0.03) 4px),
    repeating-linear-gradient(0deg, transparent 0px, transparent 2px, rgba(74, 222, 128, 0.03) 2px, rgba(74, 222, 128, 0.03) 4px),
    radial-gradient(circle at 20% 30%, var(--bg-gradient-1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, var(--bg-gradient-2) 0%, transparent 50%),
    var(--bg);
  overflow-x: hidden;
  position: relative;
  transition: background 0.3s ease, color 0.3s ease;
}

[data-theme="light"] body {
  background:
    linear-gradient(135deg, rgba(245, 243, 232, 0.98) 0%, rgba(253, 252, 247, 0.95) 100%),
    repeating-linear-gradient(90deg, transparent 0px, transparent 2px, rgba(139, 195, 74, 0.04) 2px, rgba(139, 195, 74, 0.04) 4px),
    repeating-linear-gradient(0deg, transparent 0px, transparent 2px, rgba(139, 195, 74, 0.04) 2px, rgba(139, 195, 74, 0.04) 4px),
    radial-gradient(circle at 20% 30%, var(--bg-gradient-1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, var(--bg-gradient-2) 0%, transparent 50%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(74, 222, 128, 0.1) 0%, transparent 25%),
    radial-gradient(circle at 85% 80%, rgba(251, 191, 36, 0.08) 0%, transparent 25%);
  animation: pulse 8s ease-in-out infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.bg-shape {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.2;
}

.bg-shape-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--bg-shape-1) 0%, transparent 70%);
  top: -100px;
  right: -100px;
  animation: float 20s ease-in-out infinite;
}

.bg-shape-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--bg-shape-2) 0%, transparent 70%);
  left: -100px;
  bottom: -100px;
  animation: float 15s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

.container {
  width: min(1160px, 94vw);
  margin: 24px auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.login-card {
  width: min(460px, 100%);
  margin: 9vh auto;
  padding: 36px;
  animation: rise 450ms ease;
  background: var(--card);
  box-shadow: 0 12px 40px rgba(45, 58, 46, 0.15);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-icon {
  display: block;
  width: 80px;
  height: 80px;
  max-width: 80px;
  max-height: 80px;
  margin: 0 auto 16px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(45, 122, 63, 0.3));
  animation: bounce 2s ease-in-out infinite;
}

.login-card:hover .login-icon {
  animation: bounce 0.6s ease-in-out;
}

[data-theme="light"] .login-icon {
  filter: drop-shadow(0 6px 12px rgba(139, 195, 74, 0.4));
}

.login-header h1 {
  margin: 8px 0;
  font-size: 2.2rem;
  color: var(--primary);
  font-weight: 800;
}

.login-subtitle {
  margin: 8px 0 0;
  color: var(--text);
  opacity: 0.7;
  font-size: 1rem;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  margin-top: 0;
}

.form-group input:focus,
.form-group select:focus {
  transform: translateY(-1px);
}

input::placeholder {
  font-size: 0.93rem;
}

.checkbox-group {
  margin: 8px 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-label span {
  font-size: 0.95rem;
  color: var(--text-dim);
}

.btn-primary {
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  font-size: 1.05rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(45, 122, 63, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(45, 122, 63, 0.5);
}

.login-footer {
  margin-top: 24px;
  text-align: center;
}

.login-footer .hint {
  margin: 12px 0;
  padding: 12px;
  background: rgba(139, 195, 74, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

.login-footer .auth-links {
  margin-top: 16px;
}

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--primary);
}

h1 {
  text-align: center;
  font-size: 2rem;
  line-height: 1.2;
}

label {
  display: block;
  margin-top: 14px;
  font-weight: 700;
  color: var(--text);
}

hr {
  margin: 24px 0;
  border: none;
  border-top: 1px solid var(--border);
  opacity: 0.5;
}

input,
select,
textarea,
button {
  width: 100%;
  margin-top: 6px;
  padding: 13px 16px;
  border-radius: 10px;
  border: 2px solid rgba(74, 222, 128, 0.3);
  font-size: 0.98rem;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
  transition: background 0.2s ease, border-color 0.2s ease;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  border: 2px solid rgba(45, 122, 63, 0.35);
  background: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] button {
  border: none;
}

input::placeholder,
select::placeholder,
textarea::placeholder {
  color: var(--text);
  opacity: 0.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--input-bg-focus);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 122, 63, 0.12);
}

textarea {
  min-height: 90px;
}

button {
  border: 0;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

button:hover {
  background: var(--primary-strong);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
}

[data-theme="light"] button:hover {
  box-shadow: 0 6px 20px rgba(45, 122, 63, 0.4);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #dc2626;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.hint {
  margin-top: 14px;
  font-size: 0.9rem;
  opacity: 0.75;
  text-align: center;
  color: var(--text);
}

.auth-links {
  margin-top: 12px;
  font-size: 0.95rem;
  text-align: center;
}

.auth-links a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-links a:hover {
  color: var(--primary-strong);
  text-decoration: underline;
}

.hidden {
  display: none;
}

.app-header {
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border-bottom: 2px solid var(--primary);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

[data-theme="light"] .app-header {
  background: rgba(253, 252, 247, 0.98);
  box-shadow: 0 2px 8px rgba(45, 58, 46, 0.1);
}

.app-header .logo h2 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--stat-bg);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--primary);
  transform: translateY(0) rotate(20deg);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

[data-theme="light"] .theme-toggle:hover {
  box-shadow: 0 4px 12px rgba(139, 195, 74, 0.4);
}

.theme-icon {
  display: block;
  line-height: 1;
}

.user-menu {
  position: relative;
}

.user-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: var(--bg-alt);
  font-weight: 700;
  font-size: 1.1rem;
  border: 2px solid var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
}

[data-theme="light"] .user-icon {
  color: #fff;
  box-shadow: 0 2px 8px rgba(45, 122, 63, 0.3);
}

.user-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

[data-theme="light"] .user-icon:hover {
  box-shadow: 0 0 20px rgba(139, 195, 74, 0.6);
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
  animation: dropIn 0.2s ease;
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-info {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.user-info strong {
  display: block;
  color: var(--primary);
}

.dropdown-item {
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: 0;
  margin: 0;
}

.dropdown-item:hover {
  background: rgba(74, 222, 128, 0.1);
  transform: none;
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.grid {
  display: grid;
  gap: 14px;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 18px 0;
}

.stat-card {
  padding: 16px;
  border-radius: 12px;
  background: var(--stat-bg);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.stat-card span {
  color: var(--text);
  opacity: 0.7;
  font-size: 0.9rem;
}

.stat-card strong {
  display: block;
  font-size: 1.5rem;
  margin-top: 5px;
  color: var(--primary);
}

.tabs-card {
  padding: 16px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  background: var(--tabs-container-bg);
  border-radius: 12px;
}

.tab-btn {
  width: auto;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--tab-bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: var(--tab-hover-bg);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.tab-btn.active {
  background: var(--primary);
  color: var(--bg-alt);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

[data-theme="light"] .tab-btn.active {
  color: #fff;
  box-shadow: 0 4px 12px rgba(139, 195, 74, 0.4);
}

.tab-panel {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--table-bg);
}

th {
  background: var(--table-header-bg);
  color: var(--primary);
  font-weight: 700;
}

th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  vertical-align: top;
}

.message {
  margin: 8px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.message.error {
  color: var(--danger);
}

.message.ok {
  color: var(--primary);
}

@keyframes rise {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@media (max-width: 920px) {
  .tab-panel {
    grid-template-columns: 1fr;
  }

  .app-header .logo h2 {
    font-size: 1.1rem;
  }

  .tabs {
    gap: 6px;
    padding: 6px;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 0.88rem;
  }

  .stats {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card strong {
    font-size: 1.3rem;
  }
}

/* Light Mode Enhanced Styles for Login/Signup Pages */
[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(139, 195, 74, 0.3);
  box-shadow: 0 16px 48px rgba(45, 122, 63, 0.12);
}

[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, #2d7a3f 0%, #1f5c2f 100%);
  box-shadow: 0 6px 16px rgba(45, 122, 63, 0.35);
}

[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 10px 24px rgba(45, 122, 63, 0.5);
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 195, 74, 0.2);
}

@media (max-width: 600px) {
  .container {
    width: 100%;
    margin: 0;
  }

  .app-header {
    padding: 10px 14px;
  }

  .app-header .logo h2 {
    font-size: 1rem;
  }

  .user-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .tabs-card {
    padding: 12px;
    border-radius: 0;
  }

  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .tab-btn {
    white-space: nowrap;
  }

  .login-icon {
    width: 60px;
    height: 60px;
    max-width: 60px;
    max-height: 60px;
  }

  .login-card {
    padding: 24px;
    width: 95%;
    max-width: 380px;
  }
}

/* Modal Styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 28px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
  border: 2px solid rgba(74, 222, 128, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .modal-content input,
[data-theme="light"] .modal-content select,
[data-theme="light"] .modal-content textarea {
  border: 2px solid rgba(45, 122, 63, 0.4);
  background: rgba(255, 255, 255, 1);
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

[data-theme="light"] .modal-content input:focus,
[data-theme="light"] .modal-content select:focus,
[data-theme="light"] .modal-content textarea:focus {
  box-shadow: 0 0 0 3px rgba(45, 122, 63, 0.15);
}

.close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px 8px;
  line-height: 1;
}

.close-modal:hover {
  color: var(--text);
}

/* Animal Cards */
.animals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.animal-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.animal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(74, 222, 128, 0.2);
  border-color: var(--primary);
}

.animal-card-image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.animal-card-placeholder {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), rgba(34, 197, 94, 0.05));
  border-radius: 8px;
  margin-bottom: 12px;
}

.animal-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text);
}

.animal-card-tag {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: 0 0 8px 0;
}

.animal-card-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 4px;
}

.badge-for-sale {
  background: var(--primary);
  color: #000;
}

.animal-tooltip {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translate(-50%, -100%);
  background: rgba(0, 0, 0, 0.95);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.animal-card:hover .animal-tooltip {
  opacity: 1;
}

/* Animal Detail View */
.animal-detail-container {
  max-width: 1000px;
  margin: 0 auto;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-header h2 {
  margin: 0;
  font-size: 1.8rem;
}

.detail-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 28px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  margin-bottom: 24px;
}

.detail-image-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.animal-detail-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.animal-placeholder-image {
  width: 100%;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 96px;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), rgba(34, 197, 94, 0.05));
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.image-upload-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.image-upload-buttons .btn-small {
  flex: 1;
  min-width: 120px;
  white-space: nowrap;
}

.detail-info-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 12px;
  align-items: center;
}

.detail-row label {
  font-weight: 600;
  color: var(--text-dim);
}

.edit-field {
  padding: 8px 12px;
  border: 2px solid rgba(74, 222, 128, 0.35);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

[data-theme="light"] .edit-field {
  border: 2px solid rgba(45, 122, 63, 0.4);
  background: rgba(255, 255, 255, 0.95);
}

.edit-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

[data-theme="light"] .edit-field:focus {
  box-shadow: 0 0 0 3px rgba(45, 122, 63, 0.15);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-small:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.btn-secondary {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary);
}

.history-section {
  margin-top: 32px;
}

.history-section h3 {
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.history-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.history-card h4 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--primary);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-action {
  padding: 10px 18px;
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(74, 222, 128, 0.3);
}

.btn-action-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 16px;
  font-size: 0.85rem;
}

.btn-action-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary);
}

.view-toggle {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.view-toggle-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.view-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.view-toggle-btn.active {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
  font-weight: 600;
}

.view-container {
  display: none;
}

.view-container.active {
  display: block;
}

/* Responsive adjustments for detail view */
@media (max-width: 920px) {
  .detail-card {
    grid-template-columns: 1fr;
  }
  
  .detail-row {
    grid-template-columns: 140px 1fr auto;
  }
  
  .animals-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 600px) {
  .detail-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .detail-row label {
    font-size: 0.85rem;
  }
  
  .animals-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  
  .animal-card-image,
  .animal-card-placeholder {
    height: 120px;
  }
}
