/* Weight Control Planner Styles - Following Kitmodo Design System */

:root {
  --bg: #0b0d10;
  --card: #141820;
  --muted: #8fa3b8;
  --text: #e7eef6;
  --accent: #6aa3ff;
  --accent-2: #7bd389;
  --warn: #f7c948;
  --danger: #ff6b6b;
  --ok: #59d185;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 16px;
  --input-bg: #0f131a;
  --border: #222b36;
}

:root[data-theme="light"] {
  --bg: #f5f7fa;
  --card: #ffffff;
  --muted: #5a6b7f;
  --text: #1a1d23;
  --accent: #2b7de9;
  --accent-2: #2a9d5f;
  --warn: #8b6914;
  --danger: #d32f2f;
  --ok: #2e7d32;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --input-bg: #f8f9fb;
  --border: #d1d9e3;
}

html, body { 
  height: 100%; 
}

body {
  margin: 0; 
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial;
  background: var(--bg);
  color: var(--text);
  transition: background .3s, color .3s;
}

.wrap { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 24px; 
}

header { 
  display: grid; 
  gap: 8px; 
  margin: 12px 0 24px; 
}

h1 { 
  font-size: clamp(1.6rem, 2.6vw, 2.2rem); 
  margin: 0; 
  letter-spacing: .2px; 
}

h2 {
  font-size: 1.2rem;
  margin: 4px 0 16px;
  letter-spacing: .3px;
}

h3 {
  font-size: 1.05rem;
  margin: 12px 0 8px;
}

h4 {
  font-size: 1rem;
  margin: 8px 0 6px;
}

p.sub { 
  color: var(--muted); 
  margin: 0; 
}

.muted {
  color: var(--muted);
}

.card { 
  background: var(--card); 
  border-radius: var(--radius); 
  box-shadow: var(--shadow); 
  padding: 20px; 
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.badge { 
  display: inline-block; 
  padding: 4px 10px; 
  border-radius: 999px; 
  background: #112134; 
  border: 1px solid #2a3b52; 
  color: var(--muted); 
  font-size: .82rem; 
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.info-item {
  text-align: center;
  padding: 16px;
  background: var(--input-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.info-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

/* Notice Card */
.notice-card {
  background: linear-gradient(135deg, rgba(106, 163, 255, 0.1), rgba(123, 211, 137, 0.1));
  border: 1px solid var(--accent);
}

.notice-card ul {
  margin: 12px 0;
  padding-left: 24px;
}

.notice-card li {
  margin: 6px 0;
}

/* Warning Card */
.warning-card {
  background: linear-gradient(135deg, rgba(247, 201, 72, 0.1), rgba(255, 107, 107, 0.1));
  border: 1px solid var(--warn);
}

/* Buttons */
.btn-primary, .btn-secondary {
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  transition: all .2s;
  font-weight: 500;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.1rem;
}

.btn-icon {
  margin-right: 6px;
}

.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Progress Bar */
.progress-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0;
  padding: 0 20px;
  position: relative;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--input-bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--muted);
  transition: all .3s;
}

.step-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.progress-step.active .step-number {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.progress-step.active .step-label {
  color: var(--text);
}

.progress-step.completed .step-number {
  background: var(--ok);
  border-color: var(--ok);
  color: white;
}

/* Form Styles */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
}

.form-control {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  transition: all .2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(106, 163, 255, 0.2);
}

.form-control::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.form-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: -2px;
}

textarea.form-control {
  resize: vertical;
  font-family: inherit;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* Results Display */
.plan-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.summary-item {
  padding: 14px;
  background: var(--input-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.summary-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.summary-value {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
}

.summary-unit {
  font-size: 0.9rem;
  color: var(--muted);
  margin-left: 4px;
}

/* Nutrition Targets */
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.nutrition-item {
  text-align: center;
  padding: 16px;
  background: var(--input-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.nutrition-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.nutrition-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Meal Plan */
.meal-day {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--input-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.day-header {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent-2);
}

.meal-grid {
  display: grid;
  gap: 12px;
}

.meal-card {
  padding: 12px;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.meal-type {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.meal-selector {
  margin-bottom: 12px;
}

.meal-selector label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--muted);
}

.meal-dropdown {
  width: 100%;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.meal-dropdown:hover {
  border-color: var(--accent);
}

.meal-dropdown:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(106, 163, 255, 0.1);
}

.meal-details {
  margin-top: 8px;
}

.meal-name {
  font-weight: 500;
  margin-bottom: 8px;
}

.meal-link {
  margin-top: 8px;
  font-size: 0.85rem;
}

.meal-link a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

.meal-link a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.meal-macros {
  display: flex;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.meal-macro {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Workout Guidance */
.workout-week {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.workout-day {
  padding: 14px;
  background: var(--input-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.workout-day-name {
  font-weight: 600;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.workout-description {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Reference Library */
.doc-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.doc-item {
  padding: 14px;
  background: var(--input-bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.doc-info {
  flex: 1;
}

.doc-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.doc-summary {
  font-size: 0.85rem;
  color: var(--muted);
}

.doc-tags {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.doc-tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: rgba(106, 163, 255, 0.2);
  color: var(--accent);
  border-radius: 4px;
}

.doc-actions {
  display: flex;
  gap: 8px;
}

.doc-btn {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all .2s;
}

.doc-btn:hover {
  background: var(--border);
}

/* Warning List */
.warning-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.warning-item {
  padding: 12px;
  background: rgba(247, 201, 72, 0.1);
  border-left: 4px solid var(--warn);
  border-radius: 6px;
  color: var(--text);
}

/* Loading State */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-card {
  padding: 24px;
  border-radius: 8px;
}

:root .error-card {
  background: #fee;
  border: 1px solid #fcc;
}

:root[data-theme="light"] .error-card {
  background: #ffebee;
  border: 1px solid #ffcdd2;
}

.error-card h3 {
  color: #c00;
  margin-top: 0;
}


.error-card ul {
  margin-left: 20px;
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }
  
  .site-header, .action-buttons, .form-actions, #header-placeholder {
    display: none !important;
  }
  
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .progress-bar {
    padding: 0 10px;
  }
  
  .step-label {
    font-size: 0.75rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-buttons button {
    width: 100%;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
}
