/* ── NAV BAR (Navegación Móvil/Escritorio) ── */
.nav-bar {
  display: flex;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
  width: 100%;
  position: relative;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  cursor: pointer;
  gap: 2px;
  min-height: 52px;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}

.nav-item span {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item:active {
  opacity: 0.6;
}

.nav-item.active svg {
  stroke: var(--accent);
  transform: translateY(-2px);
}

.nav-item.active span {
  color: var(--accent);
  font-weight: 600;
}

.nav-label {
  display: block;
}

/* ── HEADER ── */
.header {
  padding: calc(var(--safe-top) + 16px) 16px 12px;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-title span {
  color: var(--accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botones Icono */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:active {
  background-color: var(--bg-active);
  transform: scale(0.95);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--text);
  fill: none;
  stroke-width: 2;
}

/* ── CARDS (Tarjetas Premium) ── */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'DM Mono', monospace;
  margin-bottom: 6px;
}

/* ── FORMULARIOS Y CONTROLES ── */
.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  font-family: 'DM Mono', monospace;
}

.field input, .field select, .field textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: all 0.15s ease;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  background-color: var(--bg-active);
}

.field textarea {
  resize: none;
  height: 80px;
  line-height: 1.5;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Checkbox estilizado */
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background-color: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* ── BOTONES ── */
.btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

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

.btn-primary:active {
  background-color: var(--accent-dim);
}

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

.btn-secondary:active {
  background-color: var(--bg-active);
}

.btn-danger {
  background-color: var(--red-soft);
  border: 1px solid rgba(255, 77, 77, 0.25);
  color: var(--red);
}

/* ── DRAWERS (Bottom Sheets) ── */
.drawer-bg {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(8px);
}

.drawer-bg.open {
  opacity: 1;
  pointer-events: all;
}

.drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--border);
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.94, 0.6, 1);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(20px + var(--safe-bottom));
}

.drawer.open {
  transform: translateY(0);
}

.drawer-handle {
  width: 36px;
  height: 4px;
  background-color: var(--border-focus);
  border-radius: 2px;
  margin: 12px auto 6px;
}

.drawer-header {
  padding: 8px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.drawer-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* ── TOAST NOTIFICATIONS ── */
.toast-container {
  position: fixed;
  bottom: calc(76px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  pointer-events: none;
}

.toast {
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  background-color: rgba(232, 255, 71, 0.1);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background-color: var(--red-soft);
  color: var(--red);
  border-color: rgba(255, 77, 77, 0.2);
}

/* ── CHAT BUBBLES ── */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
}

.chat-bubble.coach {
  background-color: var(--bg-card);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.chat-bubble.user {
  background-color: var(--accent);
  color: #000000;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* ── MEDIA RESPONSIVE (Desktop layout >= 768px) ── */
@media (min-width: 768px) {
  #app {
    flex-direction: row;
  }
  
  .nav-bar {
    flex-direction: column;
    width: 240px;
    min-width: 240px;
    height: 100vh;
    border-top: none;
    border-right: 1px solid var(--border);
    padding-top: calc(var(--safe-top) + 24px);
    padding-bottom: 24px;
    justify-content: flex-start;
    gap: 8px;
  }
  
  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 24px;
    margin: 0 12px;
    border-radius: var(--radius-sm);
    gap: 12px;
    min-height: 48px;
    flex: 0;
  }
  
  .nav-item span {
    font-size: 14px;
  }
  
  .nav-item.active {
    background-color: var(--accent-soft);
  }
  
  .nav-item.active svg {
    transform: none;
  }
  
  .view {
    padding-bottom: 40px;
  }
  
  /* Ajustes de drawers en desktop */
  .drawer {
    max-width: 500px;
    left: auto;
    right: 0;
    height: 100vh;
    max-height: 100vh;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    border-left: 1px solid var(--border);
    border-top: none;
    transform: translateX(100%);
  }
  
  .drawer.open {
    transform: translateX(0);
  }
  
  .drawer-handle {
    display: none;
  }
}
