/* =========================================================
   SOMEFIAF — Design System
   Primary: #1A3A6B (Navy)  Accent: #C9A227 (Gold)
   Fonts: Manrope (headlines) | Inter (body)
   ========================================================= */

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

:root {
  --color-primary: #1A3A6B;
  --color-primary-dk: #0F2347;
  --color-secondary: #2D5B9A;
  --color-accent: #C9A227;
  --color-accent-dk: #A07D15;
  --color-accent-lt: #F5ECC8;
  --color-bg: #F5F7FA;
  --color-surface: #FFFFFF;
  --color-text: #0F1E35;
  --color-text-muted: #4A5568;
  --color-border: #C8D6E8;
  --color-danger: #D62839;
  --color-success: #2D7D46;

  --color-socio: #1A3A6B;
  --color-curso: #2D5B9A;
  --color-diplomado: #C9A227;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 35, 71, .07), 0 1px 2px rgba(15, 35, 71, .05);
  --shadow-md: 0 4px 16px rgba(15, 35, 71, .10), 0 2px 6px rgba(15, 35, 71, .06);
  --shadow-lg: 0 12px 36px rgba(15, 35, 71, .14);
  --shadow-plaque: 0 2px 4px rgba(15, 35, 71, .06), 0 12px 28px rgba(15, 35, 71, .10);

  --font-headline: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;

  --transition: .18s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-size: 15px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-main {
  flex: 1;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary);
}

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  background: var(--color-surface);
  border-bottom: 3px solid var(--color-accent);
  box-shadow: 0 1px 0 var(--color-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Hamburger hidden on desktop */
.hamburger {
  display: none;
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  height: 70px;
}

.header-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
}

.header-logo {
  height: 80px;
  width: auto;
}

/* Center column — public nav */
.header-nav-public {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.nav-link-public {
  font-family: var(--font-body);
  font-size: .9375rem;
  font-weight: 400;
  color: #333;
  padding: 8px 18px;
  white-space: nowrap;
  transition: color var(--transition);
  position: relative;
}

.nav-link-public:hover {
  color: var(--color-primary);
  background: transparent;
}

.nav-link-public--cta {
  border: 1.5px solid var(--color-accent);
  border-radius: var(--radius-full);
  padding: 7px 20px;
  color: var(--color-accent-dk);
  font-weight: 600;
}

.nav-link-public--cta:hover {
  background: var(--color-accent);
  color: var(--color-primary-dk);
}

/* Right column — empty or admin links when logged in */
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Admin nav (inside header-right when logged in) */
.header-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.nav-link:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}

.nav-link--cta {
  background: var(--color-primary);
  color: #fff !important;
}

.nav-link--cta:hover {
  background: var(--color-primary-dk);
  color: #fff !important;
}

.nav-link--danger {
  color: var(--color-danger) !important;
}

.nav-link--danger:hover {
  background: #fdecea;
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  background: linear-gradient(135deg, #1A3A6B 0%, #0F2347 55%, #1A3A6B 100%);
  border-top: 4px solid var(--color-accent);
  padding: 72px 0 64px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

/* Subtle diagonal texture */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(-45deg,
      rgba(255, 255, 255, .025) 0,
      rgba(255, 255, 255, .025) 1px,
      transparent 1px,
      transparent 28px);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-accent);
  color: var(--color-primary-dk);
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 700;
  padding: 5px 16px;
  border-radius: var(--radius-full);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero-title {
  font-family: var(--font-headline);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 1.0625rem;
  opacity: .82;
  max-width: 580px;
  margin: 0 auto 44px;
  line-height: 1.75;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, .11);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius-lg);
  padding: 18px 28px 16px;
  min-width: 120px;
  backdrop-filter: blur(4px);
}

