/* ============================================================
   CKD Dialysis Diet Guide — Shared Stylesheet
   Mobile-first, WordPress-compatible
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #F0F4F8;
  color: #2C3E50;
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: #2E7D6B; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Color Palette ---
   Primary Teal:    #2E7D6B
   Dark Teal:       #1A5C4E
   Accent Orange:   #E07B39
   Light Bg:        #F0F4F8
   Card Bg:         #FFFFFF
   Success Green:   #27AE60
   Warning Yellow:  #F39C12
   Danger Red:      #C0392B
   Info Blue:       #2980B9
   Border:          #DDE3EA
*/

/* --- Typography --- */
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 700; line-height: 1.3; }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p { margin-bottom: 0.75rem; }
ul, ol { padding-left: 1.4rem; margin-bottom: 0.75rem; }
li { margin-bottom: 0.3rem; }
strong { font-weight: 600; }

/* --- Top Navigation Bar --- */
.site-nav {
  background: #1A5C4E;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.nav-brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.75rem 0;
  white-space: nowrap;
}
.nav-brand span { color: #7ED6C1; }
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.nav-links a {
  color: #C8EDE7;
  padding: 0.5rem 0.65rem;
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  background: #2E7D6B;
  color: #fff;
  text-decoration: none;
}

/* --- Page Hero --- */
.hero {
  background: linear-gradient(135deg, #2E7D6B 0%, #1A5C4E 60%, #0F3D31 100%);
  color: #fff;
  padding: 2.5rem 1rem 2rem;
  text-align: center;
}
.hero h1 { color: #fff; margin-bottom: 0.5rem; }
.hero p { color: #A8DDD4; font-size: 1.05rem; max-width: 700px; margin: 0 auto 0.5rem; }
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.badge {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* --- Main Layout --- */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* --- Section Headings --- */
.section-title {
  color: #1A5C4E;
  border-left: 4px solid #2E7D6B;
  padding-left: 0.75rem;
  margin: 2rem 0 1rem;
}
.section-subtitle {
  color: #555;
  font-size: 0.95rem;
  margin-top: -0.5rem;
  margin-bottom: 1.2rem;
  padding-left: 1.1rem;
}

/* --- Cards --- */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid #DDE3EA;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #EEF1F5;
}
.card-icon { font-size: 1.5rem; line-height: 1; }
.card-title { font-size: 1rem; font-weight: 700; color: #1A5C4E; margin: 0; }
.card-subtitle { font-size: 0.8rem; color: #888; margin: 0; }

/* --- Grid Layouts --- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

/* --- Nutrient Target Cards --- */
.nutrient-card {
  background: #fff;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  border-top: 4px solid #2E7D6B;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.nutrient-card .nut-icon { font-size: 2rem; margin-bottom: 0.3rem; }
.nutrient-card .nut-value { font-size: 1.4rem; font-weight: 700; color: #1A5C4E; }
.nutrient-card .nut-label { font-size: 0.78rem; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.nutrient-card .nut-note { font-size: 0.75rem; color: #999; margin-top: 0.2rem; }
.nutrient-card.danger { border-top-color: #C0392B; }
.nutrient-card.danger .nut-value { color: #C0392B; }
.nutrient-card.warning { border-top-color: #E07B39; }
.nutrient-card.warning .nut-value { color: #E07B39; }
.nutrient-card.info { border-top-color: #2980B9; }
.nutrient-card.info .nut-value { color: #2980B9; }

/* --- Alert Boxes --- */
.alert {
  padding: 0.9rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.9rem;
}
.alert-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 0.05rem; }
.alert-body strong { display: block; margin-bottom: 0.2rem; }
.alert.danger { background: #FDEDEC; border-left: 4px solid #C0392B; color: #6B1E1E; }
.alert.warning { background: #FEF9E7; border-left: 4px solid #F39C12; color: #7D5A00; }
.alert.success { background: #EAFAF1; border-left: 4px solid #27AE60; color: #1A5C3A; }
.alert.info { background: #EBF5FB; border-left: 4px solid #2980B9; color: #1A4F72; }

/* --- Meal Plan Day Cards --- */
.day-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  margin-bottom: 1.5rem;
  border: 1px solid #DDE3EA;
}
.day-header {
  background: linear-gradient(135deg, #2E7D6B, #1A5C4E);
  color: #fff;
  padding: 0.8rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.day-header h3 { color: #fff; margin: 0; font-size: 1.1rem; }
.day-header .day-label { font-size: 0.8rem; color: #A8DDD4; }
.day-body { padding: 0; }
.meal-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0;
  border-bottom: 1px solid #F0F4F8;
}
.meal-row:last-child { border-bottom: none; }
.meal-time {
  background: #F8FFFE;
  padding: 0.9rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #2E7D6B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-right: 1px solid #EEF1F5;
}
.meal-time .meal-emoji { font-size: 1.4rem; margin-bottom: 0.2rem; }
.meal-content { padding: 0.9rem 1rem; }
.meal-content h4 { color: #1A5C4E; margin-bottom: 0.4rem; font-size: 0.95rem; }
.meal-content p { font-size: 0.88rem; margin-bottom: 0.3rem; color: #444; }
.meal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}
.meal-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-weight: 600;
}
.tag-protein { background: #E8F5E9; color: #2E7D32; }
.tag-k { background: #FFF3E0; color: #E65100; }
.tag-phos { background: #EDE7F6; color: #4527A0; }
.tag-sodium { background: #E3F2FD; color: #1565C0; }
.tag-fluid { background: #FCE4EC; color: #880E4F; }

/* --- Daily Totals Bar --- */
.daily-totals {
  background: #F0F4F8;
  padding: 0.7rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  font-size: 0.8rem;
  border-top: 1px solid #DDE3EA;
}
.daily-totals strong { color: #1A5C4E; }
.total-item { white-space: nowrap; }
.total-ok { color: #27AE60; font-weight: 600; }
.total-warn { color: #E07B39; font-weight: 600; }
.total-bad { color: #C0392B; font-weight: 600; }

/* --- Recipe Cards --- */
.recipe-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  margin-bottom: 1.5rem;
  border: 1px solid #DDE3EA;
}
.recipe-hero {
  background: linear-gradient(135deg, #2E7D6B, #1A5C4E);
  padding: 1.25rem;
  color: #fff;
  display: flex;
  gap: 1rem;
  align-items: center;
}
.recipe-emoji { font-size: 3rem; line-height: 1; flex-shrink: 0; }
.recipe-hero h3 { color: #fff; margin: 0 0 0.2rem; }
.recipe-meta { font-size: 0.8rem; color: #A8DDD4; }
.recipe-meta span { margin-right: 1rem; }
.recipe-body { padding: 1.25rem; }
.recipe-body h4 { color: #1A5C4E; margin: 1rem 0 0.4rem; font-size: 0.95rem; }
.recipe-body h4:first-child { margin-top: 0; }
.ingredient-list { list-style: none; padding: 0; }
.ingredient-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid #F5F7FA;
  font-size: 0.88rem;
  display: flex;
  justify-content: space-between;
}
.ingredient-list li:last-child { border-bottom: none; }
.ing-amount { font-weight: 600; color: #2E7D6B; white-space: nowrap; margin-left: 0.5rem; }
.step-list { list-style: none; padding: 0; counter-reset: steps; }
.step-list li {
  counter-increment: steps;
  padding: 0.6rem 0 0.6rem 2.5rem;
  position: relative;
  font-size: 0.88rem;
  border-bottom: 1px solid #F5F7FA;
}
.step-list li:last-child { border-bottom: none; }
.step-list li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0.6rem;
  background: #2E7D6B;
  color: #fff;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
}
.nutrition-box {
  background: #F0F4F8;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: 0.82rem;
}
.nutrition-box strong { color: #1A5C4E; }

/* --- Grocery List --- */
.grocery-section { margin-bottom: 1.5rem; }
.grocery-category {
  background: #2E7D6B;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.grocery-items {
  background: #fff;
  border: 1px solid #DDE3EA;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 0.5rem 0;
}
.grocery-item {
  display: flex;
  align-items: center;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid #F5F7FA;
  gap: 0.6rem;
}
.grocery-item:last-child { border-bottom: none; }
.grocery-check {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid #2E7D6B;
  border-radius: 3px;
  flex-shrink: 0;
  cursor: pointer;
}
.grocery-qty { font-weight: 600; color: #2E7D6B; margin-left: auto; white-space: nowrap; }
.grocery-note { font-size: 0.75rem; color: #999; font-style: italic; }

/* --- Foods Traffic Light --- */
.traffic-section { margin-bottom: 2rem; }
.traffic-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 8px 8px 0 0;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}
.traffic-header.green { background: #27AE60; }
.traffic-header.yellow { background: #F39C12; }
.traffic-header.red { background: #C0392B; }
.traffic-items {
  background: #fff;
  border: 1px solid #DDE3EA;
  border-top: none;
  border-radius: 0 0 8px 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.traffic-item {
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  border-bottom: 1px solid #F5F7FA;
  border-right: 1px solid #F5F7FA;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.traffic-item .food-name { font-weight: 600; }
.traffic-item .food-detail { color: #888; font-size: 0.77rem; }
.traffic-item.green-item { border-left: 3px solid #27AE60; }
.traffic-item.yellow-item { border-left: 3px solid #F39C12; }
.traffic-item.red-item { border-left: 3px solid #C0392B; }

/* --- Portion Visual Guide --- */
.portion-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.portion-item {
  background: #fff;
  border-radius: 10px;
  padding: 1rem 0.75rem;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  border: 1px solid #DDE3EA;
}
.portion-visual { font-size: 2.5rem; margin-bottom: 0.4rem; }
.portion-size { font-size: 1rem; font-weight: 700; color: #1A5C4E; }
.portion-equals { font-size: 0.78rem; color: #666; }
.portion-food { font-size: 0.82rem; color: #333; margin-top: 0.2rem; font-weight: 500; }

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.data-table th {
  background: #1A5C4E;
  color: #fff;
  padding: 0.65rem 0.85rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #F0F4F8;
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #F8FFFE; }
.td-ok { color: #27AE60; font-weight: 600; }
.td-warn { color: #E07B39; font-weight: 600; }
.td-bad { color: #C0392B; font-weight: 600; }

/* --- Page Footer --- */
.site-footer {
  background: #1A5C4E;
  color: #A8DDD4;
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.82rem;
  margin-top: 3rem;
}
.site-footer a { color: #7ED6C1; }
.disclaimer-box {
  background: #FEF9E7;
  border: 1px solid #F39C12;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 0.83rem;
  color: #6B4700;
  margin-bottom: 1.5rem;
}
.disclaimer-box strong { display: block; margin-bottom: 0.3rem; color: #7D5A00; }

/* --- Navigation Cards (home page) --- */
.nav-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.nav-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  border: 2px solid #DDE3EA;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  display: block;
  color: inherit;
}
.nav-card:hover {
  border-color: #2E7D6B;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46,125,107,0.15);
  text-decoration: none;
}
.nav-card-icon { font-size: 2.5rem; margin-bottom: 0.6rem; }
.nav-card h3 { color: #1A5C4E; font-size: 1rem; margin-bottom: 0.3rem; }
.nav-card p { font-size: 0.8rem; color: #666; margin: 0; }

/* --- Progress/Tracker bars --- */
.nutrient-bar { margin-bottom: 0.75rem; }
.nutrient-bar-label { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 0.2rem; }
.nutrient-bar-track { background: #E8ECF0; border-radius: 10px; height: 10px; overflow: hidden; }
.nutrient-bar-fill { height: 100%; border-radius: 10px; }
.bar-teal { background: linear-gradient(to right, #2E7D6B, #5BB8A4); }
.bar-orange { background: linear-gradient(to right, #E07B39, #F4A261); }
.bar-red { background: linear-gradient(to right, #C0392B, #E74C3C); }
.bar-blue { background: linear-gradient(to right, #2980B9, #5DADE2); }
.bar-purple { background: linear-gradient(to right, #7D3C98, #A569BD); }

/* --- Tips Callout --- */
.tip-box {
  background: #F0FBF8;
  border-left: 4px solid #2E7D6B;
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.875rem;
  color: #1A4A40;
}
.tip-box .tip-label { font-weight: 700; color: #2E7D6B; margin-bottom: 0.2rem; }

/* --- Quick Reference Ribbon --- */
.quick-ref {
  background: #1A5C4E;
  color: #fff;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin-bottom: 1.5rem;
  font-size: 0.83rem;
}
.quick-ref-item { display: flex; align-items: center; gap: 0.4rem; }
.quick-ref-item .qr-label { color: #7ED6C1; font-weight: 600; }
.quick-ref-item .qr-val { color: #fff; }

/* --- Print Styles --- */
@media print {
  .site-nav, .site-footer { display: none; }
  .day-card, .recipe-card, .card { box-shadow: none; border: 1px solid #ccc; }
  a { color: #000; }
  .page-wrapper { padding: 0; }
  body { font-size: 12px; }
}

/* --- Responsive Tweaks --- */
@media (max-width: 600px) {
  .meal-row { grid-template-columns: 70px 1fr; }
  .meal-time { font-size: 0.7rem; padding: 0.6rem 0.4rem; }
  .day-header { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
  .daily-totals { gap: 0.5rem 1rem; }
  .recipe-hero { flex-direction: column; gap: 0.6rem; }
  .recipe-emoji { font-size: 2.5rem; }
  .nav-inner { padding: 0 0.5rem; }
  .nav-brand { font-size: 0.9rem; }
  .nav-links a { padding: 0.4rem 0.45rem; font-size: 0.75rem; }
  .hero { padding: 1.75rem 1rem 1.5rem; }
  .traffic-items { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
}
@media (max-width: 400px) {
  .traffic-items { grid-template-columns: 1fr; }
  .nav-links a { padding: 0.35rem 0.35rem; font-size: 0.7rem; }
}
