/* ===== COCO BURN APP — STYLES ===== */

/* --- CSS Variables --- */
:root {
  --primary: #1a6b4a;
  --primary-dark: #145639;
  --primary-light: #2d9d6e;
  --accent: #f0a04b;
  --accent-dark: #d4872e;
  --accent-light: #fcc97a;
  --bg: #f4f1ec;
  --bg-card: #ffffff;
  --bg-dark: #0f2a1e;
  --text: #1e1e1e;
  --text-secondary: #6b7280;
  --text-light: #ffffff;
  --danger: #e74c3c;
  --success: #27ae60;
  --coral: #ff7f6b;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 50px;
  --nav-height: 72px;
  --header-height: 60px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden;
  height: 100dvh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

input, button, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* --- App Layout --- */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* --- Header --- */
#app-header {
  height: var(--header-height);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
}

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

.header-icon {
  font-size: 1.5rem;
}

#header-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: -0.3px;
}

/* --- Screens Container --- */
#screens-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.screen {
  display: none;
  min-height: 100%;
  animation: fadeIn 0.35s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-content {
  padding: 20px 16px calc(var(--nav-height) + 24px);
}

/* --- Bottom Nav --- */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: var(--bg-card);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#bottom-nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 6px 4px;
  min-width: 52px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
  transition: var(--transition);
}

.nav-item.active::before {
  transform: translateX(-50%) scaleX(1);
}

.nav-icon {
  font-size: 1.35rem;
  line-height: 1;
  transition: var(--transition);
}

.nav-label {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
  transition: var(--transition);
}

.nav-item.active .nav-label {
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  transform: scale(1.15);
}

/* --- Section Header Card --- */
.section-header-card {
  text-align: center;
  margin-bottom: 20px;
}

.section-emoji {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

.section-header-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

.section-header-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- Generic Card --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

/* --- Hero Card (Home) --- */
.hero-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--text-light);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}

.hero-logo {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: pulse 2.5s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.hero-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.hero-card .brand {
  color: var(--accent-light);
}

.hero-subtitle {
  font-size: 0.85rem;
  font-weight: 300;
  opacity: 0.9;
  line-height: 1.5;
}

/* --- Quick Actions Grid --- */
.section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.action-card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.action-card:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.action-icon {
  font-size: 1.5rem;
}

.action-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
}

/* --- Info Card --- */
.info-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(135deg, #fef9e7, #fdf2d5);
  border-radius: var(--radius);
  padding: 16px;
  border-left: 4px solid var(--accent);
}

.info-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.info-card p {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
}

/* --- Protocol Embed --- */
.embed-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.embed-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.embed-placeholder span {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

.embed-placeholder small {
  font-size: 0.75rem;
  opacity: 0.7;
}

.embed-container iframe {
  width: 100%;
  height: 70vh;
  border: none;
}

/* --- Input Groups --- */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: #fafafa;
  transition: var(--transition);
  color: var(--text);
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px rgba(26, 107, 74, 0.1);
}

/* --- Buttons --- */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--text-light);
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(26, 107, 74, 0.3);
}

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

.btn-wide {
  max-width: 320px;
  margin: 0 auto;
  display: block;
}

.btn-danger {
  width: 100%;
  padding: 12px;
  background: none;
  color: var(--danger);
  border: 2px solid var(--danger);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 20px;
}

.btn-danger:active {
  background: var(--danger);
  color: white;
}

/* --- Results Card --- */
.results-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-top: 16px;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.results-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 16px;
  text-align: center;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.result-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.result-item strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text);
}

.result-item p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.result-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 8px 0;
}

