/* assets/css/app.css - Estilos Mobile-First e Design System do PWA Treino */
:root {
  --bg-dark: #121214;
  --card-bg: #202024;
  --card-border: #323238;
  --input-bg: #29292e;
  --text-main: #e1e1e6;
  --text-muted: #a8a8b3;
  --primary: #00e676;
  --primary-hover: #00c853;
  --accent: #00b0ff;
  --warning: #ff9100;
  --danger: #ff5252;
  --p1-color: #ff5252;
  --p2-color: #ff9100;
  --p3-color: #00b0ff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: 75px; /* Espaço para menu inferior */
}

/* App Container & Header */
.app-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.sync-badge.online { color: var(--primary); }
.sync-badge.pending { color: var(--warning); }
.sync-badge.error { color: var(--danger); }

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: var(--card-bg);
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  width: 33%;
  padding: 8px 0;
  transition: color 0.2s ease;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Tab Views */
.tab-view {
  display: none;
  padding: 16px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.tab-view.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

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

/* Cards & UI Elements */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  width: 100%;
  transition: transform 0.1s ease, filter 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #09090a;
}

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

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-accent {
  background: var(--accent);
  color: #000000;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
  width: auto;
}

/* Modo Academia / Treino Ativo */
.workout-active-bar {
  background: #18181b;
  border-bottom: 1px solid var(--card-border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
}

.timer-display {
  font-size: 1.2rem;
  font-family: monospace;
  color: var(--accent);
  background: #000;
  padding: 4px 10px;
  border-radius: 6px;
}

.exercise-focus-card {
  background: var(--card-bg);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  margin-top: 10px;
}

.exercise-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.exercise-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.set-tracker {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.set-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--input-bg);
  border: 2px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.set-dot.completed {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
}

.set-dot.current {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 176, 255, 0.1);
}

.load-reps-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--input-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  border: 1px solid var(--card-border);
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}

/* Descanso Timer overlay / card */
.rest-banner {
  background: linear-gradient(135deg, #0d321d 0%, #164e29 100%);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
  text-align: center;
}

.rest-timer-value {
  font-size: 2.8rem;
  font-weight: 900;
  font-family: monospace;
  color: #ffffff;
  margin: 8px 0;
}

.rest-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Inputs & Form Controls */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  min-height: 48px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
}

/* Dynamic Toasts (Substitui alert JS) */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: 90%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--card-bg);
  border-left: 4px solid var(--primary);
  color: var(--text-main);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideDown 0.3s ease;
  pointer-events: auto;
}

.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-success { border-left-color: var(--primary); }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modais */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.effort-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.effort-btn {
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.effort-btn:active { background: var(--card-border); }

.badge-prio {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
}
.prio-P1 { background: var(--p1-color); color: #fff; }
.prio-P2 { background: var(--p2-color); color: #000; }
.prio-P3 { background: var(--p3-color); color: #000; }
