/*
 *= require_tree .
 *= require_self
 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  color: #333;
  background: #fafafa;
}

nav {
  background: #2c3e50;
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

nav a { color: #ecf0f1; text-decoration: none; }
nav a:hover { color: white; text-decoration: underline; }

nav .brand { font-weight: bold; font-size: 1.2rem; margin-right: 1rem; }

nav ul { list-style: none; display: flex; gap: 1rem; flex: 1; }

nav .lang-switcher { margin-left: auto; display: flex; gap: 0.5rem; }

main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

h1 { margin-bottom: 1.5rem; }
h2 { margin: 1.5rem 0 1rem; }

.flash { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.flash.notice { background: #d4edda; color: #155724; }
.flash.alert  { background: #f8d7da; color: #721c24; }

/* Search page */
.search-page { }

.search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  max-width: 600px;
}

.search-input {
  flex: 1;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.search-btn, .btn {
  padding: 0.6rem 1.2rem;
  background: #2c3e50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover, .search-btn:hover { background: #1a252f; }

.btn-sm {
  padding: 0.3rem 0.7rem;
  background: #c0392b;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-sm:hover { background: #922b21; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid #e0e0e0; }
thead th { background: #f0f0f0; font-weight: 600; }
tfoot td { background: #f8f8f8; }

.no-results { color: #888; font-style: italic; margin: 1rem 0; }
.empty-state { color: #888; font-style: italic; margin: 1rem 0; }

/* Search results in menu */
.search-results-add { margin: 1rem 0; }
.search-result-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}
.search-result-row span { flex: 1; }
.add-form { display: flex; gap: 0.5rem; align-items: center; }
.grams-input { width: 80px; padding: 0.4rem; border: 1px solid #ccc; border-radius: 4px; }

/* Button variants */
.btn-success {
  padding: 0.6rem 1.2rem;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-success:hover { background: #1e8449; }

.btn-secondary {
  padding: 0.6rem 1.2rem;
  background: #95a5a6;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary:hover { background: #7f8c8d; }

/* Small-size modifier for btn-success, btn-info, btn-secondary, btn-danger */
.btn-sm-size {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

.btn-info {
  padding: 0.3rem 0.7rem;
  background: #2980b9;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: none;
  display: inline-block;
}
.btn-info:hover { background: #1f618d; }

.btn-danger {
  padding: 0.3rem 0.7rem;
  background: #c0392b;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-danger:hover { background: #922b21; }

/* Inline edit form inside table cell */
.inline-edit-form { display: flex; gap: 0.5rem; align-items: center; }
.editing-row td { background: #fffde7; }

/* Row action buttons */
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; }

/* Menu bottom actions */
.menu-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 500; margin-bottom: 0.3rem; }
.field input[type=text],
.field input[type=number] {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  width: 100%;
  max-width: 300px;
}

.errors { background: #f8d7da; color: #721c24; padding: 1rem; border-radius: 4px; margin-bottom: 1rem; }
.errors li { margin-left: 1rem; }

/* BMR */
.bmr-form { max-width: 400px; }
.bmr-result {
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  background: #d4edda;
  border-radius: 6px;
  display: inline-block;
}
.bmr-result .hint { font-size: 0.85rem; color: #666; margin-top: 0.5rem; }
.bmr-result-table { margin-bottom: 0.5rem; }
.bmr-result-table th { text-align: right; padding-right: 1rem; font-weight: normal; color: #555; background: none; border: none; }
.bmr-result-table td { border: none; font-size: 1.1rem; }

/* BMR radio layout */
.bmr-form label { display: inline; font-weight: normal; margin-right: 1rem; }

hr { border: none; border-top: 1px solid #ddd; margin: 2rem 0; }