/* --- Daily Routine --- */
.routine-date {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-weight: 500;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.checklist-item:active {
  transform: scale(0.98);
}

.checklist-item.checked {
  background: linear-gradient(135deg, #e8f8f0, #d5f5e3);
}

.check-box {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.checklist-item.checked .check-box {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.check-text {
  flex: 1;
}

.check-text strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
}

.check-text span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.checklist-item.checked .check-text strong {
  text-decoration: line-through;
  opacity: 0.6;
}

.check-emoji {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.routine-progress {
  text-align: center;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}

#routine-progress-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Weight Tracker --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card.accent {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--text-light);
}

.stat-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-card.accent .stat-value {
  color: var(--text-light);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card.accent .stat-label {
  color: rgba(255, 255, 255, 0.8);
}

.chart-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.chart-container h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.chart-container canvas {
  width: 100%;
  height: 200px;
}

.history-list {
  margin-bottom: 16px;
}

.history-list h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.weight-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.weight-entry-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.weight-entry-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.weight-entry-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  opacity: 0.6;
  transition: var(--transition);
}

.weight-entry-delete:active {
  opacity: 1;
}

/* --- Recipes --- */
.recipes-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.recipe-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.recipe-card:active {
  transform: scale(0.98);
}

.recipe-card-inner {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 16px;
}

.recipe-emoji {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.recipe-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.recipe-info p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.recipe-tag {
  display: inline-block;
  background: linear-gradient(135deg, #e8f8f0, #d5f5e3);
  color: var(--primary-dark);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-top: 6px;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 500;
  animation: fadeInOverlay 0.25s ease;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px;
  overflow-y: auto;
  animation: slideUpModal 0.35s ease;
  position: relative;
}

@keyframes slideUpModal {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f3f4f6;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body-recipe h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-body-recipe .modal-recipe-emoji {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

.modal-body-recipe h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 16px;
  margin-bottom: 8px;
}

.modal-body-recipe ul {
  padding-left: 20px;
  margin-bottom: 8px;
}

.modal-body-recipe li {
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.5;
}

.modal-body-recipe ol {
  padding-left: 20px;
}

.modal-body-recipe ol li {
  margin-bottom: 8px;
}

/* --- Tips --- */
.tip-display-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tip-icon-large {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

#tip-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.6;
  transition: var(--transition);
}

/* --- Motivation --- */
.motivation-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--text-light);
  border-radius: var(--radius);
  padding: 40px 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.motivation-quote-mark {
  font-size: 4rem;
  font-family: Georgia, serif;
  opacity: 0.2;
  line-height: 0.8;
}

.motivation-quote-mark.bottom {
  transform: rotate(180deg);
}

#motivation-text {
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.6;
  padding: 8px 0;
}

/* --- Timer --- */
.timer-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.timer-preset {
  background: var(--bg-card);
  border: 2px solid #e5e7eb;
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.timer-preset small {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.timer-preset.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, #e8f8f0, #d5f5e3);
  color: var(--primary-dark);
}

.timer-preset.active small {
  color: var(--primary);
}

.timer-display-card {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.timer-ring {
  position: relative;
  width: 200px;
  height: 200px;
}

.timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-bg {
  fill: none;
  stroke: #e5e7eb;
  stroke-width: 8;
}

.timer-ring-progress {
  fill: none;
  stroke: url(#timer-gradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 565.48;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.timer-time {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.timer-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-timer {
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-start {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--text-light);
  box-shadow: 0 4px 16px rgba(26, 107, 74, 0.3);
}

.btn-pause {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--text-light);
  box-shadow: 0 4px 16px rgba(240, 160, 75, 0.3);
}

.btn-reset {
  background: #f3f4f6;
  color: var(--text);
}

.btn-timer:active {
  transform: scale(0.95);
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* --- Desktop Enhancement --- */
@media (min-width: 481px) {
  body {
    background: linear-gradient(135deg, #0f2a1e 0%, #1a4032 50%, #0f2a1e 100%);
  }
  #app {
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.3);
    border-radius: 0;
    margin-top: 0;
  }
}

/* --- Scrollbar --- */
#screens-container::-webkit-scrollbar {
  width: 3px;
}
#screens-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
