/* ==============================================================================
   TheModelSuite.com — Design System (MyFitnessPal Clean Light Aesthetic)
   Pure English, High Contrast, Clean Minimalist UI, Zero Emojis
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  /* Core Brand Colors (MyFitnessPal Style) */
  --brand-blue: #0066ee;
  --brand-blue-hover: #0052cc;
  --brand-blue-light: #eff6ff;
  --brand-blue-border: #bfdbfe;

  /* Neutrals (Light Theme - Default) */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #0066ee;

  /* State & Metric Indicators */
  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-success-border: #bbf7d0;
  --color-warning: #d97706;
  --color-warning-bg: #fef3c7;
  --color-warning-border: #fde68a;
  --color-danger: #dc2626;
  --color-danger-bg: #fee2e2;
  --color-danger-border: #fecaca;
  --color-accent: #0284c7;

  /* Radii & Shadows */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* Typography */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==============================================================================
   Optional Dark Mode (ONLY WHEN EXPLICITLY ENABLED)
   ============================================================================== */
body.dark-mode {
  --bg-app: #090d16;
  --bg-card: #111827;
  --bg-card-subtle: #1e293b;
  --bg-input: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-light: #1e293b;
  --border-medium: #334155;
  --border-focus: #38bdf8;
  --brand-blue-light: rgba(0, 102, 238, 0.15);
  --brand-blue-border: rgba(0, 102, 238, 0.35);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

html, body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  position: relative;
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, canvas, svg, iframe {
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: break-word;
  word-break: break-word;
}

p, span, li, a, div {
  overflow-wrap: break-word;
}

a {
  color: var(--brand-blue);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--brand-blue-hover);
}

/* Clean SVG Icon Helper */
.icon {
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Standard Containers */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }
}

/* Card Component (MyFitnessPal Clean White Block) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  border-color: var(--border-medium);
}
.card-subtle {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn-primary {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
}
.btn-primary:hover {
  background: var(--brand-blue-hover);
  border-color: var(--brand-blue-hover);
  color: #ffffff;
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.btn-secondary:hover {
  background: var(--bg-card-subtle);
  border-color: var(--text-muted);
}
.btn-outline {
  background: transparent;
  color: var(--brand-blue);
  border-color: var(--brand-blue-border);
}
.btn-outline:hover {
  background: var(--brand-blue-light);
  border-color: var(--brand-blue);
}
.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}
.btn-lg {
  padding: 0.85rem 1.6rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}
.btn-pill {
  border-radius: var(--radius-pill);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}
.form-control {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 102, 238, 0.15);
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-blue {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  border: 1px solid var(--brand-blue-border);
}
.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}
.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
}
.badge-subtle {
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

/* Clean Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  max-width: 650px;
  width: 100%;
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  padding: 2rem;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}
@media (max-width: 600px) {
  .modal-overlay {
    padding: 0.65rem;
  }
  .modal-box {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
    max-height: 92vh;
  }
}
.modal-overlay.active .modal-box {
  transform: scale(1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1rem;
}
.modal-close {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}
.modal-close svg {
  stroke: #0f172a;
  stroke-width: 2.5px;
}
.modal-close:hover {
  background: #e2e8f0;
  border-color: #0066ee;
  color: #0066ee;
  transform: scale(1.08);
}
.modal-close:hover svg {
  stroke: #0066ee;
}
[data-theme="dark"] .modal-close {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}
[data-theme="dark"] .modal-close svg {
  stroke: #f8fafc;
}
[data-theme="dark"] .modal-close:hover {
  background: #334155;
  border-color: #3b82f6;
  color: #3b82f6;
}
[data-theme="dark"] .modal-close:hover svg {
  stroke: #3b82f6;
}

/* Tables */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}
.data-table th {
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card-subtle);
}
.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.data-table tr:hover td {
  background: var(--bg-card-subtle);
}

@media (max-width: 640px) {
  .data-table th, .data-table td {
    padding: 0.5rem 0.55rem;
    font-size: 0.74rem;
  }
}