.stat-number {
  font-family: var(--font-headline);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.stat-label {
  font-size: .7rem;
  opacity: .7;
  margin-top: 6px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #fff;
}

/* =========================================================
   SEARCH BAR
   ========================================================= */
.search-bar-section {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 20px 0;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: .9375rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(45, 91, 154, .15);
}

.search-btn {
  padding: 10px 22px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.search-btn:hover {
  background: var(--color-primary-dk);
}

.search-clear {
  font-size: .875rem;
  color: var(--color-text-muted);
  padding: 10px 14px;
}

.search-results-note {
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* =========================================================
   MEMBER SECTIONS
   ========================================================= */
.members-section {
  padding: 48px 0 40px;
}

.members-section+.members-section {
  border-top: 1px solid var(--color-border);
}

.section-title {
  font-family: var(--font-headline);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* =========================================================
   BADGES
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.section-badge {
  font-size: .9375rem;
  padding: 6px 18px;
  letter-spacing: .02em;
  text-transform: none;
  font-family: var(--font-headline);
  font-weight: 700;
}

.badge--socio {
  background: var(--color-socio);
  color: #fff;
}

.badge--curso {
  background: var(--color-curso);
  color: #fff;
}

.badge--diplomado {
  background: var(--color-diplomado);
  color: var(--color-primary-dk);
}

/* =========================================================
   CARDS GRID
   ========================================================= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.member-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  padding: 24px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  transition: box-shadow var(--transition), transform var(--transition);
}

.member-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-headline);
  font-weight: 800;
  font-size: 1.125rem;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.02em;
}

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

.card-name {
  font-family: var(--font-headline);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-specialty {
  font-size: .8125rem;
  color: var(--color-secondary);
  font-weight: 600;
  margin-bottom: 6px;
}

.card-program {
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.card-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.date-item {
  font-size: .75rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.date-label {
  font-weight: 600;
  color: var(--color-primary);
}

.empty-message {
  color: var(--color-text-muted);
  font-style: italic;
  padding: 24px 0;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn--primary:hover {
  background: var(--color-primary-dk);
  border-color: var(--color-primary-dk);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn--ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.btn--danger {
  background: transparent;
  color: var(--color-danger);
  border-color: #f5c6c9;
}

.btn--danger:hover {
  background: #fdecea;
  border-color: var(--color-danger);
}

.btn--full {
  width: 100%;
}

.btn--sm {
  padding: 7px 16px;
  font-size: .875rem;
}

.btn--xs {
  padding: 4px 10px;
  font-size: .8125rem;
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  background: var(--color-primary);
  color: rgba(255, 255, 255, .65);
  padding: 28px 0;
  text-align: center;
  font-size: .875rem;
  margin-top: 40px;
  border-top: 3px solid var(--color-accent);
}

/* =========================================================
   ADMIN — LOGIN PAGE
   ========================================================= */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dk) 60%, #1e4a8a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px 40px;
  text-align: center;
}

.login-logo {
  position: relative;
  margin-bottom: 24px;
}

.login-logo img {
  height: 72px;
  width: auto;
}

.login-logo-fallback {
  display: inline-flex;
  width: 72px;
  height: 72px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  align-items: center;
  justify-content: center;
  font-family: var(--font-headline);
  font-size: 1.75rem;
  font-weight: 800;
}

.login-logo img+.login-logo-fallback {
  display: none;
}

.login-logo img[style*="display:none"]+.login-logo-fallback,
.login-logo img[style*="display: none"]+.login-logo-fallback {
  display: inline-flex;
}

.login-title {
  font-family: var(--font-headline);
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 6px;
  letter-spacing: -.02em;
}

.login-subtitle {
  font-size: .875rem;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}

.login-form {
  text-align: left;
}

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

/* =========================================================
   FORMS (shared)
   ========================================================= */
.form-group {
  margin-bottom: 18px;
}

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

.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.required {
  color: var(--color-danger);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: .9375rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: auto;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(45, 91, 154, .15);
  background: #fff;
}

.input-with-toggle {
  position: relative;
}

.input-with-toggle .form-input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  opacity: .6;
  transition: opacity var(--transition);
}

.toggle-password:hover {
  opacity: 1;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.form-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  padding: 40px;
  max-width: 680px;
  margin: 40px auto;
}

/* =========================================================
   ALERTS
   ========================================================= */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: .9rem;
  margin-bottom: 20px;
  border: 1.5px solid transparent;
}

