/* === Variables de colores === */
:root {
  --primary: #11325b;
  --secondary: #2a90ad;
  --ligth: #71cdde;
  --tint: #8696ab;
  --background: #F2F2F2;
  --hover: #f0f4f9;
  --shadow:rgba(255, 255, 255, 0.2);

  --surface: #ffffff;          /* tarjetas, headers internos */
  --text:    #1f2937;          /* texto fuerte */
  --text-2:  #5b6b7f;          /* texto secundario */
  --line:    rgba(0,0,0,.08);  /* bordes suaves */

  --shadow-sm:0 1px 2px rgba(0,0,0,.04);
  --shadow-md:0 8px 24px rgba(0,0,0,.08);

  /* botones (tema base) */
  --btn-primary-bg:var(--primary);
  --btn-primary-border:var(--primary);
  --btn-primary-hover:#0b2544;
  --btn-outline-text:var(--primary);
  --btn-outline-border:var(--tint);
  --btn-outline-hover-bg:var(--secondary);
  --btn-outline-hover-border:var(--secondary);

  /* capas */
  --z-header:1050;
  --z-menu:1040;
  --z-backdrop:1035;
}

/* === Contenido principal === */
main {
    background-color: var(--background);
    transition: margin-left 0.1s ease-out;
    min-height: calc(100vh - 60px);
    overflow: auto;
    padding: 1rem;
}

body.no-scroll { overflow: hidden; }

/* === Estilos Botones === */
.btn-primary {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-border);
  box-shadow: none !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--btn-primary-hover) !important;
  border-color: var(--btn-primary-hover) !important;
  color: #fff !important;
  box-shadow: none !important;
}

.btn-primary:active,
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
  background-color: var(--btn-primary-hover) !important;
  border-color: var(--btn-primary-hover) !important;
  color: #fff !important;
  box-shadow: none !important;
}

/* Outline secundario global */
.btn-outline-secondary {
  color: var(--btn-outline-text);
  border-color: var(--btn-outline-border);
  background: #fff;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: #fff;
  background: var(--btn-outline-hover-bg);
  border-color: var(--btn-outline-hover-border);
}

/* Cards y headers internos */
.card, .page-header, .metric-card, .card-header.bg-white {
  background: var(--surface) !important;
  border: 1px solid var(--line);
  color: var(--text);
}

.page-header{
  background: #fff;
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.05);
}

.page-header__icon{
  width:40px;
  height:40px;
  border-radius:9999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--hover);
  color:var(--primary);
  flex: 0 0 40px;
  font-size:18px;
}

.page-header__title{ 
  font-weight:700;
  color:var(--primary); 
}

.page-header__subtitle {
  display: block;
  margin-top: 2px;
  color: var(--tint);
  line-height: 1.2;
}

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

.form-control,.custom-select{
  background:var(--surface);color:var(--text);border-color:var(--line);
}

.form-control:focus,.custom-select:focus{
  border-color:var(--secondary); box-shadow:0 0 0 .2rem rgba(42,144,173,.15);
}

.metric-card{ border-radius:12px; transition:transform .2s ease-in-out; }
.metric-card:hover{ transform:translateY(-5px); }

.chart-container{ position:relative; width:100%; height:300px; }

/* Inputs */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-textfield-decoration-container {
  display: none !important;
}

.form-control, .custom-select {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.form-control:focus, .custom-select:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 .2rem rgba(42,144,173,.15);
}

/* Bordes suaves en tablas, separadores, etc. */
.table, .border, .border-bottom, .border-top, .border-left, .border-right {
  border-color: var(--line) !important;
}

/* === Menú lateral === */
#menu{
  position: fixed;
  top: 0; left: 0; z-index: var(--z-menu);
  width: 250px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  transition: width .22s ease, transform .25s ease;
  will-change: width, transform;
}

.menu-brand{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:8px 6px;
  margin:4px 0 0;
}

.menu-brand_logo{
  max-width:72%;
  height:auto;
  display:block;
}

.menu-brand_icon{
  width:42px; height:42px;
  border-radius:12px;
  background:var(--hover);
  padding:6px;
  display:block;
}

.menu-divider{
  height:1px; background: var(--line);
  margin: 10px 0 14px;
}

/* items */
.menu-list{
  display: flex;
  flex-direction: column;
  gap: 8px;          /* espacio uniforme entre botones */
  padding-top: 4px;
}

/* sin márgenes extra por <li> */
#menu .nav-item{ margin: 0; }

/* botón del item, altura consistente y centrado */
#menu .nav-link{
  font-size: 16px;
  color: var(--primary);
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 10px;
  transition: background .2s ease, color .2s;
}

#menu .nav-link i{
  font-size: 19px;
  width: 22px; min-width: 22px;
  text-align: center;
  margin-right: 10px;
}
#menu .nav-link:hover{
  background: var(--hover);
  color: var(--primary);
  box-shadow: 2px 2px 2px var(--primary);
}
#menu .nav-link.active{
  background: var(--primary);
  color: #fff;
}

/* rail desktop: solo iconos */
#menu.menu-rail{ width: 72px; }
#menu.menu-rail .menu-text{ display: none; }
#menu.menu-rail .nav-link{ justify-content: center; padding: 10px; }
#menu.menu-rail .nav-link i{ margin-right: 0; }

