/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --green: #2e7d32;
  --green-dark: #1b5e20;
  --text: #1f2a1f;
  --muted: #6b7a6b;
  --border: #dde5dd;
  --bg: #f6f8f6;
  --danger: #c62828;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

main {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

a { color: var(--green); }

h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: white;
  border-bottom: 1px solid var(--border);
}

.site-header .brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-header nav a { text-decoration: none; }

.user-name { color: var(--muted); font-size: 0.9rem; }

/* Dropdown (household switcher) */
.dropdown { position: relative; }

.dropdown summary {
  cursor: pointer;
  list-style: none;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: white;
  font-weight: 600;
}

.dropdown summary::-webkit-details-marker { display: none; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  min-width: 12rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.dropdown-menu form { display: contents; }

.dropdown-menu button,
.dropdown-menu a {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: none;
  background: none;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  border-radius: 0.3rem;
  text-decoration: none;
}

.dropdown-menu button:hover,
.dropdown-menu a:hover { background: var(--bg); }

.dropdown-menu button.current { font-weight: 700; color: var(--green-dark); }

/* Flash messages */
.flashes { max-width: 56rem; margin: 1rem auto 0; padding: 0 1rem; }

.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 0.4rem;
  margin-bottom: 0.5rem;
}

.flash-notice { background: #e3f2e5; color: var(--green-dark); }
.flash-alert { background: #fdecea; color: var(--danger); }

/* Cards & forms */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card.narrow, .auth-card { max-width: 28rem; }

.auth-card {
  margin: 15vh auto 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 2rem;
  text-align: center;
}

.field { margin-bottom: 1rem; }

.field label { display: block; font-weight: 600; margin-bottom: 0.25rem; }

.field input[type="text"],
.field input[type="email"],
.field select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  font: inherit;
  background: white;
}

.field.inline { display: flex; gap: 0.5rem; }
.field.inline input { flex: 1; }

input[type="submit"], .primary-button, .google-button {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 0.4rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

input[type="submit"]:hover, .primary-button:hover, .google-button:hover { background: var(--green-dark); }

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--green);
  text-decoration: underline;
  cursor: pointer;
}

.link-button.danger, .danger-button { color: var(--danger); }

.danger-button {
  background: none;
  border: 1px solid var(--danger);
  border-radius: 0.4rem;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.danger-button:hover { background: #fdecea; }

.errors {
  background: #fdecea;
  color: var(--danger);
  border-radius: 0.4rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
}

.errors p { margin: 0; }

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

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Filter pills */
.filter-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }

.filter-pills a {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
}

.filter-pills a.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

/* Plants table */
.plants-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  overflow: hidden;
}

.plants-table th, .plants-table td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.plants-table th { background: var(--bg); font-size: 0.85rem; text-transform: uppercase; color: var(--muted); }

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

.plants-table .actions { display: flex; gap: 0.75rem; align-items: center; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.category-badge { background: #e8eaf6; color: #303f9f; }

.condition-healthy { background: #e3f2e5; color: var(--green-dark); }
.condition-needs_attention { background: #fff3e0; color: #e65100; }
.condition-sick { background: #fdecea; color: var(--danger); }
.condition-dormant { background: #eceff1; color: #455a64; }
.condition-dead { background: #37474f; color: white; }

/* Lists (members, invitations, categories) */
.list { list-style: none; padding: 0; margin: 0 0 1rem; }

.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.list li:last-child { border-bottom: none; }

.list small { color: var(--muted); margin-left: 0.5rem; }

.list .actions { display: flex; gap: 0.75rem; align-items: center; }

/* Details list (plant show) */
.details dt { font-weight: 600; margin-top: 0.75rem; }
.details dd { margin: 0.1rem 0 0; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  background: white;
  border: 1px dashed var(--border);
  border-radius: 0.6rem;
}

.danger-zone h2 { color: var(--danger); }