.alert--success {
  background: #e8f5e9;
  color: #1b5e20;
  border-color: #a5d6a7;
}

.alert--error {
  background: #fdecea;
  color: #7f1d1d;
  border-color: #f5c6c9;
}

.error-list {
  margin-left: 18px;
}

.error-list li {
  margin-bottom: 4px;
}

/* =========================================================
   ADMIN LAYOUT
   ========================================================= */
.admin-page {
  min-height: 100vh;
  background: #EFF2F7;
}

.admin-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 24px;
}

.admin-logo-text {
  font-family: var(--font-headline);
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -.02em;
}

.admin-label {
  font-size: .75rem;
  color: var(--color-accent-dk);
  font-weight: 600;
  margin-left: 6px;
  padding: 2px 8px;
  background: var(--color-accent-lt);
  border-radius: var(--radius-full);
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-main {
  padding: 40px 0 80px;
}

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-title {
  font-family: var(--font-headline);
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -.02em;
}

.counts-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.count-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: .8125rem;
  font-weight: 700;
  color: #fff;
}

/* =========================================================
   FILTER TABS
   ========================================================= */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--color-border);
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 18px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.filter-tab:hover {
  color: var(--color-primary);
  background: var(--color-bg);
}

.filter-tab--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* =========================================================
   DATA TABLE
   ========================================================= */
.table-wrapper {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.data-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: #EDF1F8;
}

.td-name {
  font-weight: 600;
  color: var(--color-text);
}

.col-actions {
  text-align: right;
  white-space: nowrap;
}

.col-actions td,
th.col-actions {
  text-align: right;
}

.inline-form {
  display: inline;
}

/* =========================================================
   ADMIN FOOTER
   ========================================================= */
.admin-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 18px 0;
  text-align: center;
  font-size: .8125rem;
  color: var(--color-text-muted);
}

/* =========================================================
   LANDING — GROUP CARDS
   ========================================================= */
.groups-section {
  padding: 56px 0 72px;
}

.groups-heading {
  font-family: var(--font-headline);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -.02em;
  margin-bottom: 40px;
  text-align: center;
}

.group-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.group-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  padding: 36px 28px 28px;
  text-decoration: none;
  color: var(--color-text);
  transition: all .22s ease;
  box-shadow: var(--shadow-plaque);
}

.group-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-top-color: var(--color-accent-dk);
}

.group-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-primary);
}

.group-card-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.75;
}

.group-card-body {
  flex: 1;
}

.group-card-count {
  display: block;
  font-family: var(--font-headline);
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--color-primary);
}

.group-card-title {
  font-family: var(--font-headline);
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -.02em;
  color: var(--color-text);
}

.group-card-desc {
  font-size: .875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.group-card-cta {
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .02em;
  margin-top: auto;
  color: var(--color-accent-dk);
  transition: color var(--transition);
}

.group-card:hover .group-card-cta {
  color: var(--color-primary);
}

/* =========================================================
   LIST PAGE — BREADCRUMB & HEADER
   ========================================================= */
.list-page-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 20px 0 24px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8125rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.breadcrumb a {
  color: var(--color-secondary);
  font-weight: 500;
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

.breadcrumb-sep {
  color: var(--color-accent-dk);
  opacity: .8;
}

.list-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.list-page-title {
  line-height: 1;
}

.list-section {
  padding: 32px 0 60px;
}

/* =========================================================
   TABLE CARD (DataTables wrapper)
   ========================================================= */
.table-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-plaque);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  padding: 24px;
  overflow-x: auto;
}

/* --- DataTables overrides --- */
table.dataTable {
  font-size: .9rem;
  border-collapse: collapse !important;
}

table.dataTable thead th {
  background: var(--color-primary);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 14px 16px !important;
  border-bottom: none !important;
}

table.dataTable tbody td {
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--color-border) !important;
  vertical-align: middle;
  color: var(--color-text);
}

table.dataTable tbody tr:nth-child(even) td {
  background: #F7F9FC;
}

table.dataTable tbody tr:hover td {
  background: #EDF1F8;
}

table.dataTable tbody tr:last-child td {
  border-bottom: none !important;
}

