
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Montserrat:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #090817;
  --bg-soft: #121027;
  --panel: rgba(24, 22, 48, .92);
  --panel-light: rgba(34, 29, 62, .96);
  --purple: #a78bfa;
  --purple-light: #c4a5ff;
  --pink: #f08acb;
  --blue: #79baff;
  --silver: #d8d8ef;
  --text: #f3efff;
  --muted: #b3abc9;
  --border: rgba(190, 157, 255, .24);
  --success: #72dfb1;
  --danger: #ff829e;
  --shadow: 0 15px 45px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 10% 5%, rgba(112, 64, 180, .23), transparent 35%),
    radial-gradient(ellipse at 90% 15%, rgba(38, 102, 170, .18), transparent 35%),
    radial-gradient(ellipse at 80% 90%, rgba(183, 65, 145, .15), transparent 38%),
    linear-gradient(135deg, #090817, #11102a 48%, #100b20);
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--purple-light);
  outline-offset: 3px;
}

.hidden { display: none !important; }

/* FONDO ANIMADO */

.ambient {
  position: fixed;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: .22;
  pointer-events: none;
  z-index: 0;
  animation: floatGlow 13s ease-in-out infinite alternate;
}

.ambient-one {
  background: #8548d8;
  top: -130px;
  left: -100px;
}

.ambient-two {
  background: #d34da9;
  right: -150px;
  bottom: -120px;
  animation-delay: 3s;
}

@keyframes floatGlow {
  from { transform: translate(0, 0); }
  to { transform: translate(45px, 35px); }
}

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

@keyframes twinkle {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.2); }
}

@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(167,139,250,.12); }
  50% { box-shadow: 0 0 25px rgba(167,139,250,.3); }
}

@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* LOGIN */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 25px;
  position: relative;
  z-index: 1;
}

.login-card {
  width: min(100%, 460px);
  padding: 45px 38px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(31,27,59,.97), rgba(16,17,43,.97));
  box-shadow: 0 0 45px rgba(126,85,220,.16), var(--shadow);
  backdrop-filter: blur(18px);
  animation: appear .8s ease both;
}

.moon-mark {
  font-size: 65px;
  line-height: 1;
  color: var(--purple-light);
  text-shadow: 0 0 15px var(--purple), 0 0 35px var(--pink);
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--pink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  margin: 0 0 13px;
}

.login-card h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(34px, 7vw, 48px);
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
  color: #fff;
}

.login-card h1 span {
  display: block;
  color: var(--purple-light);
  text-shadow: 0 0 20px rgba(167,139,250,.35);
}

.intro {
  color: var(--muted);
  line-height: 1.8;
  margin: 20px 0 28px;
}

.button {
  border: 0;
  border-radius: 13px;
  padding: 14px 22px;
  font-weight: 700;
  transition: transform .25s, box-shadow .25s, filter .25s;
}

.button:hover {
  transform: translateY(-3px);
  filter: brightness(1.12);
}

.button-primary {
  color: #171127;
  background: linear-gradient(120deg, #c4a5ff, #f08acb, #8dc8ff);
  box-shadow: 0 8px 28px rgba(167,139,250,.28);
}

.button-primary:hover {
  box-shadow: 0 10px 35px rgba(167,139,250,.45);
}

.full-width { width: 100%; }

.login-form {
  margin-top: 30px;
  text-align: left;
  animation: appear .35s ease both;
}

.login-form h2 {
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 21px;
  font-weight: 500;
  margin: 0 0 22px;
  color: var(--silver);
}

.login-form label,
.record-form label {
  display: block;
  color: var(--purple-light);
  font-size: 12px;
  font-weight: 600;
  margin: 14px 0 7px;
}

.login-form input,
.record-form input,
.record-form select,
.record-form textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(10, 10, 29, .82);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}

.login-form input:focus,
.record-form input:focus,
.record-form select:focus,
.record-form textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 15px rgba(167,139,250,.16);
}

.login-form input::placeholder,
.record-form input::placeholder,
.record-form textarea::placeholder {
  color: #827a9d;
}

