/* ¿Qué Comemos? — Componentes reutilizables */

/* ─── Botones ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px var(--space-lg);
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: var(--font-size-md);
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn:hover:not(:active):not(:disabled) {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232, 98, 42, .30);
}
.btn--primary:hover { background: #d4541e; }

.btn--secondary {
  background: var(--color-secondary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(42, 122, 232, .25);
}

.btn--outlined {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn--outlined:hover { background: rgba(232, 98, 42, .06); }

.btn--ghost {
  background: transparent;
  color: var(--text-sec);
}
.btn--ghost:hover { background: var(--surface-2); }

.btn--danger {
  background: var(--color-red);
  color: #fff;
}

.btn--sm {
  padding: 8px var(--space-md);
  font-size: var(--font-size-sm);
}

.btn--lg {
  padding: 16px var(--space-xl);
  font-size: var(--font-size-lg);
}

.btn--full { width: 100%; }

.btn--icon {
  padding: 10px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ─── Cards ──────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card--interactive {
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.card--interactive:active {
  transform: scale(0.985);
  box-shadow: var(--shadow-sm);
}

.card--interactive:hover {
  box-shadow: var(--shadow-md);
}

.card__body    { padding: var(--space-md); }
.card__header  { padding: var(--space-md); border-bottom: 1px solid var(--border); }
.card__footer  { padding: var(--space-sm) var(--space-md); border-top: 1px solid var(--border); background: var(--surface-2); }

/* ─── Inputs y formularios ───────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 800;
  color: var(--text-sec);
  letter-spacing: .02em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: var(--font-size-md);
  line-height: 1.5;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(232, 98, 42, .15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-ter);
  font-weight: 600;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6259' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-error {
  font-size: var(--font-size-sm);
  color: var(--color-red);
  font-weight: 700;
}

.form-hint {
  font-size: var(--font-size-sm);
  color: var(--text-ter);
}

/* ─── Toggle switch ──────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.toggle-wrap__label {
  flex: 1;
}

.toggle-wrap__title {
  font-weight: 700;
  font-size: var(--font-size-md);
}

.toggle-wrap__desc {
  font-size: var(--font-size-sm);
  color: var(--text-ter);
  margin-top: 3px;
}

.toggle {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input { display: none; }

.toggle__track {
  position: absolute;
  inset: 0;
  background: var(--border-2);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition);
}

.toggle input:checked + .toggle__track {
  background: var(--color-primary);
}

.toggle__thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
  pointer-events: none;
}

.toggle input:checked ~ .toggle__thumb {
  transform: translateX(24px);
}

/* ─── Chips ──────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-sec);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}

.chip:active { transform: scale(0.95); }

.chip--active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.chip--sm {
  padding: 4px 10px;
  font-size: var(--font-size-xs);
}

/* ─── Badges ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 900;
  background: var(--color-primary);
  color: #fff;
  line-height: 1;
}

.badge--amber { background: var(--color-amber); color: var(--text); }
.badge--green { background: var(--color-green); }
.badge--red   { background: var(--color-red); }

/* ─── Divider ────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-md) 0;
}

.divider--label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: 800;
  color: var(--text-ter);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: var(--space-lg) 0 var(--space-md);
}

.divider--label::before,
.divider--label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Lista de ítems ─────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-md);
}

.list-item + .list-item {
  margin-top: var(--space-sm);
}

.list-item__icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 20px;
  flex-shrink: 0;
}

.list-item__body { flex: 1; min-width: 0; }

.list-item__title {
  font-weight: 700;
  font-size: var(--font-size-md);
}

.list-item__subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-sec);
  margin-top: 2px;
}

/* ─── Sección con título ─────────────────────── */
.section {
  padding: var(--space-lg) var(--space-md);
}

.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.section__title {
  font-size: var(--font-size-lg);
  font-weight: 900;
}

.section__action {
  font-size: var(--font-size-sm);
  color: var(--color-primary);
  font-weight: 800;
  cursor: pointer;
}

/* ─── Modal / bottom sheet ───────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 8, .5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.overlay--visible {
  opacity: 1;
  pointer-events: all;
}

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 201;
  padding: var(--space-lg) var(--space-md) calc(var(--nav-height) + var(--space-lg));
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(.32, .72, 0, 1);
  max-height: 85dvh;
  overflow-y: auto;
}

.bottom-sheet--visible {
  transform: translateY(0);
}

.bottom-sheet__handle {
  width: 36px; height: 4px;
  background: var(--border-2);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-lg);
}

.bottom-sheet__title {
  font-size: var(--font-size-xl);
  font-weight: 900;
  margin-bottom: var(--space-lg);
}

/* ─── Foto upload ────────────────────────────── */
.photo-upload {
  position: relative;
  cursor: pointer;
}

.photo-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-upload__area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-md);
  color: var(--text-ter);
  font-size: var(--font-size-sm);
  transition: border-color var(--transition), background var(--transition);
}

.photo-upload:hover .photo-upload__area {
  border-color: var(--color-primary);
  background: rgba(232, 98, 42, .04);
}

.photo-upload__icon {
  font-size: 32px;
}

/* ─── Foto grid ──────────────────────────────── */
.foto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.foto-grid__item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--surface-2);
}

.foto-grid__item img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.foto-grid__remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 24px; height: 24px;
  background: rgba(26,18,8,.6);
  color: #fff;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Nota / valoración ──────────────────────── */
.nota-display {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.nota-display__num {
  font-size: var(--font-size-2xl);
  font-weight: 900;
  color: var(--text);
}

.nota-display__max {
  font-size: var(--font-size-sm);
  color: var(--text-ter);
}

/* ─── Repeat badge ───────────────────────────── */
.repeat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 800;
}

.repeat-badge--yes {
  background: rgba(39, 174, 96, .12);
  color: var(--color-green);
}

.repeat-badge--no {
  background: rgba(239, 68, 68, .10);
  color: var(--color-red);
}

/* ─── Pending badge ──────────────────────────── */
.pending-dot {
  width: 8px; height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
  flex-shrink: 0;
}
