/**
 * FoodGym PWA - Estilos Customizados e Design System Mobile-First
 * Dark Mode Premium, Glassmorphism, Neon Accents & Micro-Animations
 */

:root {
  --bg-main: #0b0f19;
  --bg-card: #151d2e;
  --bg-card-hover: #1b263b;
  --bg-glass: rgba(21, 29, 46, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --color-primary: #10b981;     /* Esmeralda Fitness */
  --color-primary-glow: rgba(16, 185, 129, 0.35);
  --color-secondary: #06b6d4;   /* Ciano */
  --color-warning: #f59e0b;     /* Âmbar */
  --color-danger: #ef4444;      /* Vermelho */
  --color-purple: #8b5cf6;      /* Roxo Treino */
  --color-pink: #ec4899;        /* Rosa */

  --bottom-bar-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  padding-bottom: calc(var(--bottom-bar-height) + var(--safe-bottom) + 20px);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

/* Scrollbar sutil */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* Header Superior Fixo */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  padding: 12px 16px;
}

.brand-badge {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Cards Estilizados */
.gym-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.gym-card-interactive:active {
  transform: scale(0.985);
}

/* Área do Mascote e Gamificação */
.mascot-hero-card {
  background: linear-gradient(145deg, #162032 0%, #0d1522 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 22px;
  padding: 18px;
  position: relative;
  overflow: visible;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.mascot-avatar-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}

.mascot-avatar-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
  animation: mascot-float 3.5s ease-in-out infinite alternate;
}

@keyframes mascot-float {
  0% { transform: translateY(0px) scale(1); }
  100% { transform: translateY(-6px) scale(1.02); }
}

.mascot-pulse-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  opacity: 0.6;
  animation: pulse-border 2s cubic-bezier(0.25, 1, 0.5, 1) infinite;
}

@keyframes pulse-border {
  0% { transform: scale(0.95); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* Balão de Fala do Mascote */
.mascot-speech-bubble {
  background: #1e293b;
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 12px 14px;
  position: relative;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  font-size: 0.92rem;
  line-height: 1.4;
  color: #f1f5f9;
}

.mascot-speech-bubble::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 8px 8px 8px 0;
  border-style: solid;
  border-color: transparent #1e293b transparent transparent;
}

/* Barras de Progresso Nutricional */
.macro-progress-bar {
  height: 8px;
  background-color: #1e293b;
  border-radius: 999px;
  overflow: hidden;
}

.macro-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fill-calories {
  background: linear-gradient(90deg, #10b981, #06b6d4);
  box-shadow: 0 0 10px var(--color-primary-glow);
}
.fill-protein {
  background: linear-gradient(90deg, #ec4899, #f43f5e);
}
.fill-carbs {
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
}
.fill-fat {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

/* Gráfico Circular de Jejum (Doughnut Progress Ring) */
.fasting-ring-container {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
}

.fasting-svg-ring {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.ring-bg {
  fill: none;
  stroke: #1e293b;
  stroke-width: 12;
}

.ring-progress {
  fill: none;
  stroke: url(#fastingGradient);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.fasting-center-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Lista de Refeições e Itens */
.meal-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 8px;
}

.meal-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(30, 41, 59, 0.45);
  border-radius: 12px;
  margin-bottom: 6px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.meal-item-row:hover {
  background: rgba(30, 41, 59, 0.8);
}

/* Cards de Exercícios da Musculação */
.exercise-card-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #0f172a;
  border: 1px solid var(--border-glass);
}

/* Bottom Navigation Bar Mobile */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-bar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
}

.nav-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 10px;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
}

.nav-tab-item i {
  font-size: 1.35rem;
  margin-bottom: 2px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.nav-tab-item.active i {
  transform: translateY(-2px);
  text-shadow: 0 0 12px var(--color-primary-glow);
}

.nav-tab-item.active::after {
  content: "";
  position: absolute;
  top: 0;
  width: 24px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 0 8px var(--color-primary);
}

/* Floating Action Button (Câmera IA) */
.fab-ai-camera {
  position: fixed;
  bottom: calc(var(--bottom-bar-height) + var(--safe-bottom) + 14px);
  right: 18px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  border: none;
  cursor: pointer;
  z-index: 990;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.fab-ai-camera:active {
  transform: scale(0.92);
}

/* Modais estilizados */
.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  color: var(--text-main);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  border-bottom: 1px solid var(--border-glass);
}

.modal-footer {
  border-top: 1px solid var(--border-glass);
}

.form-control, .form-select {
  background-color: #0b0f19;
  border: 1px solid #334155;
  color: #f8fafc;
  border-radius: 12px;
}

.form-control:focus, .form-select:focus {
  background-color: #0b0f19;
  border-color: var(--color-primary);
  color: #f8fafc;
  box-shadow: 0 0 0 0.25rem rgba(16, 185, 129, 0.25);
}

/* Responsividade e Mobile */
@media (max-width: 576px) {
  .mascot-speech-bubble::before {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 8px 8px 8px;
    border-color: transparent transparent #1e293b transparent;
  }
}