.login-form button { margin-top: 20px; }

.form-message {
  min-height: 20px;
  color: var(--pink);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.login-foot {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 11px;
}

/* ESTRUCTURA PRINCIPAL */

.app-shell {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 265px;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(20,17,43,.98), rgba(13,17,40,.98), rgba(30,14,43,.98));
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 35px rgba(0,0,0,.16);
  z-index: 10;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 28px;
  border-bottom: 1px solid var(--border);
}

.brand-moon {
  color: var(--purple-light);
  font-size: 35px;
  text-shadow: 0 0 18px var(--purple), 0 0 30px var(--pink);
}

.brand strong {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: #f5eaff;
}

.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 1.5px;
}

.main-nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav-link {
  width: 100%;
  text-align: left;
  color: #c1b7dc;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 13px;
  font-size: 12px;
  transition: .25s ease;
}

.nav-link:hover {
  color: #fff;
  background: linear-gradient(90deg, rgba(151,112,220,.2), rgba(70,135,205,.12));
  border-color: var(--border);
  transform: translateX(3px);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(151,112,220,.3), rgba(210,105,183,.15), rgba(70,135,205,.15));
  border-color: rgba(190,157,255,.38);
  box-shadow: inset 3px 0 var(--purple-light), 0 0 18px rgba(167,139,250,.1);
}

.sidebar-bottom {
  margin-top: auto;
  padding: 22px 10px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

.logout-button {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 13px;
  padding: 10px 0;
  color: #ff9bc4;
  border: 0;
  background: transparent;
  font-size: 12px;
}

.logout-button:hover { color: #fff; }

.workspace {
  min-height: 100vh;
  margin-left: 265px;
  padding: 28px clamp(18px,4vw,48px);
  max-width: 1800px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}

.topbar h2 {
  font-family: 'Cinzel', serif;
  font-size: clamp(20px,3vw,29px);
  font-weight: 500;
  margin: 0;
  color: #f0e7ff;
  text-shadow: 0 0 18px rgba(167,139,250,.18);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--success);
}

/* PORTADA */

.cover-banner {
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  position: relative;
  border-radius: 24px;
  border: 1px solid rgba(190,157,255,.3);
  background:
    radial-gradient(ellipse at 50% 15%, rgba(169,112,255,.3), transparent 40%),
    radial-gradient(ellipse at 85% 85%, rgba(224,91,178,.2), transparent 40%),
    linear-gradient(135deg, #17112f, #101a38 55%, #24102d);
  background-size: cover;
  background-position: center;
  box-shadow: 0 18px 50px rgba(0,0,0,.32), 0 0 28px rgba(167,139,250,.1);
}

.cover-banner::before,
.cover-banner::after {
  content: "✦";
  position: absolute;
  color: rgba(255,255,255,.9);
  font-size: 30px;
  animation: twinkle 3s ease-in-out infinite alternate;
  pointer-events: none;
}

.cover-banner::before { top: 30px; left: 12%; }

.cover-banner::after {
  right: 14%;
  bottom: 30px;
  animation-delay: 1.5s;
}

.cover-overlay {
  position: relative;
  z-index: 1;
  padding: 25px;
  text-shadow: 0 2px 12px rgba(0,0,0,.65);
}

.cover-overlay p {
  color: #f5d8ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 4px;
}

.cover-overlay h3 {
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: clamp(32px,6vw,54px);
  font-weight: 500;
  margin: 12px 0;
  text-shadow: 0 3px 20px rgba(0,0,0,.65), 0 0 25px rgba(190,157,255,.35);
}

.cover-overlay span {
  color: #eee6ff;
  font-size: 12px;
}

/* CONTENIDO */

.view-content {
  padding: 30px 0;
  min-height: 350px;
}

.loading-state,
.empty-state {
  padding: 35px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: rgba(24,22,48,.55);
}

.app-footer {
  padding: 22px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

/* TARJETAS Y PANELES */

.panel,
.stat-card,
.member-card,
.record-card,
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(31,27,59,.94), rgba(17,20,45,.96));
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}

.panel {
  padding: 22px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
}

.panel h3,
.section-heading h3 {
  margin-top: 0;
  font-family: 'Cinzel', serif;
  font-size: 19px;
  font-weight: 500;
  color: #eadcff;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.section-heading h3 { margin: 0; }

.section-heading p,
.panel p,
.member-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(165px,1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  padding: 20px;
  transition: transform .25s, border-color .25s, box-shadow .25s;
  animation: appear .5s ease both;
}

.stat-card:hover,
.member-card:hover,
.record-card:hover {
  transform: translateY(-5px);
  border-color: rgba(190,157,255,.55);
  box-shadow: 0 14px 35px rgba(0,0,0,.28), 0 0 20px rgba(167,139,250,.12);
}

.stat-card .stat-label {
  color: var(--muted);
  font-size: 11px;
}

.stat-card .stat-number {
  display: block;
  margin-top: 10px;
  color: var(--purple-light);
  font-family: 'Cinzel', serif;
  font-size: 29px;
  text-shadow: 0 0 16px rgba(167,139,250,.25);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(260px,1fr));
  gap: 18px;
}

/* BOTONES */

.action-button,
.secondary-button,
.danger-button {
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 700;
  transition: .25s;
}

.action-button {
  color: #171127;
  border: 0;
  background: linear-gradient(120deg,#c4a5ff,#f08acb,#8dc8ff);
  box-shadow: 0 5px 18px rgba(167,139,250,.15);
}

.secondary-button {
  color: #e4d5ff;
  border: 1px solid var(--border);
  background: rgba(167,139,250,.1);
}

.danger-button {
  color: #ffb1c5;
  border: 1px solid rgba(255,130,158,.3);
  background: rgba(255,100,130,.1);
}

.action-button:hover,
.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-3px);
  filter: brightness(1.15);
  box-shadow: 0 7px 20px rgba(167,139,250,.15);
}

