/* ═══════════════════════════════════════════════
   MABY MENTORÍAS — CSS Mobile-First
   Paleta: tierra cálida + verde salvia + crema
   Tipografía: DM Serif Display + DM Sans
═══════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg:         #FAF7F2;
  --bg-card:    #FFFFFF;
  --bg-input:   #F5F1EB;
  --border:     #E8E2D9;
  --border-focus: #8FAF8A;

  --text-primary:   #2C2417;
  --text-secondary: #7A6E62;
  --text-muted:     #ADA49A;

  --accent:      #6B9A64;   /* verde salvia */
  --accent-dark: #4E7848;
  --accent-light:#EFF6EE;

  --warm:        #C4825A;   /* terracota */
  --warm-light:  #FDF1EB;

  --status-sin:  #E8B4A0;
  --status-contacto: #A8C5E8;
  --status-seguimiento: #C5A8E8;
  --status-activa: #8FAF8A;

  --shadow-sm: 0 1px 3px rgba(44,36,23,.07);
  --shadow-md: 0 4px 16px rgba(44,36,23,.10);
  --shadow-lg: 0 12px 40px rgba(44,36,23,.14);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', sans-serif;

  --transition: .2s cubic-bezier(.4,0,.2,1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ── */
.screen { display: none; }
.screen.active { display: block; }

/* ══════════════════════════════════════
   LOGIN
══════════════════════════════════════ */
#login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #2C2417 0%, #3D3425 50%, #1E3A1A 100%);
}

.login-bg { position: absolute; inset: 0; pointer-events: none; }

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .25;
}
.login-orb-1 {
  width: 320px; height: 320px;
  background: #6B9A64;
  top: -80px; right: -80px;
}
.login-orb-2 {
  width: 260px; height: 260px;
  background: #C4825A;
  bottom: -60px; left: -60px;
}

.login-card {
  position: relative;
  background: rgba(250,247,242,.97);
  border-radius: var(--radius-xl);
  padding: 40px 32px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .5s cubic-bezier(.34,1.56,.64,1) both;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}

.logo-leaf {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(107,154,100,.4));
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1.1;
  color: var(--text-primary);
}

.login-logo h1 em {
  font-style: italic;
  color: var(--accent);
}

.login-tagline {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  padding-left: 50px;
}

.login-footer {
  text-align: center;
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 20px;
}

/* ══════════════════════════════════════
   FORM ELEMENTS (shared)
══════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: .95rem;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A6E62' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(107,154,100,.15);
  background: #fff;
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  letter-spacing: .01em;
}
.btn-primary:hover { background: var(--accent-dark); box-shadow: 0 4px 16px rgba(107,154,100,.35); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { background: var(--bg-input); color: var(--text-primary); }

.btn-danger {
  background: #FEE2E2;
  color: #B91C1C;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-danger:hover { background: #FECACA; }

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg-input); color: var(--text-primary); }

/* ── Error / helpers ── */
.error-msg {
  background: #FEE2E2;
  color: #B91C1C;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .85rem;
  margin-bottom: 12px;
}
.hidden { display: none !important; }

/* ══════════════════════════════════════
   APP HEADER
══════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,247,242,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 760px;
  margin: 0 auto;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-primary);
}

.brand-name { font-style: italic; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-export:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.btn-export-pdf:hover { border-color: var(--warm); color: var(--warm); background: var(--warm-light); }

/* ══════════════════════════════════════
   APP MAIN
══════════════════════════════════════ */
.app-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* ── Stats ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.stat-active .stat-num { color: var(--accent); }
.stat-follow .stat-num { color: #7C5ABF; }
.stat-no-resp .stat-num { color: var(--warm); }

/* ── Controls ── */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  flex: 1;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  white-space: nowrap;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-new {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 9px 18px;
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition), box-shadow var(--transition);
  box-shadow: 0 3px 12px rgba(107,154,100,.35);
}
.btn-new:hover { background: var(--accent-dark); box-shadow: 0 4px 18px rgba(107,154,100,.45); }

/* ── Search ── */
.search-wrap {
  position: relative;
  margin-bottom: 20px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px 11px 40px;
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.search-wrap input:focus { border-color: var(--border-focus); }

/* ── Cards Grid ── */
.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Mentoría Card ── */
.mentoria-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  animation: fadeIn .3s ease both;
}
.mentoria-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: #D8D2C9;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #A8D4A2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.01em;
}

.card-info { flex: 1; min-width: 0; }

.card-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-email {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-status {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 4px 10px;
  border-radius: 100px;
  flex-shrink: 0;
  white-space: nowrap;
}

.status-Sin\ respuesta { background: #FEE2D5; color: #A34918; }
.status-En\ contacto   { background: #DBEAFE; color: #1E40AF; }
.status-Seguimiento    { background: #EDE9FE; color: #5B21B6; }
.status-Mentoría\ activa { background: var(--accent-light); color: var(--accent-dark); }

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .78rem;
  color: var(--text-secondary);
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-meta-item svg { color: var(--text-muted); flex-shrink: 0; }

.card-oficio {
  margin-top: 8px;
  font-size: .8rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── States ── */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state span { font-size: 2.5rem; }
.empty-state p { font-size: .9rem; line-height: 1.6; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ══════════════════════════════════════
   MODALS
══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,36,23,.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn .2s ease;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  animation: slideUp .35s cubic-bezier(.34,1.2,.64,1) both;
  box-shadow: 0 -8px 40px rgba(44,36,23,.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text-primary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  overscroll-behavior: contain;
}

.form-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-light);
  padding-bottom: 6px;
  margin: 20px 0 14px;
}
.form-section-title:first-child { margin-top: 0; }

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.modal-footer .btn-secondary,
.modal-footer .btn-danger { flex: 1; }
.modal-footer .btn-primary { flex: 2; }

/* ── Detail Modal ── */
.modal-card-detail .modal-body { padding: 16px 20px; }

.detail-section {
  margin-bottom: 18px;
}

.detail-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 10px;
  border-bottom: 1px solid var(--accent-light);
  padding-bottom: 4px;
}

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

.detail-item label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.detail-item span {
  font-size: .9rem;
  color: var(--text-primary);
  display: block;
}

.detail-item span.empty-val { color: var(--text-muted); font-style: italic; }

.detail-text-block {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: .88rem;
  color: var(--text-primary);
  line-height: 1.55;
  white-space: pre-wrap;
}

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: #fff;
  padding: 12px 22px;
  border-radius: 100px;
  font-size: .875rem;
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════
   KEYFRAMES
══════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════
   TABLET / DESKTOP (min-width: 600px)
══════════════════════════════════════ */
@media (min-width: 600px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }

  .modal-card {
    border-radius: var(--radius-lg);
    max-height: 88dvh;
  }

  .stats-row { gap: 14px; }

  .stat-num { font-size: 2rem; }

  .mentoria-card { padding: 20px; }

  .app-main { padding: 24px 20px 60px; }
}

@media (min-width: 760px) {
  .cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .loading-state, .empty-state {
    grid-column: 1 / -1;
  }
}