/* Sorting arrows */
table.dataTable thead th.dt-ordering-asc::after {
  content: ' ↑';
  color: var(--color-accent);
}

table.dataTable thead th.dt-ordering-desc::after {
  content: ' ↓';
  color: var(--color-accent);
}

/* Search & length toolbar */
.dt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.dt-length label,
.dt-search label {
  font-size: .875rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.dt-length select,
.dt-search input {
  padding: 7px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: .875rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.dt-search input:focus,
.dt-length select:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(45, 91, 154, .15);
  background: #fff;
}

/* Pagination */
.dt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.dt-info {
  font-size: .8125rem;
  color: var(--color-text-muted);
}

.dt-paging .dt-paging-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  margin: 0 2px;
  transition: all var(--transition);
}

.dt-paging .dt-paging-button:hover:not(.disabled) {
  background: var(--color-bg);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.dt-paging .dt-paging-button.current {
  background: var(--color-accent);
  color: var(--color-primary-dk);
  border-color: var(--color-accent);
  font-weight: 700;
}

.dt-paging .dt-paging-button.disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* Processing overlay */
.dt-processing {
  background: rgba(255, 255, 255, .9) !important;
  color: var(--color-primary) !important;
  font-weight: 600 !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--color-border) !important;
}

/* Search highlight */
mark {
  background: #FFF3CD;
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

.text-muted {
  color: var(--color-text-muted);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .group-cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 48px 0 44px;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
  }

  .stat-item {
    padding: 16px 12px 14px;
    min-width: 0;
  }

  .stat-number {
    font-size: 1.875rem;
  }

  .group-cards {
    grid-template-columns: 1fr;
    max-width: 440px;
    margin: 0 auto;
  }

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

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

  /* Header burger layout */
  .header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 62px;
  }

  .header-nav-public {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 4px solid var(--color-primary);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 0 12px;
    box-shadow: 0 8px 24px rgba(15, 35, 71, .12);
    z-index: 99;
  }

  .header-nav-public.nav--open {
    display: flex;
  }

  .nav-link-public {
    font-size: 1rem;
    padding: 12px 24px;
    border-bottom: 1px solid var(--color-border);
  }

  .nav-link-public:last-child {
    border-bottom: none;
  }

  .nav-link-public:hover {
    background: var(--color-bg);
  }

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

  /* Hamburger button */
  .hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
  }

  .hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-primary);
    border-radius: 2px;
    transition: transform .22s ease, opacity .22s ease;
    transform-origin: center;
  }

  .hamburger--open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }

  .hamburger--open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .hamburger--open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  .admin-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-card {
    padding: 28px 20px;
    margin: 20px auto;
  }

  .login-card {
    padding: 36px 24px 28px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }

  .dt-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .dt-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-card {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .hero-stats {
    gap: 10px;
    max-width: 320px;
  }

  .stat-item {
    padding: 14px 10px 12px;
    min-width: 0;
  }

  .stat-number {
    font-size: 1.625rem;
  }

  .filter-tabs {
    gap: 2px;
  }

  .filter-tab {
    padding: 6px 12px;
    font-size: .8125rem;
  }

  .group-cards {
    max-width: 100%;
  }

  .groups-section {
    padding: 40px 0 56px;
  }
}

/* =========================================================
   SKELETON LOADER
   ========================================================= */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.table-skeleton {
  padding: 8px 0;
}

.skeleton-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 16px;
  gap: 12px;
}

.skeleton-header,
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
}

.skeleton-header {
  background: var(--color-bg);
  padding: 12px 0;
}

.skeleton-row {
  padding: 14px 0;
}

.skeleton-row--alt {
  background: #fafbfc;
}

