@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');

:root {
  --green-900: #1a4d2e;
  --green-700: #2c8d46;
  --green-500: #3daa5c;
  --green-100: #e8f5ec;
  --sidebar-w: 260px;
  --bg: #f4f6f4;
  --white: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --border: #e5ebe6;
  --shadow: 0 2px 12px rgba(26, 77, 46, 0.06);
  --radius: 10px;
}

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

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

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

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  background: var(--green-700);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.demo-badge {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: #fff3cd;
  color: #856404;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}

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

.nav-item {
  margin-bottom: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
}

.nav-link:hover {
  background: var(--green-100);
  color: var(--green-700);
}

.nav-link.active {
  background: var(--green-700);
  color: white;
}

.nav-link .icon { font-size: 1.1rem; width: 1.4rem; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.back-link:hover { color: var(--green-700); }

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

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar h1 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--green-900);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--green-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.content {
  padding: 2rem;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-card .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--green-700);
}

.stat-card .sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Cards & tables */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.search-input {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  width: 240px;
  transition: border-color 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--green-500);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 0.85rem 1.5rem;
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

tr:hover td { background: #fafcfa; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-green { background: #d4edda; color: #155724; }
.badge-blue { background: #cce5ff; color: #004085; }
.badge-orange { background: #fff3cd; color: #856404; }
.badge-red { background: #f8d7da; color: #721c24; }

/* Enclos grid */
.enclos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.enclos-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.enclos-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  color: var(--green-900);
}

.enclos-type {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.capacity-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.75rem 0;
}

.capacity-fill {
  height: 100%;
  background: var(--green-500);
  border-radius: 4px;
  transition: width 0.4s;
}

.capacity-fill.warning { background: #f0ad4e; }
.capacity-fill.full { background: #d9534f; }

.enclos-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Dashboard recent */
.recent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Section visibility */
.section { display: none; }
.section.active { display: block; }

/* Mobile */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--green-900);
}

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

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

  .main { margin-left: 0; }

  .menu-toggle { display: block; }

  .content { padding: 1rem; }

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

  .search-input { width: 100%; }
}