/* INTEGRANTES */

.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(210px,1fr));
  gap: 16px;
}

.member-card {
  padding: 20px;
  text-align: center;
  transition: .25s ease;
  animation: appear .5s ease both;
}

.member-avatar {
  width: 88px;
  height: 88px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid var(--purple-light);
  background: linear-gradient(135deg,#7655b5,#bd6fae,#4f8bbd);
  color: white;
  font-family: 'Cinzel', serif;
  font-size: 26px;
  box-shadow: 0 0 20px rgba(167,139,250,.28);
  transition: transform .3s, box-shadow .3s;
}

.member-card:hover .member-avatar {
  transform: scale(1.06);
  box-shadow: 0 0 28px rgba(167,139,250,.48);
}

.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-card h4 {
  margin: 8px 0;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  color: #f0e5ff;
}

.member-card p { line-height: 1.7; }

.member-actions {
  display: flex;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* TABLAS */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 580px;
}

th, td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 11px;
}

th {
  color: #e4d3ff;
  background: linear-gradient(90deg,rgba(151,112,220,.2),rgba(70,135,205,.16));
  font-weight: 700;
}

td { color: #ded8ef; }
tr:last-child td { border-bottom: 0; }

/* ESTADOS */

.status-label {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 30px;
  color: #e2d0ff;
  background: rgba(167,139,250,.16);
  font-size: 10px;
}

.status-label.success {
  color: #8cebc1;
  background: rgba(100,220,170,.13);
}

.status-label.warning {
  color: #f6d28d;
  background: rgba(244,210,142,.14);
}

.status-label.danger {
  color: #ff9db4;
  background: rgba(255,156,174,.13);
}

/* CALENDARIO */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7,minmax(0,1fr));
  gap: 7px;
}

.calendar-day,
.calendar-date {
  min-height: 75px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(24,22,48,.9);
}

.calendar-day {
  min-height: auto;
  text-align: center;
  color: #e0caff;
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(120deg,rgba(111,76,165,.4),rgba(47,91,139,.35));
}

.calendar-date {
  color: var(--muted);
  font-size: 11px;
  transition: .2s;
}