.skeleton-cell,
.skeleton-block {
  border-radius: var(--radius-sm);
  height: 14px;
  background: linear-gradient(90deg,
    #e8ecf0 0%,
    #f4f6f8 40%,
    #e8ecf0 80%
  );
  background-size: 600px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-cell {
  margin: 0 16px;
  flex: none;
}

.skeleton-cell--hd {
  height: 11px;
  opacity: .7;
}

/* =========================================================
   DATATABLES AJAX SPINNER (búsqueda / paginación)
   ========================================================= */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.dt-spinner {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 10;
  pointer-events: none;
}

.dt-spinner-ring {
  display: block;
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* table-card needs position:relative for the spinner */
.table-card {
  position: relative;
}
/* =========================================================
   REFINAMIENTO VISUAL + MÓVIL  (rediseño 2026)
   Mismos tokens/colores. Anexado al final → fácil de revertir.
   ========================================================= */

/* --- Fase 1: refinamiento visual --- */

/* Hero: más aire y mejor contraste de la descripción */
.hero-desc {
  opacity: 1;
  color: rgba(255, 255, 255, .9);
}

/* Tarjetas: sombra/hover y radio consistentes */
.member-card,
.group-card,
.table-card,
.table-wrapper,
.form-card,
.login-card {
  border-radius: var(--radius-lg);
}

.member-card:hover {
  border-color: var(--color-secondary);
}

/* Mejor contraste de texto secundario en tarjetas */
.card-program {
  color: var(--color-text-muted);
}

/* Títulos de sección: jerarquía un poco más marcada */
.section-title {
  font-size: 1.5rem;
}

/* Foco visible accesible en toda la interfaz interactiva */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-link-public:focus-visible,
.filter-tab:focus-visible,
.search-input:focus-visible,
.form-input:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- Fase 2: móvil legible --- */

/* Touch targets ≥44px en navegación/acciones */
@media (max-width: 768px) {
  .nav-link-public {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .btn--xs {
    padding: 9px 14px;
    font-size: .875rem;
  }

  .filter-tab {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .search-form {
    gap: 8px;
  }

  .search-btn {
    flex: 1;
    min-width: 120px;
  }
}

/* Tablas → tarjetas apiladas (legibles, sin scroll horizontal).
   Cubre la tabla del dashboard admin (.data-table con data-label). */
@media (max-width: 640px) {
  .table-wrapper {
    overflow-x: visible;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .data-table thead {
    position: absolute;
    left: -9999px;   /* ponytail: oculta el head; el label viene de data-label */
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
    padding: 6px 4px;
  }

  .data-table tr:last-child td {
    border-bottom: none;   /* anula la regla desktop dentro de la card */
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    text-align: right;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
  }

  .data-table td:last-child {
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--color-primary);
    text-align: left;
    flex-shrink: 0;
  }

  .data-table .td-name {
    font-size: 1rem;
  }

  /* Fila de acciones: ocupa el ancho, botones alcanzables */
  .data-table td.col-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .data-table td.col-actions .inline-form {
    display: inline-flex;
  }
}

/* Hero/stats en teléfono: que el número no se corte */
@media (max-width: 380px) {
  .stat-number {
    font-size: 1.5rem;
  }

  .group-card-count {
    font-size: 2.25rem;
  }

  .hero-title {
    font-size: 1.6rem;
  }
}

/* Mismas reglas "tarjeta apilada" para las tablas públicas (DataTables usa table.dataTable, no .data-table) */
@media (max-width: 640px) {
  .table-card {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  table.dataTable thead {
    position: absolute;
    left: -9999px;
  }

  table.dataTable,
  table.dataTable tbody,
  table.dataTable tr,
  table.dataTable td {
    display: block;
    width: 100%;
  }

  table.dataTable tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
    padding: 6px 4px;
  }

  table.dataTable tbody td {
    display: flex !important;        /* override del padding inline de DataTables */
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    text-align: right;
    padding: 10px 14px !important;
    border-bottom: 1px solid var(--color-border) !important;
  }

  table.dataTable tbody tr td:last-child {
    border-bottom: none !important;
  }

  table.dataTable tbody td::before {
    content: attr(data-label);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--color-primary);
    text-align: left;
    flex-shrink: 0;
  }

  /* Toolbar/paginación DataTables: que no desborde */
  .dt-toolbar,
  .dt-footer {
    padding: 0 4px;
  }

  .dt-search input,
  .dt-length select {
    max-width: 100%;
  }
}
