/* Palette "cocoon minimal" de Notine, reprise telle quelle de l'ancien
   thème Flutter (lib/theme/notine_theme.dart). */
:root {
  --creme: #f7eee1;
  --sauge: #6f8768;
  --sauge-fonce: #52633c;
  --terracotta: #c96a45;
  --brun: #4b3b2f;
  --blanc: #ffffff;
  --gris-texte: #6b6b6b;
  --max-width: 560px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--creme);
  color: var(--brun);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

/* ============================================================
   MISE EN PAGE
   ============================================================ */
.app-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  font-size: 20px;
  font-weight: 700;
}

.app-bar .spacer {
  flex: 1;
}

.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brun);
}

.icon-button:hover {
  background: rgba(0, 0, 0, 0.06);
}

.screen {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px 96px;
  overflow-y: auto;
}

.screen.no-max {
  max-width: none;
}

/* ============================================================
   NAVIGATION DU BAS
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--blanc);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: center;
  z-index: 10;
}

.bottom-nav-inner {
  display: flex;
  width: 100%;
  max-width: var(--max-width);
}

.nav-tab {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: #000000a0;
  cursor: pointer;
  padding: 4px;
}

.nav-tab.active {
  color: var(--sauge);
}

.nav-tab .icon {
  font-size: 22px;
  line-height: 1;
}

.nav-add {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--terracotta);
  color: white;
  border: none;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* ============================================================
   COMPOSANTS GÉNÉRAUX
   ============================================================ */
.card {
  background: var(--blanc);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.button-primary {
  background: var(--sauge);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.button-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.button-outline {
  background: none;
  border: 1.5px solid var(--sauge);
  color: var(--sauge-fonce);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
}

.button-outline:disabled {
  opacity: 0.5;
  cursor: default;
}

.button-text {
  background: none;
  border: none;
  color: var(--sauge-fonce);
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
textarea {
  width: 100%;
  background: var(--blanc);
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--brun);
  font-family: inherit;
}

textarea {
  resize: vertical;
}

label.field-label {
  display: block;
  font-size: 13px;
  color: var(--gris-texte);
  margin-bottom: 6px;
}

.field {
  margin-bottom: 16px;
}

.field-error {
  color: #b3261e;
  font-size: 13px;
  margin-top: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--blanc);
  border: 1px solid #0000001a;
  font-size: 13px;
  cursor: pointer;
  color: var(--brun);
}

.chip.selected {
  background: rgba(111, 135, 104, 0.18);
  border-color: var(--sauge);
  color: var(--sauge-fonce);
}

.chip .remove {
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  font-size: 14px;
  line-height: 1;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.tag-input-row input {
  flex: 1;
}

.field-row {
  display: flex;
  gap: 16px;
}

.field-row > * {
  flex: 1;
}

.preserve-lines {
  white-space: pre-wrap;
}

.recipe-photo-detail {
  height: 220px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}

.recipe-photo-detail .photo {
  height: 100%;
  border-radius: 0;
}

.profil-logo {
  text-align: center;
  margin: 8px 0 16px;
  font-size: 48px;
}

.profil-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.text-muted {
  color: var(--gris-texte);
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--sauge-fonce);
  margin: 24px 0 12px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  margin-bottom: 12px;
}

.section-header .section-title {
  margin: 0;
}

.search-stub {
  width: 100%;
  text-align: left;
  background: var(--blanc);
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 15px;
  color: var(--gris-texte);
  margin-bottom: 8px;
}

.section-subtitle {
  font-weight: 600;
  color: var(--sauge-fonce);
  margin-bottom: 8px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state .icon {
  font-size: 48px;
  color: var(--sauge);
}

.empty-state h2 {
  font-size: 18px;
  margin: 16px 0 8px;
}

.empty-state p {
  color: var(--gris-texte);
  margin: 0 0 24px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
  color: var(--sauge);
}

/* ============================================================
   RECETTES
   ============================================================ */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.recipe-card {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  font-family: inherit;
  display: flex;
  flex-direction: column;
}

.recipe-card .photo,
.recipe-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  background: var(--creme);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sauge);
  font-size: 32px;
  overflow: hidden;
}

.recipe-card .photo img,
.recipe-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-card .name {
  margin-top: 8px;
  font-weight: 600;
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.recipe-list-item .recipe-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  font-size: 20px;
}

.recipe-list-item .info {
  flex: 1;
  min-width: 0;
}

.recipe-list-item .name {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-list-item .tags {
  font-size: 12px;
  color: var(--gris-texte);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-list-item .favorite-star {
  color: var(--terracotta);
  font-size: 18px;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
}

.photo-field {
  margin-bottom: 16px;
}

.photo-field .pick-buttons {
  display: flex;
  gap: 12px;
}

.photo-field .pick-buttons .button-outline {
  flex: 1;
  text-align: center;
}

.photo-field .preview {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--creme);
}

.photo-field .preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-field .remove-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.stars {
  display: flex;
  gap: 4px;
}

.stars button {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--terracotta);
  cursor: pointer;
  padding: 2px;
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.switch .toggle {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: #cccccc;
  border: none;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}

.switch .toggle.on {
  background: var(--terracotta);
}

.switch .toggle .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: left 0.15s;
}

.switch .toggle.on .knob {
  left: 21px;
}

.tier-card .badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sauge-fonce);
  background: rgba(111, 135, 104, 0.15);
  padding: 4px 10px;
  border-radius: 12px;
}

.tier-card ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}

.tier-card li {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}

.tier-card li::before {
  content: '✓';
  color: var(--sauge);
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo .icon {
  font-size: 48px;
  color: var(--sauge);
}

.auth-logo h1 {
  font-size: 26px;
  margin: 8px 0 0;
}

.info-banner {
  background: rgba(111, 135, 104, 0.15);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
