:root {
  --green: #2e7d32;
  --green-dark: #1b5e20;
  --bg: #f6f8f5;
  --card-bg: #ffffff;
  --border: #ddd;
  --text: #222;
  --muted: #666;
  --danger: #c62828;
  --warn-bg: #fff3e0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 360px;
}
.login-box h1 { text-align: center; color: var(--green-dark); margin-top: 0; }

/* Top bar */
.topbar {
  background: var(--green-dark);
  color: white;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; }
.topbar nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: white; text-decoration: none; opacity: 0.9; }
.topbar nav a:hover { opacity: 1; text-decoration: underline; }
.topbar .who { opacity: 0.8; font-size: 0.9rem; }
.topbar .logout { background: rgba(255,255,255,0.15); padding: 0.3rem 0.7rem; border-radius: 6px; }

.container { max-width: 1000px; margin: 0 auto; padding: 1rem; }

/* Forms */
form label { display: block; margin-bottom: 0.9rem; font-weight: 600; font-size: 0.9rem; }
input, select, textarea {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 1rem;
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

button, .btn {
  background: var(--green);
  color: white;
}
button:hover, .btn:hover { background: var(--green-dark); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8e0000; }
.btn.primary { background: var(--green); }
a.btn, a.clear-link { 
    background: lightgrey; 
    color: var(--muted);     
}

button, .btn, a.clear-link {
  /* 1. Force identical layout calculation models */
  box-sizing: border-box;
  
  /* 2. Align their baselines identically on the page */
  vertical-align: middle;

  /* 3. Strip browser-specific native heights */
  height: auto; 

  /* Keep your existing style properties below */
  display: inline-block;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  line-height: 1.5; 
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }

/* Search bar */
.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}
.search-bar input[type="search"] { flex: 2; min-width: 200px; margin-top: 0; }
.search-bar select { flex: 1; min-width: 140px; margin-top: 0; }
.search-bar button { flex: 0; }

.result-count { color: var(--muted); font-size: 0.9rem; }

/* Cards */
.card-list { display: flex; flex-direction: column; gap: 0.75rem; }
.plant-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.plant-card-main {width: calc(100% - 140px)}
.plant-card-main h3 { margin: 0 0 0.2rem; color: var(--green-dark); }
.plant-card .common { color: var(--muted); margin: 0 0 0.4rem; font-style: italic; }
.tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.tag {
  background: #e8f5e9;
  color: var(--green-dark);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
}
.plant-card .meta { font-size: 0.85rem; color: var(--muted); margin: 0.2rem 0; }
.plant-card .warning {
  background: var(--warn-bg);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin: 0.4rem 0 0;
}
.plant-card-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.plant-card-actions form { margin: 0; }

/* Messages */
.error { background: #ffebee; color: var(--danger); padding: 0.6rem 1rem; border-radius: 8px; }
.flash { background: #e8f5e9; color: var(--green-dark); padding: 0.6rem 1rem; border-radius: 8px; }
.notice { background: #fff3e0; color: #a05a00; padding: 0.6rem 1rem; border-radius: 8px; }
.help-text { font-size: 0.85rem; color: var(--muted); }
.empty { color: var(--muted); padding: 2rem; text-align: center; }

/* @media (max-width: 600px) {
  .plant-card { flex-direction: column; }
  .plant-card-actions { width: 100%; }
  .plant-card-actions .btn { flex: 1; }
} */

/* Thumbnails on cards */
.plant-card { align-items: center; }
.plant-card-photo {
  max-width: 120px;
  max-height: 120px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #eef3ec;
}
.plant-card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plant-card-main h3 a { color: var(--green-dark); text-decoration: none; }
.plant-card-main h3 a:hover { text-decoration: underline; }

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: #eef3ec;
  border-radius: 8px;
}
.thumb-placeholder.large { font-size: 3.5rem; }

/* Thumbnail field in form */
.thumbnail-field { margin-bottom: 1.2rem; }
.thumbnail-preview { width: 120px; height: 120px; border-radius: 10px; overflow: hidden; margin: 0.4rem 0; }
.thumbnail-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.checkbox-label { font-weight: 400; display: flex; align-items: center; gap: 0.4rem; }
.checkbox-label input { width: auto; margin: 0; }

/* Gallery */
.gallery-section { margin-top: 2rem; background: var(--card-bg); padding: 1rem; border-radius: 10px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
  margin: 0.6rem 0 1rem;
}
.gallery-item { position: relative; display: block; }
.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.gallery-item form { margin-top: 0.3rem; }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.8rem; width: 100%; }
.gallery-upload-form { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.gallery-upload-form label { flex: 1; min-width: 200px; }

/* Profile page */
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--green-dark); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.profile-header {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  background: var(--card-bg);
  padding: 1.2rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.profile-photo { width: 160px; height: 160px; flex-shrink: 0; border-radius: 12px; overflow: hidden; }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-title h2 { margin: 0 0 0.2rem; color: var(--green-dark); }
.profile-title .common { color: var(--muted); font-style: italic; margin: 0 0 0.8rem; }
.profile-details {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 0.4rem 1.2rem;
  margin-bottom: 1rem;
}
.profile-row {
  display: flex;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.profile-row:last-child { border-bottom: none; }
.profile-label { flex: 0 0 160px; font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.profile-value { flex: 1; }
@media (max-width: 600px) {
  .profile-header { flex-direction: column; align-items: center; text-align: center; }
  .profile-row { flex-direction: column; gap: 0.2rem; }
  .profile-label { flex: none; }
}

.checkboxSet {
    box-sizing: border-box;
    display: flex;
    gap: 15px; 
    align-items: center;
}

.buttonLabel {
    border: 1px solid gray;
    border-radius: 10px;
    padding: .5em;
}

.checkboxSet input[type="checkbox"] {
    position: absolute;
    transform: scale(0);
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
}

.checkboxSet label:has(input:checked) {
  background: #91d191; /* Green */
  font-weight: bold;
}