/* ══════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════ */
:root {
  --bg:          #f0f4ff;
  --bg2:         #e4eaff;
  --surface:     #ffffff;
  --ink:         #0f1523;
  --ink2:        #3a4260;
  --ink3:        #7a84a8;
  --primary:     #4361ee;
  --primary2:    #3a56d4;
  --primary-light: #eef1ff;
  --accent:      #f72585;
  --border:      #d8dfff;
  --shadow-sm:   0 1px 4px rgba(67,97,238,.08);
  --shadow:      0 4px 20px rgba(67,97,238,.11);
  --shadow-lg:   0 12px 40px rgba(67,97,238,.16);
  --radius:      10px;
  --radius-sm:   6px;
  --radius-lg:   16px;
  --font:        'Plus Jakarta Sans', sans-serif;
  --font-display:'Syne', sans-serif;
  --header-h:    58px;
  --mnav-h:      64px;
}

/* ══════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
}
button { cursor: pointer; font-family: var(--font); }

/* ══════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════ */
.hidden  { display: none !important; }
.mt-12   { margin-top: 12px; }

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,21,35,.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}
.modal-header {
  background: var(--primary);
  padding: 24px 24px 20px;
}
.modal-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: white;
  display: block;
}
.modal-sub {
  color: rgba(255,255,255,.75);
  font-size: .85rem;
  margin-top: 2px;
}
.modal-body {
  padding: 20px 24px 24px;
  max-height: 80vh;
  overflow-y: auto;
}

/* Chip grid — existing matronas */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  min-height: 20px;
}
.matrona-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 6px 8px 6px 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  user-select: none;
}
.matrona-chip:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}
.chip-kuki  { font-size: 1.1rem; line-height: 1; }
.chip-name  { font-size: .85rem; font-weight: 600; color: var(--ink2); }
.chip-color { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chip-delete {
  background: none; border: none;
  color: var(--ink3); font-size: .95rem;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.chip-delete:hover { background: #fee2e2; color: #ef4444; }

/* Add section */
.add-section { border-top: 1.5px solid var(--border); padding-top: 18px; }
.section-label {
  font-size: .72rem; font-weight: 700; color: var(--ink3);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 8px;
}
.add-section input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: .9rem;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.add-section input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

/* Kuki picker */
.kuki-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}
.kuki-btn {
  font-size: 1.35rem;
  line-height: 1;
  padding: 5px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: background .1s, border-color .1s, transform .1s;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.kuki-btn:hover  { background: var(--bg2); transform: scale(1.15); }
.kuki-btn.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: scale(1.1);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  border: none; font-size: .85rem; font-weight: 700;
  font-family: var(--font);
  transition: all .15s; letter-spacing: .01em;
}
.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary2); }
.btn-block     { width: 100%; justify-content: center; }
.btn-ghost {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--ink2);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: .78rem; font-weight: 600;
  font-family: var(--font);
  transition: all .15s;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.error-msg {
  color: #ef4444;
  font-size: .8rem;
  margin-top: 6px;
}

/* ══════════════════════════════════════════
   HEADER
══════════════════════════════════════════ */
#header {
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  height: var(--header-h);
  padding: 0 24px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.logo {
  font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 800;
  color: var(--primary);
  white-space: nowrap; letter-spacing: -.01em;
}
.logo-dot { color: var(--accent); }

#nav { display: flex; gap: 2px; flex: 1; }
.nav-btn {
  background: none; border: none;
  color: var(--ink3);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .83rem; font-weight: 600;
  transition: all .15s;
}
.nav-btn:hover  { color: var(--ink); background: var(--bg); }
.nav-btn.active { color: var(--primary); background: var(--primary-light); }

#user-area {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; flex-shrink: 0;
}
.user-kuki { font-size: 1.3rem; line-height: 1; }
.user-name { font-weight: 700; color: var(--ink2); }

/* ══════════════════════════════════════════
   MOBILE NAV (bottom)
══════════════════════════════════════════ */
#mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--mnav-h);
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  box-shadow: 0 -4px 16px rgba(67,97,238,.08);
  z-index: 100;
}
.mnav-btn {
  flex: 1;
  background: none; border: none;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  color: var(--ink3);
  font-size: .7rem; font-weight: 600;
  font-family: var(--font);
  transition: color .15s;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mnav-btn .mnav-icon { font-size: 1.3rem; line-height: 1; }
.mnav-btn.active { color: var(--primary); }

/* ══════════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════════ */
#main {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 24px;
}
.tab-pane { }

