/* ============================================================
   MentalHealthChange APP — Components CSS
   Layout de app, header, nav, container y utilidades
   Complementa global.css — Fase 2
   ============================================================ */

/* ===== APP LAYOUT ===== */
.layout-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--c-bg);
}

/* ===== APP HEADER (top bar de dashboards) ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 1px 0 rgba(27,51,62,.06);
}

.header-container {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
  padding: 0 28px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Logo */
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.logo-text {
  font-family: var(--font-headings);
  font-size: 16px;
  font-weight: 700;
  color: var(--c-primary);
}

/* Nav links */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  padding-left: 16px;
  border-left: 1px solid var(--c-border);
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all .2s;
  white-space: nowrap;
}
.nav-link:hover {
  background: rgba(27,51,62,.05);
  color: var(--c-text);
  border-color: var(--c-border);
}
.nav-link.active {
  background: rgba(74,133,116,.1);
  color: var(--c-primary);
  border-color: rgba(74,133,116,.25);
  font-weight: 600;
}

/* Active variant for each role */
.app-header.company-header .nav-link.active {
  background: rgba(245,158,11,.1);
  color: var(--c-amber);
  border-color: rgba(245,158,11,.3);
}
.app-header.client-header .nav-link.active {
  background: rgba(99,102,241,.1);
  color: var(--c-client);
  border-color: rgba(99,102,241,.3);
}

/* Header right side actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(27,51,62,.04);
  border: 1px solid var(--c-border);
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-primary);
}

/* ===== APP MAIN CONTENT AREA ===== */
.app-main {
  flex: 1;
  padding: 28px 28px 40px;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.page-title {
  font-family: var(--font-headings);
  font-size: 24px;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 13px;
  color: var(--c-muted);
  margin-top: 4px;
}

/* ===== TYPOGRAPHY UTILS ===== */
.font-headings { font-family: var(--font-headings); }

/* ===== SPACING UTILITIES (complementan global.css) ===== */
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-28 { margin-bottom: 28px; }
.mb-32 { margin-bottom: 32px; }
.mb-40 { margin-bottom: 40px; }

.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }

.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.p-32 { padding: 32px; }

/* ===== GRID EXTRAS ===== */
.grid { display: grid; }
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ===== TABLE CLASS ALIAS ===== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
}
.table tbody tr {
  border-bottom: 1px solid var(--c-border);
  transition: background .15s;
}
.table tbody tr:hover { background: rgba(27,51,62,.025); }
.table tbody tr:last-child { border-bottom: none; }
.table tbody td { padding: 12px 14px; }

/* ===== STATUS DOTS ===== */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.green  { background: var(--c-success); }
.status-dot.red    { background: var(--c-danger); }
.status-dot.yellow { background: var(--c-warn); }
.status-dot.gray   { background: var(--c-muted); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; font-weight: 500; }
.empty-state small { font-size: 12px; }

/* ===== DIVIDER ===== */
.divider { border: none; border-top: 1px solid var(--c-border); margin: 20px 0; }

/* ===== MENTAL HEALTH CHANGE HUB SUITE COMPONENTS ===== */

/* 1. Segmentation Bar (Insights) */
.segmentation-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #ffffff;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
  flex-wrap: wrap;
}
.seg-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.seg-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.seg-select {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-primary);
  background: #f8fafc;
  cursor: pointer;
  outline: none;
  transition: all .2s;
}
.seg-select:focus, .seg-select:hover {
  border-color: var(--c-amber);
  background: #ffffff;
}
.seg-info-pill {
  margin-left: auto;
  font-size: 12px;
  color: var(--c-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(27,51,62,0.04);
  border-radius: 20px;
}

/* 2. GDPR Privacy Shield Box */
.gdpr-shield-card {
  background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(254,243,199,0.4));
  border: 1.5px dashed rgba(245,158,11,0.4);
  border-radius: 16px;
  padding: 36px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.gdpr-shield-icon {
  font-size: 44px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(245,158,11,0.18);
  border: 2px solid rgba(245,158,11,0.3);
}
.gdpr-shield-title {
  font-size: 16px;
  font-weight: 700;
  color: #92400e;
  font-family: var(--font-headings);
}
.gdpr-shield-desc {
  font-size: 13px;
  color: #78350f;
  max-width: 520px;
  line-height: 1.6;
}
.gdpr-shield-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(245,158,11,0.3);
}

/* 3. Resources Library */
.res-search-container {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.res-search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
}
.res-search-box .icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--c-muted);
}
.res-search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1.5px solid var(--c-border);
  border-radius: 12px;
  font-size: 14px;
  background: #ffffff;
  outline: none;
  transition: all .2s;
}
.res-search-input:focus {
  border-color: var(--c-amber);
  box-shadow: 0 0 0 4px rgba(245,158,11,0.12);
}

.res-categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 24px;
}
.res-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-muted);
  background: #ffffff;
  border: 1.5px solid var(--c-border);
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
}
.res-cat-pill:hover {
  border-color: rgba(245,158,11,0.4);
  color: var(--c-primary);
}
.res-cat-pill.active {
  background: #1B333E;
  color: #ffffff;
  border-color: #1B333E;
  box-shadow: 0 4px 12px rgba(27,51,62,0.2);
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.res-card {
  background: #ffffff;
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: all .25s ease;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.res-card:hover {
  transform: translateY(-4px);
  border-color: rgba(245,158,11,0.4);
  box-shadow: 0 12px 28px -4px rgba(0,0,0,0.08);
}
.res-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.res-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.res-badge.crisis { background: rgba(239,68,68,0.1); color: #dc2626; border: 1px solid rgba(239,68,68,0.2); }
.res-badge.health { background: rgba(16,185,129,0.1); color: #059669; border: 1px solid rgba(16,185,129,0.2); }
.res-badge.deib   { background: rgba(99,102,241,0.1); color: #4f46e5; border: 1px solid rgba(99,102,241,0.2); }
.res-badge.template { background: rgba(245,158,11,0.1); color: #d97706; border: 1px solid rgba(245,158,11,0.2); }
.res-badge.leadership { background: rgba(6,182,212,0.1); color: #0891b2; border: 1px solid rgba(6,182,212,0.2); }

.res-type-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-muted);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
}

.res-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1.35;
  margin-bottom: 8px;
  font-family: var(--font-headings);
}
.res-desc {
  font-size: 12.5px;
  color: var(--c-muted);
  line-height: 1.55;
  margin-bottom: 18px;
  flex: 1;
}
.res-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  margin-top: auto;
}
.res-meta-author {
  font-size: 11.5px;
  color: var(--c-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-res-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: var(--c-amber);
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all .2s;
}
.btn-res-action:hover {
  background: #d97706;
  box-shadow: 0 4px 12px rgba(217,119,6,0.3);
}

/* 4. Modal Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 19, 30, 0.65);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-overlay.open,
.modal-overlay.active {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
  animation: modalFadeIn .2s ease forwards;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #ffffff;
  border-radius: 18px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: modalSlideUp .25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes modalSlideUp { from { transform: translateY(24px) scale(0.96); } to { transform: translateY(0) scale(1); } }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--c-primary);
  font-family: var(--font-headings);
  margin: 0;
}
.btn-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--c-muted);
  cursor: pointer;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--c-border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .app-main { padding: 16px; }
  .header-container { padding: 0 16px; }
  .header-nav { display: none; }
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
  .resources-grid { grid-template-columns: 1fr; }
  .segmentation-bar { flex-direction: column; align-items: stretch; }
  .seg-info-pill { margin-left: 0; }
}