/* margen del main según estado del menú (en desktop) */
.with-menu{ margin-left: 250px; }
.with-rail{ margin-left: 72px; }

/* botón logout */
.menu-logout { margin-top: auto; } 
.menu-logout .btn { border-radius: .5rem; }
.menu-rail .menu-logout .btn {
  width: 44px; height: 44px; padding: 0; border-radius: .6rem;
}
.menu-rail .menu-logout .btn i { font-size: 18px; }

/* Drawer móvil + backdrop */
.menu-backdrop{
  position: fixed;
  inset: 60px 0 0 0;           /* por debajo del header */
  background: rgba(0,0,0,.35);
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
  z-index: var(--z-backdrop);
}

.menu-backdrop.show{ opacity: 1; visibility: visible; }

/* Mobile: el menú entra/sale como cajón */
@media (max-width: 991.98px){
  #menu{ 
    top: 60px; 
    height: calc(100vh - 60px);
    transform: translateX(-100%);
    width: 260px;
    box-shadow: var(--shadow-md);
  }
  #menu.is-open{ transform: translateX(0); }

  .menu-backdrop.show{ opacity: 1; visibility: visible; }

  /* el main ocupa todo en móvil */
  .with-menu, .with-rail{ margin-left: 0; }
}

/* Botones icon-only reutilizables */
.btn-icon{
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
}

.btn:focus, .btn:active, .btn:active:focus{
  outline: none !important;
  box-shadow: none !important;
}

/* === Header superior === */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    height: 60px;
    background: var(--primary);
    padding: 0 15px;
    color: white;
}

/* Iconos en el header */
header a {
    color: white;
    text-decoration: none;
    font-size: 18px;
}

/* Botón del menú */
.toggle-menu {
    font-size: 22px;
    background-color: transparent;
    border: none;
    color: white;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.1s ease;
}

.toggle-menu:hover {
    background-color: var(--shadow);
}

/* === Loading === */
.loading-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Badges personalizados === */
.badge-lg {
  font-size: 1rem;
  padding: 0.5em 0.75em;
}

/* === Header === */
.metric-card {
  transition: transform 0.2s ease-in-out;
  border-radius: 12px;
}

.metric-card:hover {
  transform: translateY(-5px);
}

.avatar-iniciales {
  font-weight: bold;
  background: var(--primary);
}

@media (max-width: 576px) {
  .page-header { padding: 14px; }
  .page-header__icon { width: 36px; height: 36px; font-size: 16px; }
}

/* Tabs “pill” */
.tabs-scroll {
  overflow-x: auto; 
  overflow-y: hidden; 
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;  /* suaviza el scroll en iOS */
  padding-bottom: 4px;
}

.tabs-scroll .nav {
  flex-wrap: nowrap;
}

.tabs-scroll .nav-item {
  display: inline-block;
  margin-right: .5rem;
}

.tabs-scroll::-webkit-scrollbar {
  display: none; /* ocultar scroll bar en mobile */
}

.tabs-pill .nav-link{
  border-radius: 9999px; padding:.45rem .9rem; margin-right:.5rem;
  background:#f7fcf8; color:var(--text-2); border:1px solid var(--line);
  transition:.15s;
  cursor: pointer;
}
.tabs-pill .nav-link:hover{ background:var(--hover); }
.tabs-pill .nav-link.active{
  background:var(--primary); color:#fff; border-color:var(--primary);
  box-shadow:0 2px 8px rgba(17,50,91,.18);
}

/* Toolbar sin título */
.list-toolbar .input-group-text{ background:#fff; border-color:var(--line); }
.list-toolbar .form-control{ border-color:var(--line); }
.list-toolbar .form-control:focus{
  border-color:var(--secondary); box-shadow:0 0 0 .2rem rgba(42,144,173,.12);
}

.cursor-pointer { cursor: pointer; }

/* En móviles: separar un poco la toolbar de la tabla */
@media (max-width: 575.98px){
  .input-group-text { border-color: var(--line); }
  .form-control      { border-color: var(--line); }
}

@media (min-width: 768px){
  .w-md-auto { width: auto !important; }
}

.badge-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  padding: .6rem .75rem;
  font-size: .875rem;
  border-radius: .35rem;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .badge-summary {
    font-size: .85rem;
    padding: .55rem .6rem;
  }
}

.modal .modal-header {
  border-bottom: none;
}

.modal .modal-footer {
  border-top: none;
}

.modal-body {
  max-height: 70vh;
  overflow-y: auto;
}

.survey-container {
    display: flex;
    min-height: 450px;
    gap: 20px;
}

.survey-left {
    width: 30%;
    max-height: 500px;
    overflow-y: auto;
}

.survey-right {
    width: 70%;
    max-height: 500px;
    overflow-y: auto;
}

.survey-list .list-group-item.active {
    background: #007bff;
    color: #fff;
}

.survey-questions {
    overflow-y: auto;
    max-height: 50vh;
    margin-bottom: 15px;
}

.survey-note textarea {
    resize: vertical;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.question-text {
    max-width: 320px;
}

.cursor-pointer {
  cursor: pointer;
}

.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fab {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.profile-avatar-wrapper {
  width: 120px;
  height: 120px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d6efd, #6ea8fe);
  color: #fff;
  font-size: 36px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
  text-transform: uppercase;
  user-select: none;
}