/* ══════════════════════════════════════════
   CARD
══════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

/* ══════════════════════════════════════════
   LEGEND
══════════════════════════════════════════ */
.legend {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 12px;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px 4px 8px;
  font-size: .78rem; font-weight: 600; color: var(--ink2);
}
.legend-dot {
  width: 9px; height: 9px;
  border-radius: 50%; flex-shrink: 0;
}
.legend-kuki { font-size: .95rem; line-height: 1; }

.hint {
  font-size: .75rem; color: var(--ink3);
  margin-top: 8px; padding-left: 2px;
}

/* ══════════════════════════════════════════
   INTERCAMBIOS
══════════════════════════════════════════ */
.matrona-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.matrona-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1.5px solid var(--border);
}
.mcard-kuki   { font-size: 1.4rem; line-height: 1; }
.mcard-name   { font-family: var(--font-display); font-size: .95rem; font-weight: 700; color: var(--ink); }
.mcard-color  { width: 10px; height: 10px; border-radius: 50%; margin-left: auto; flex-shrink: 0; }

.day-row {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bg2);
  gap: 12px;
}
.day-row:last-child { border-bottom: none; }

.day-date {
  font-size: .88rem; font-weight: 600; color: var(--ink);
}
.vol-badges {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 4px;
}
.vol-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .72rem; font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  color: var(--ink);
}

/* Volunteer button */
.btn-ofrecerse {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: .78rem; font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink2);
  font-family: var(--font);
  transition: all .15s;
  cursor: pointer;
}
.btn-ofrecerse:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.btn-ofrecerse.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ══════════════════════════════════════════
   FULLCALENDAR OVERRIDES
══════════════════════════════════════════ */
.fc { font-family: var(--font) !important; }

.fc .fc-toolbar-title {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 800;
  color: var(--ink);
  text-transform: capitalize;
}
.fc .fc-button {
  background: var(--surface) !important;
  border: 1.5px solid var(--border) !important;
  color: var(--ink2) !important;
  box-shadow: none !important;
  border-radius: var(--radius-sm) !important;
  padding: 5px 10px !important;
  font-size: .82rem !important;
  font-family: var(--font) !important;
  font-weight: 600 !important;
  transition: border-color .15s, color .15s !important;
}
.fc .fc-button:hover {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}
.fc .fc-button:focus { box-shadow: none !important; }

.fc-daygrid-day { cursor: pointer; }
.fc-daygrid-day:hover .fc-daygrid-day-frame { background: var(--primary-light); }

.fc-daygrid-event {
  font-size: .72rem !important;
  border-radius: 5px !important;
  padding: 1px 5px !important;
  font-weight: 600 !important;
  cursor: pointer;
}
.fc-event-own {
  outline: 2px solid rgba(0,0,0,.2);
  outline-offset: -1px;
}

.fc .fc-day-today .fc-daygrid-day-number {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.fc .fc-col-header-cell {
  font-size: .72rem; font-weight: 700;
  color: var(--ink3);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.fc .fc-daygrid-day-number { font-size: .82rem; color: var(--ink2); }
.fc-theme-standard td,
.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid { border-color: var(--bg2) !important; }

/* ══════════════════════════════════════════
   RESPONSIVE — MOBILE
══════════════════════════════════════════ */
@media (max-width: 640px) {
  #nav       { display: none; }
  #mobile-nav { display: flex; }
  #user-area .user-name { display: none; }

  #main {
    padding: 16px 12px;
    padding-bottom: calc(var(--mnav-h) + 16px);
  }

  .card { padding: 10px; }

  .kuki-grid { grid-template-columns: repeat(8, 1fr); }

  .modal-box { border-radius: 12px; }
  .modal-body { padding: 16px; }

  .fc .fc-toolbar-title { font-size: .88rem; }
  .fc .fc-button { padding: 4px 8px !important; font-size: .75rem !important; }

  .day-row { flex-wrap: wrap; }
  .btn-ofrecerse { margin-top: 4px; }

  #header { padding: 0 16px; }
  .logo   { font-size: 1rem; }
}