.calendar-date:hover {
  border-color: var(--purple-light);
  background: rgba(112,83,160,.2);
}

.calendar-date.today {
  border-color: var(--purple-light);
  box-shadow: inset 0 0 15px rgba(183,138,255,.18), 0 0 12px rgba(183,138,255,.12);
}

.calendar-date.has-birthday {
  background: linear-gradient(135deg,rgba(230,169,206,.16),rgba(100,145,210,.18));
}

.calendar-event {
  display: block;
  margin-top: 6px;
  color: #f1a9dc;
  font-size: 9px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* FORMULARIOS */

.record-form {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 5px 14px;
}

.record-form .form-field-full { grid-column: 1 / -1; }

.record-form textarea {
  min-height: 90px;
  resize: vertical;
}

.record-form select { color-scheme: dark; }

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

/* MODAL */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4,4,16,.78);
  backdrop-filter: blur(9px);
}

.modal-card {
  width: min(100%,650px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 25px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(145deg,#211b3c,#11182f);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0,0,0,.45), 0 0 25px rgba(167,139,250,.12);
  animation: appear .25s ease both;
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.modal-heading h2 {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 500;
  color: #eadcff;
}

.icon-button {
  width: 35px;
  height: 35px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  background: rgba(167,139,250,.15);
  font-size: 22px;
}

.icon-button:hover {
  background: rgba(240,138,203,.2);
  transform: rotate(90deg);
}

/* MENSAJES */

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  max-width: min(380px,calc(100vw - 35px));
  padding: 13px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: linear-gradient(120deg,#292044,#182543);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: .25s;
}

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

/* RESPONSIVE: TABLET */

@media (max-width: 900px) {
  .sidebar { width: 220px; }

  .workspace {
    margin-left: 220px;
    padding: 24px 20px;
  }

  .cover-banner { min-height: 300px; }
}

/* RESPONSIVE: CELULARES */

@media (max-width: 650px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    max-height: none;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand { padding-bottom: 13px; }

  .main-nav {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 10px 0;
    margin-top: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--purple) transparent;
  }

  .nav-link {
    width: auto;
    min-width: max-content;
    padding: 11px 13px;
    white-space: nowrap;
  }

  .nav-link.active { box-shadow: inset 0 -3px var(--purple-light); }

  .sidebar-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
  }

  .logout-button {
    width: auto;
    margin: 0;
  }

  .workspace {
    margin-left: 0;
    padding: 18px 13px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topbar-right { white-space: normal; }

  .cover-banner {
    min-height: 230px;
    border-radius: 18px;
  }

  .cover-overlay { padding: 18px; }

  .cover-overlay p { letter-spacing: 2px; }

  .view-content { padding: 22px 0; }

  .record-form { grid-template-columns: 1fr; }

  .record-form .form-field-full,
  .form-actions { grid-column: 1; }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions button { flex: 1; }

  .modal-layer {
    padding: 10px;
    align-items: center;
  }

  .modal-card {
    padding: 19px;
    max-height: 88dvh;
    width: 100%;
    border-radius: 17px;
  }

  .calendar-grid { gap: 3px; }

  .calendar-day,
  .calendar-date {
    padding: 5px 3px;
    min-height: 55px;
    font-size: 9px;
    overflow-wrap: anywhere;
  }

  .calendar-event { font-size: 8px; }

  .stats-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
  }

  .stat-card { padding: 15px; }

  .stat-card .stat-number { font-size: 24px; }

  .members-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
  }

  .member-card { padding: 15px 10px; }

  .member-avatar {
    width: 70px;
    height: 70px;
  }

  .panel { padding: 16px; }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-wrap { border-radius: 13px; }
}

/* CELULARES PEQUEÑOS */

@media (max-width: 380px) {
  .login-card { padding: 35px 22px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .members-grid { grid-template-columns: 1fr; }

  .workspace { padding: 15px 10px; }

  .calendar-grid { gap: 2px; }

  .calendar-day,
  .calendar-date {
    padding: 4px 2px;
    min-height: 48px;
    font-size: 8px;
  }
}

/* ACCESIBILIDAD */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

