/* ====================================================
   UI COMPONENTS (CARDS, BADGES, BUTTONS, NAV, TIMER)
   ==================================================== */

/* Header & Brand */
header.app-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding-top: var(--space-xs);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon-box {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--orange-500), #ff2a00);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 19px;
  box-shadow: 0 4px 16px var(--orange-glow);
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-white);
  line-height: 1.1;
}

.brand-title span {
  color: var(--orange-500);
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.icon-btn {
  min-width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 17px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.icon-btn:active {
  transform: scale(0.92);
}

/* Dual Streak Flame Badges */
.streaks-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.streak-card {
  background: linear-gradient(145deg, var(--bg-card), rgba(255, 107, 0, 0.04));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.streak-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.3s ease;
}

.streak-card.food-streak::before {
  background: linear-gradient(90deg, var(--gold-500), transparent);
}

.streak-card.workout-streak::before {
  background: linear-gradient(90deg, var(--orange-500), transparent);
}

.streak-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

.streak-card:active {
  transform: scale(0.97);
}

.streak-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.streak-flame-icon {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px var(--orange-glow));
}

.streak-card-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.streak-title-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.streak-main-count {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-white);
  line-height: 1.1;
  font-family: var(--font-display);
}

.streak-best-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  text-align: right;
}

/* In-App Reminder Banners */
.reminder-banner {
  background: linear-gradient(135deg, rgba(255, 107, 0, 0.16), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(255, 107, 0, 0.35);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  box-shadow: 0 4px 18px var(--orange-glow);
  animation: fadeIn 0.3s ease;
}

.reminder-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.reminder-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.reminder-text strong {
  color: var(--orange-400);
  display: block;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 2px;
}

.reminder-text span {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
}

.banner-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-white);
}

/* Section Containers */
.section-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

.section-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.section-title {
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-tag {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* Primary Action Buttons */
.btn-primary {
  height: var(--tap-comfortable);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--orange-500), #e05e00);
  border: none;
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 18px var(--orange-glow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0 var(--space-lg);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 24px var(--orange-glow);
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(0.95);
}

.btn-secondary {
  height: var(--tap-comfortable);
  padding: 0 var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

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

/* Bottom Navigation Bar */
nav.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 580px;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-medium);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.45);
}

.nav-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 25%;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: var(--tap-min);
  position: relative;
}

.nav-tab-item:active {
  transform: scale(0.92);
}

.nav-tab-icon {
  font-size: 22px;
  line-height: 1;
  transition: all 0.2s ease;
}

.nav-tab-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-tab-item.active {
  color: var(--orange-500);
}

.nav-tab-item.active .nav-tab-icon {
  transform: translateY(-2px);
  filter: drop-shadow(0 2px 8px var(--orange-glow));
}

.nav-tab-item.active::after {
  content: "";
  position: absolute;
  top: 0;
  width: 36px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--orange-500);
  box-shadow: 0 2px 8px var(--orange-glow);
}

/* Modals & Slide-up Drawers */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.drawer-panel {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-medium);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  padding-bottom: var(--safe-bottom);
  position: relative;
}

.modal-backdrop.open .drawer-panel {
  transform: translateY(0);
}

.drawer-drag-pill {
  width: 44px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--border-medium);
  margin: 12px auto 6px auto;
  flex-shrink: 0;
}

.drawer-head {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.drawer-title-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-white);
}

.drawer-body {
  padding: var(--space-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.drawer-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--space-md);
  background: var(--bg-surface);
  flex-shrink: 0;
  z-index: 10;
}

/* Floating Rest Timer */
.rest-timer-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), var(--shadow-orange);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  position: sticky;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
  z-index: 90;
  animation: fadeIn 0.3s ease;
}

.timer-hud {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer-digits-text {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 900;
  color: var(--orange-500);
  letter-spacing: 1.5px;
}

.timer-preset-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer-pill {
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.timer-pill.active {
  background: var(--orange-500);
  color: #fff;
  border-color: var(--orange-500);
}

.timer-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-timer-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.btn-timer-icon.accent {
  background: var(--orange-500);
  color: #fff;
  border-color: var(--orange-500);
  box-shadow: 0 2px 10px var(--orange-glow);
}

/* Toast Undo */
.toast-undo-box {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-surface);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13.5px;
  z-index: 300;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-undo-box.visible {
  transform: translateX(-50%) translateY(0);
}

.btn-undo-action {
  background: none;
  border: none;
  color: var(--orange-500);
  font-weight: 800;
  cursor: pointer;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
