/* ==========================================================================
   APEX TRAINER — STYLESHEET (Dark Fitness & Nutrition Theme)
   ========================================================================== */

:root {
  --bg-dark: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #172136;
  --bg-input: #1a233a;
  --border-color: #24304f;
  --border-focus: #3b82f6;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  /* Colores de Acento y Macros */
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.2);

  --macro-cal: #f59e0b;
  --macro-prot: #ef4444;
  --macro-gras: #8b5cf6;
  --macro-carb: #06b6d4;

  --danger: #f43f5e;
  --warning: #eab308;
  --success: #10b981;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.45);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* Utilities */
.text-muted { color: var(--text-muted); font-size: 0.9rem; }
.highlight { color: var(--accent); font-weight: 700; }
.accent-text { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Header & Nav */
.app-header {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow);
}

.brand-text h1 {
  font-size: 1.25rem;
  margin: 0;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.profile-badge {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.75rem;
  gap: 0.5rem;
}

.avatar-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--primary);
}

.profile-dropdown {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

/* Nav Tabs */
.nav-tabs-wrapper {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 1.5rem;
  overflow-x: auto;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-tab:hover {
  color: #fff;
}

.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-tab i {
  width: 18px;
  height: 18px;
}

/* Main Container */
.main-container {
  max-width: 1300px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1.5rem 3rem;
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-content.active {
  display: block;
}

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

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-header h3 {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-footer {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
}

/* Badges */
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.badge-accent {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-accent {
  background: var(--accent);
  color: #090d16;
}
.btn-accent:hover { background: #059669; color: #fff; }

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover { background: var(--bg-card-hover); border-color: var(--text-muted); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.82rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }

.btn-icon {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover { color: #fff; border-color: var(--text-muted); }

/* Forms & Inputs */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-input-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

.form-row {
  display: flex;
  gap: 1rem;
}
.col-half { flex: 1; }
.col-third { flex: 1; }

/* Dashboard Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

.welcome-card {
  grid-column: span 12;
  background: linear-gradient(135deg, #131d36 0%, #0d1527 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.welcome-text h2 { font-size: 1.6rem; }

.quick-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-pill {
  background: rgba(11, 15, 23, 0.6);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }
.stat-value { font-size: 0.95rem; font-weight: 700; color: #fff; }

.nutrition-dash-card { grid-column: span 6; }
.workout-dash-card { grid-column: span 6; }
.status-dash-card { grid-column: span 12; }

/* Macro Bars */
.macro-bars-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.macro-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.cal-fill { background: var(--macro-cal); }
.prot-fill { background: var(--macro-prot); }
.gras-fill { background: var(--macro-gras); }
.carb-fill { background: var(--macro-carb); }

/* Status box */
.status-box {
  display: flex;
  gap: 2rem;
  margin-top: 0.5rem;
}

.status-tag {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
}

.tag-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }

/* Training Tab */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.workout-days-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.day-tab-btn {
  padding: 0.65rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.day-tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.timer-widget {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  font-weight: 700;
  color: var(--accent);
}

.exercises-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.exercise-card-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}

.exercise-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.exercise-title h4 { font-size: 1.05rem; }
.exercise-meta { font-size: 0.8rem; color: var(--text-muted); }

.sets-table {
  width: 100%;
  border-collapse: collapse;
}

.sets-table th, .sets-table td {
  padding: 0.45rem 0.6rem;
  text-align: center;
  font-size: 0.85rem;
}

.sets-table th { color: var(--text-muted); font-weight: 500; }

.set-input-small {
  width: 70px;
  padding: 0.3rem 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  text-align: center;
  font-weight: 600;
}

.session-finish-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.session-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.session-rpe-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

/* Nutrition Tab Layout */
.nutrition-layout-grid {
  display: grid;
  grid-template-columns: 4fr 8fr;
  gap: 1.5rem;
}

.calories-target-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 8px solid var(--border-color);
  border-top-color: var(--macro-cal);
  border-right-color: var(--macro-prot);
  border-bottom-color: var(--macro-gras);
  border-left-color: var(--macro-carb);
  margin: 1.5rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-circle-inner {
  text-align: center;
}

.cal-big-number { font-size: 1.8rem; font-weight: 800; color: #fff; display: block; line-height: 1.1; }
.cal-circle-label { font-size: 0.75rem; color: var(--text-muted); }

.macro-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.macro-stat-box {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 0.6rem;
  text-align: center;
  border-top: 3px solid transparent;
}

.prot-box { border-top-color: var(--macro-prot); }
.gras-box { border-top-color: var(--macro-gras); }
.carb-box { border-top-color: var(--macro-carb); }

.macro-name { font-size: 0.72rem; color: var(--text-muted); display: block; }
.macro-qty { font-size: 0.88rem; font-weight: 700; color: #fff; }

.nutri-guidelines-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 0.9rem;
}

.nutri-guidelines-box h4 {
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
  color: var(--primary);
}

.meal-block {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.meal-block-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  text-transform: capitalize;
}

.meal-items-list {
  list-style: none;
}

.meal-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.btn-delete-food {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0.2rem;
}

/* Evolution & Chart */
.evolution-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.chart-wrapper {
  width: 100%;
  height: 340px;
  position: relative;
}

.metrics-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-input);
}

/* Checkin Tab */
.checkin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.diagnosis-content {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  min-height: 180px;
  line-height: 1.6;
  font-size: 0.92rem;
}

.reajuste-action-panel {
  margin-top: 1rem;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  animation: modalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card.modal-lg { max-width: 750px; }

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
}
.btn-close-modal:hover { color: #fff; }

.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Wizard Stepper */
.wizard-stepper {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.step-dot.active {
  color: var(--accent);
  font-weight: 700;
}

.wizard-step { display: none; }
.wizard-step.active { display: block; }

.goal-cards-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.goal-option-card {
  position: relative;
  cursor: pointer;
}

.goal-option-card input {
  position: absolute;
  opacity: 0;
}

.goal-card-content {
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: var(--transition);
}

.goal-option-card input:checked + .goal-card-content {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.08);
}

.goal-card-content i { color: var(--accent); width: 24px; height: 24px; }
.goal-card-content strong { font-size: 0.95rem; }
.goal-card-content span { font-size: 0.8rem; color: var(--text-muted); }

/* Responsive adjustments */
@media (max-width: 900px) {
  .nutrition-dash-card, .workout-dash-card, .status-dash-card { grid-column: span 12; }
  .nutrition-layout-grid { grid-template-columns: 1fr; }
  .checkin-grid { grid-template-columns: 1fr; }
  .goal-cards-selector { grid-template-columns: 1fr; }
}
