/* assets/css/views.css — View-specific styles */

/* Onboarding */
.onboarding {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  text-align: center;
}
.onboarding__step {
  width: 100%;
  max-width: 360px;
  animation: viewEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.onboarding__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.onboarding__subtitle {
  color: var(--color-text-light);
  margin-bottom: 24px;
}
.onboarding__progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 32px;
}
.onboarding__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E2E8F0;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.onboarding__dot--active {
  background: var(--color-primary);
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(111, 124, 222, 0.4);
}

/* Dashboard */
.dashboard__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.dashboard__greeting { font-weight: 400; color: var(--color-text-light); font-size: 0.9rem; }
.dashboard__name { font-weight: 700; font-size: 1.3rem; margin-top: 2px; }
.dashboard__budget {
  text-align: center;
  padding: 24px 20px;
}
.dashboard__budget-remaining {
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-primary);
  animation: scaleIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}
.dashboard__budget-label {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-top: 6px;
}
.dashboard__meals { display: flex; flex-direction: column; gap: 10px; }

/* Meal composer */
.composer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, var(--color-bg-start), var(--color-bg-end));
  z-index: 10;
  gap: 12px;
}
.composer__header h2 {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
}
.composer__search {
  position: sticky;
  top: 60px;
  z-index: 9;
  padding: 8px 16px;
}
.composer__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px 12px;
}
.composer__results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
}
.composer__cart {
  position: sticky;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  padding: 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  animation: sheetSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Admin ───────────────────────────────────────────────────────────────── */
.admin-wrap {
  padding: 16px 16px calc(var(--nav-height) + var(--safe-bottom) + 16px);
}

.admin-header {
  margin-bottom: 16px;
}

.admin-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 12px;
}

/* Stats cards */
.admin-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-stat-card {
  flex: 1;
  min-width: 80px;
  background: var(--color-card);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
}

.admin-stat-label {
  font-size: 0.72rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Tabs */
.admin-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-card-border);
  margin-bottom: 16px;
}

.admin-tabs__btn {
  background: none;
  border: none;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.admin-tabs__btn--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Tab content */
.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

/* Toolbar */
.admin-toolbar {
  margin-bottom: 12px;
}

.admin-search {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
}

.admin-search:focus {
  border-color: var(--color-primary);
}

/* Table */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-card-border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.admin-table th {
  background: var(--color-card);
  text-align: left;
  padding: 9px 12px;
  font-weight: 600;
  color: var(--color-text-light);
  border-bottom: 1px solid var(--color-card-border);
  white-space: nowrap;
}

.admin-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--color-card-border);
  vertical-align: middle;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover td {
  background: var(--color-card);
}

.admin-td-nome {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-td-phe {
  cursor: pointer;
  min-width: 80px;
}

.admin-td-phe:hover .phe-display {
  text-decoration: underline dotted;
}

.phe-edit-input {
  width: 72px;
  padding: 4px 6px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  outline: none;
}

.admin-td-date {
  white-space: nowrap;
  color: var(--color-text-light);
  font-size: 0.82rem;
}

/* Toggle switch */
.admin-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.admin-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.admin-toggle span {
  position: absolute;
  inset: 0;
  background: var(--color-card-border);
  border-radius: 22px;
  transition: background 0.2s;
}

.admin-toggle span::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.admin-toggle input:checked + span {
  background: var(--color-primary);
}

.admin-toggle input:checked + span::before {
  transform: translateX(18px);
}

/* Role select */
.admin-role-select {
  padding: 5px 8px;
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  background: var(--color-card);
  cursor: pointer;
}

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.admin-page-info {
  font-size: 0.87rem;
  color: var(--color-text-light);
}

/* States */
.admin-loading {
  color: var(--color-text-light);
  padding: 16px 0;
  font-size: 0.9rem;
}

.admin-error {
  color: var(--color-danger, #e53e3e);
  padding: 16px 0;
  font-size: 0.9rem;
}

/* ── Stats ──────────────────────────────────────────────────────────────── */
.stats-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  padding-top: 20px;
}

.stats-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.stats-bar-value {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 4px;
  min-height: 14px;
}

.stats-bar-track {
  flex: 1;
  width: 100%;
  max-width: 32px;
  position: relative;
  background: var(--color-card-border);
  border-radius: 4px;
  overflow: hidden;
}

.stats-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 4px;
  animation: barGrow 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes barGrow {
  from { height: 0 !important; }
}
.stats-bar-col:nth-child(1) .stats-bar-fill { animation-delay: 0.05s; }
.stats-bar-col:nth-child(2) .stats-bar-fill { animation-delay: 0.1s; }
.stats-bar-col:nth-child(3) .stats-bar-fill { animation-delay: 0.15s; }
.stats-bar-col:nth-child(4) .stats-bar-fill { animation-delay: 0.2s; }
.stats-bar-col:nth-child(5) .stats-bar-fill { animation-delay: 0.25s; }
.stats-bar-col:nth-child(6) .stats-bar-fill { animation-delay: 0.3s; }
.stats-bar-col:nth-child(7) .stats-bar-fill { animation-delay: 0.35s; }

.stats-bar-fill--safe { background: var(--color-phe-safe, #48bb78); }
.stats-bar-fill--warn { background: var(--color-phe-warn, #ed8936); }
.stats-bar-fill--danger { background: var(--color-phe-danger, #e53e3e); }

.stats-bar-limit {
  position: absolute;
  left: -2px;
  right: -2px;
  height: 2px;
  background: var(--color-text-light);
  opacity: 0.5;
  z-index: 1;
}

.stats-bar-label {
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 4px;
}

.stats-val--safe { color: var(--color-phe-safe, #48bb78); }
.stats-val--warn { color: var(--color-phe-warn, #ed8936); }
.stats-val--danger { color: var(--color-phe-danger, #e53e3e); }
