/* ========================================================================
   MNE - Red de Negocios | Estilos personalizados
   Mobile-first, complementa Bootstrap 5
   ======================================================================== */

:root {
  --mne-blue:       #1565C0;
  --mne-blue-dark:  #0D47A1;
  --mne-blue-light: #42A5F5;
  --mne-green:      #2E7D32;
  --mne-orange:     #E65100;
  --mne-purple:     #6A1B9A;
  --mne-bg:         #F5F7FA;
  --mne-card:       #FFFFFF;
  --bottom-nav-h:   64px;
  --navbar-h:       56px;
}

/* ── Reset / Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  background: var(--mne-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ── Auth / Login ──────────────────────────────────────────────────────── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--mne-blue-dark) 0%, var(--mne-blue) 60%, var(--mne-blue-light) 100%);
  padding: 1rem;
}

.auth-wrapper {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 2rem 1.75rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.auth-logo { text-align: center; }

.auth-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(21,101,192,.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--mne-blue);
}

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  height: var(--navbar-h);
  z-index: 1030;
}

/* ── Main content ──────────────────────────────────────────────────────── */
.main-content {
  min-height: calc(100vh - var(--navbar-h) - var(--bottom-nav-h));
  padding-bottom: calc(var(--bottom-nav-h) + 1rem);
}

/* ── Bottom Navigation ─────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: #fff;
  border-top: 1px solid #e0e0e0;
  display: flex;
  align-items: stretch;
  z-index: 1025;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);

  /* iOS safe area */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #9E9E9E;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .02em;
  transition: color .2s, background .2s;
  border-radius: 0;
  padding: 6px 4px;
}

.bottom-nav__item i {
  font-size: 1.35rem;
  line-height: 1;
}

.bottom-nav__item.active {
  color: var(--mne-blue);
}

.bottom-nav__item:active {
  background: rgba(21,101,192,.06);
}

.bottom-nav__item.btn-invite {
  color: #fff;
  background: var(--mne-blue);
  border-radius: 8px 8px 0 0;
  margin: 0 4px;
  font-weight: 600;
}

.bottom-nav__item.btn-invite.active,
.bottom-nav__item.btn-invite:active {
  background: var(--mne-blue-dark);
  color: #fff;
}

/* ── Tarjetas de estadísticas ──────────────────────────────────────────── */
.stat-card {
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  color: #fff;
  background: var(--mne-blue);
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  min-height: 100px;
}

.stat-card--blue   { background: linear-gradient(135deg, #1565C0, #1E88E5); }
.stat-card--green  { background: linear-gradient(135deg, #2E7D32, #43A047); }
.stat-card--orange { background: linear-gradient(135deg, #E65100, #FF7043); }
.stat-card--purple { background: linear-gradient(135deg, #6A1B9A, #9C27B0); }

.stat-card__icon {
  font-size: 1.5rem;
  opacity: .85;
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card__label {
  font-size: .75rem;
  opacity: .85;
  font-weight: 500;
}

/* ── Avatares ──────────────────────────────────────────────────────────── */
.avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--mne-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
  user-select: none;
}

.avatar-circle--sm {
  width: 34px;
  height: 34px;
  font-size: .8rem;
}

.avatar-circle--lg {
  width: 72px;
  height: 72px;
  font-size: 1.6rem;
}

.avatar-circle-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}

/* ── Score display ─────────────────────────────────────────────────────── */
.score-display {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--mne-blue);
  letter-spacing: -.02em;
}

/* ── Ranking badges ───────────────────────────────────────────────────── */
.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  background: #e0e0e0;
  color: #616161;
}
.rank-1 { background: #FDD835; color: #5D4037; }
.rank-2 { background: #BDBDBD; color: #424242; }
.rank-3 { background: #FF8F00; color: #fff; }

/* ── Foto upload ───────────────────────────────────────────────────────── */
.foto-upload-box {
  border: 2px dashed #90CAF9;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F7FF;
  transition: border-color .2s, background .2s;
  position: relative;
}

.foto-upload-box:active {
  border-color: var(--mne-blue);
  background: #E8F0FE;
}

.foto-placeholder {
  text-align: center;
  padding: 1.5rem 1rem;
}

.foto-preview {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
}

/* ── INE thumb (admin ver usuario) ────────────────────────────────────── */
.ine-thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  cursor: pointer;
  transition: opacity .2s;
}
.ine-thumb:active { opacity: .7; }

.no-foto-box {
  width: 100%;
  height: 110px;
  background: #f5f5f5;
  border: 1px dashed #ccc;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #bbb;
}

/* ── Cards / Misc ──────────────────────────────────────────────────────── */
.card {
  border-radius: 16px !important;
  border: none !important;
}

.card-header {
  border-radius: 16px 16px 0 0 !important;
  font-size: .9rem;
}

.list-group-item {
  border-left: none;
  border-right: none;
}
.list-group-item:first-child { border-top: none; }

/* ── Chart container ───────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  max-height: 300px;
}

/* ── Utility ───────────────────────────────────────────────────────────── */
.min-w-0 { min-width: 0; }

.btn-xs {
  padding: .2rem .5rem;
  font-size: .75rem;
}

.font-monospace { font-family: 'Courier New', Courier, monospace; }

/* Smooth page transitions */
.main-content {
  animation: fadeIn .2s ease;
}

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

/* ── Form ajustes mobile ───────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 10px !important;
  font-size: 1rem;
  padding: .6rem .9rem;
}

.form-control:focus, .form-select:focus {
  box-shadow: 0 0 0 3px rgba(21,101,192,.18);
  border-color: var(--mne-blue);
}

.input-group-text {
  border-radius: 10px 0 0 10px !important;
  background: #f0f4fa;
}

.btn {
  border-radius: 10px;
  font-weight: 500;
}

.btn-lg { padding: .75rem 1.5rem; }

/* ── iOS overrides ─────────────────────────────────────────────────────── */
@supports (-webkit-touch-callout: none) {
  .bottom-nav {
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Dark mode desactivado — forzar modo claro siempre ─────────────────── */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: light; }
  body         { background: var(--mne-bg) !important; color: #212529 !important; }
  .card        { background: #ffffff !important; color: #212529 !important; }
  .card-header { background: #ffffff !important; color: #212529 !important; }
  .list-group-item { background: #ffffff !important; color: #212529 !important; border-color: #dee2e6 !important; }
  .list-group-item-action:hover { background: #f8f9fa !important; }
  .bottom-nav  { background: #ffffff !important; border-top-color: #e0e0e0 !important; }
  .form-control, .form-select { background: #ffffff !important; color: #212529 !important; border-color: #ced4da !important; }
  .input-group-text { background: #f0f4fa !important; color: #495057 !important; border-color: #ced4da !important; }
  .text-muted  { color: #6c757d !important; }
  .foto-upload-box { background: #F3F7FF !important; border-color: #90CAF9 !important; }
  .no-foto-box { background: #f5f5f5 !important; border-color: #ccc !important; }
  .auth-card   { background: #ffffff !important; }
  .table       { color: #212529 !important; }
  .table-light, .table-light th { background: #f8f9fa !important; color: #212529 !important; }
}
