/* ============================================================
   Tipificador Call Center Optisalud Yopal
   Stylesheet Principal
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ---- Variables ---- */
:root {
  --azul-oscuro:   #0d2137;
  --azul-medio:    #1a3a5c;
  --azul-vivo:     #1e6fbf;
  --azul-claro:    #3b9ede;
  --azul-suave:    #e8f2fb;
  --naranja:       #e8533a;
  --naranja-hover: #c93f28;
  --blanco:        #ffffff;
  --gris-fondo:    #f0f5fa;
  --gris-borde:    #d0dcea;
  --gris-texto:    #4a6080;
  --texto-oscuro:  #0d2137;
  --verde:         #2ecc71;
  --rojo:          #e74c3c;
  --amarillo:      #f39c12;
  --sombra-sm:     0 1px 4px rgba(13,33,55,.10);
  --sombra-md:     0 4px 16px rgba(13,33,55,.13);
  --sombra-lg:     0 8px 32px rgba(13,33,55,.16);
  --radio:         8px;
  --radio-lg:      14px;
  --font-main:     'Figtree', sans-serif;
  --font-mono:     'DM Mono', monospace;
  --nav-h:         64px;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--gris-fondo);
  color: var(--texto-oscuro);
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

a { color: var(--azul-vivo); text-decoration: none; }
a:hover { color: var(--azul-claro); }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: #0d2137;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,.30);
  gap: 24px;
}

.navbar-logo img {
  height: 38px;
  display: block;
  filter: brightness(0) invert(1);
}

.navbar-title {
  color: var(--blanco);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .04em;
  opacity: .75;
  white-space: nowrap;
  border-left: 1px solid rgba(255,255,255,.2);
  padding-left: 20px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  list-style: none;
}

.navbar-nav a {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radio);
  color: rgba(255,255,255,.80);
  font-size: .875rem;
  font-weight: 500;
  transition: background .18s, color .18s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  background: rgba(255,255,255,.12);
  color: var(--blanco);
}

.navbar-nav a.active {
  background: var(--azul-vivo);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 50px;
  background: rgba(255,255,255,.08);
  color: var(--blanco);
  font-size: .85rem;
  margin-left: 8px;
}

.navbar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--azul-vivo);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  color: white;
  flex-shrink: 0;
}

.navbar-user .logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  transition: color .18s;
  line-height: 1;
}
.navbar-user .logout-btn:hover { color: var(--naranja); }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.page-wrapper {
  margin-top: var(--nav-h);
  width: 100%;
  min-height: calc(100vh - var(--nav-h));
  padding: 28px 28px 40px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--azul-oscuro);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header h1 .icon {
  width: 38px; height: 38px;
  background: var(--azul-vivo);
  border-radius: var(--radio);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 1.1rem;
}

/* ============================================================
   TARJETAS / CARDS
   ============================================================ */
.card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  box-shadow: var(--sombra-sm);
  border: 1px solid var(--gris-borde);
  overflow: hidden;
}

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--gris-borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--blanco);
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--azul-oscuro);
}

.card-body { padding: 22px; }

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radio);
  font-family: var(--font-main);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .18s, transform .12s, box-shadow .18s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--azul-vivo);
  color: var(--blanco);
  box-shadow: 0 2px 8px rgba(30,111,191,.30);
}
.btn-primary:hover { background: #1860aa; color: white; box-shadow: 0 4px 14px rgba(30,111,191,.40); }

.btn-success {
  background: var(--verde);
  color: var(--blanco);
}
.btn-success:hover { background: #27ae60; color: white; }

.btn-danger {
  background: var(--rojo);
  color: var(--blanco);
}
.btn-danger:hover { background: #c0392b; color: white; }

.btn-warning {
  background: var(--amarillo);
  color: var(--blanco);
}
.btn-warning:hover { background: #d68910; color: white; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gris-borde);
  color: var(--gris-texto);
}
.btn-outline:hover { border-color: var(--azul-vivo); color: var(--azul-vivo); background: var(--azul-suave); }

.btn-sm {
  padding: 6px 12px;
  font-size: .8rem;
}

.btn-icon {
  padding: 7px 9px;
  border-radius: var(--radio);
}

/* Editar y eliminar en tabla */
.btn-edit {
  background: #eef5ff;
  color: var(--azul-vivo);
  border: 1px solid #c5dcf7;
  padding: 6px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
  transition: background .15s;
}
.btn-edit:hover { background: var(--azul-vivo); color: white; }

.btn-delete {
  background: #fff0ee;
  color: var(--rojo);
  border: 1px solid #f5c6c2;
  padding: 6px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
  transition: background .15s;
}
.btn-delete:hover { background: var(--rojo); color: white; }

/* ============================================================
   BARRA DE BÚSQUEDA Y FILTROS
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 16px;
  border: 1.5px solid var(--gris-borde);
  border-radius: 50px;
  font-family: var(--font-main);
  font-size: .9rem;
  color: var(--texto-oscuro);
  background: var(--blanco);
  transition: border .18s, box-shadow .18s;
  outline: none;
}

.search-box input:focus {
  border-color: var(--azul-vivo);
  box-shadow: 0 0 0 3px rgba(30,111,191,.15);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gris-texto);
  font-size: 1rem;
  pointer-events: none;
}

/* ============================================================
   TABLA DE DATOS
   ============================================================ */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

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

thead tr {
  background: transparent;
  color: white;
}

thead th {
  padding: 13px 16px;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--gris-borde);
  transition: background .12s;
}

tbody tr:hover { background: var(--azul-suave); }

tbody td {
  padding: 11px 16px;
  color: var(--texto-oscuro);
  vertical-align: middle;
}

tbody tr:last-child { border-bottom: none; }

.td-acciones {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ============================================================
   PAGINACIÓN
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--gris-borde);
  background: #fafcff;
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-info {
  font-size: .82rem;
  color: var(--gris-texto);
}

.pagination-btns {
  display: flex;
  gap: 4px;
  align-items: center;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--gris-borde);
  border-radius: var(--radio);
  font-size: .82rem;
  color: var(--gris-texto);
  cursor: pointer;
  background: white;
  font-family: var(--font-main);
  transition: all .15s;
  padding: 0 8px;
  text-decoration: none;
}

.page-btn:hover { border-color: var(--azul-vivo); color: var(--azul-vivo); background: var(--azul-suave); }
.page-btn.active { background: var(--azul-vivo); border-color: var(--azul-vivo); color: white; font-weight: 700; }
.page-btn:disabled, .page-btn.disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

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

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--gris-texto);
  letter-spacing: .03em;
  text-transform: uppercase;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--gris-borde);
  border-radius: var(--radio);
  font-family: var(--font-main);
  font-size: .9rem;
  color: var(--texto-oscuro);
  background: var(--blanco);
  transition: border .18s, box-shadow .18s;
  outline: none;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--azul-vivo);
  box-shadow: 0 0 0 3px rgba(30,111,191,.12);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a6080' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--gris-borde);
}

/* ============================================================
   BADGES / ETIQUETAS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-gray  { background: #f1f5f9; color: #475569; }
.badge-orange{ background: #fff7ed; color: #c2410c; }

/* ============================================================
   STATS CARDS (Dashboard)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  padding: 20px 22px;
  border: 1px solid var(--gris-borde);
  box-shadow: var(--sombra-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow .18s;
}
.stat-card:hover { box-shadow: var(--sombra-md); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radio-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: var(--azul-vivo); }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }

.stat-info .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--azul-oscuro);
  line-height: 1;
}

.stat-info .stat-label {
  font-size: .78rem;
  color: var(--gris-texto);
  margin-top: 4px;
  font-weight: 500;
}

/* ============================================================
   TIPIFICACIONES HISTORIAL
   ============================================================ */
.tip-historial {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.tip-card {
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-radius: var(--radio-lg);
  padding: 16px 18px;
  border-left: 4px solid var(--azul-vivo);
  box-shadow: var(--sombra-sm);
}

.tip-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}

.tip-fecha {
  font-size: .78rem;
  color: var(--gris-texto);
  font-family: var(--font-mono);
}

.tip-asesor {
  font-size: .78rem;
  font-weight: 600;
  color: var(--azul-vivo);
}

.tip-row {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 5px;
  font-size: .83rem;
}

.tip-label {
  font-weight: 600;
  color: var(--gris-texto);
  min-width: 110px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.tip-value { color: var(--texto-oscuro); }

.tip-obs {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--gris-fondo);
  border-radius: var(--radio);
  font-size: .83rem;
  color: var(--gris-texto);
  border-left: 3px solid var(--gris-borde);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,33,55,.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  box-shadow: var(--sombra-lg);
  width: 90%;
  max-width: 500px;
  transform: scale(.95);
  transition: transform .2s;
}

.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gris-borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--gris-texto);
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s;
}
.modal-close:hover { color: var(--rojo); }

.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gris-borde);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   ALERTS / TOASTS
   ============================================================ */
.alert {
  padding: 12px 18px;
  border-radius: var(--radio);
  font-size: .875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.alert-success { background: #dcfce7; color: #15803d; border-left: 4px solid #22c55e; }
.alert-error   { background: #fee2e2; color: #b91c1c; border-left: 4px solid #ef4444; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border-left: 4px solid #3b82f6; }

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radio-lg);
  background: transparent;
  color: white;
  font-size: .875rem;
  box-shadow: var(--sombra-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight .3s ease;
  min-width: 280px;
  max-width: 380px;
}

.toast.success { border-left: 4px solid var(--verde); }
.toast.error   { border-left: 4px solid var(--rojo); }
.toast.info    { border-left: 4px solid var(--azul-claro); }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--azul-oscuro) 0%, var(--azul-medio) 60%, #1e4f7a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  background: var(--blanco);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.30);
  text-align: center;
}

.login-logo {
  background: transparent;
  border-radius: var(--radio-lg);
  padding: 16px 24px;
  display: inline-block;
  margin-bottom: 28px;
}

.login-logo img { height: 100px; display: block; }

.login-box h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--azul-oscuro);
  margin-bottom: 6px;
}

.login-box .subtitle {
  font-size: .83rem;
  color: var(--gris-texto);
  margin-bottom: 28px;
}

.login-box .form-group { text-align: left; }
.login-box .btn { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; margin-top: 8px; }

/* ============================================================
   SECCIÓN PACIENTE - PERFIL
   ============================================================ */
.paciente-header {
  background: #0d2137;
  border-radius: var(--radio-lg);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  color: white;
}

.paciente-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--azul-vivo);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  flex-shrink: 0;
}

.paciente-info h2 { font-size: 1.3rem; font-weight: 700; }
.paciente-info .meta { font-size: .85rem; opacity: .75; margin-top: 4px; }

/* ============================================================
   REPORTES
   ============================================================ */
.filtros-reporte {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 6px;
}

/* ============================================================
   RESPONSIVE mínimo (no centrado en móvil, solo para no romper)
   ============================================================ */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.text-muted  { color: var(--gris-texto); }
.text-sm     { font-size: .82rem; }
.text-center { text-align: center; }
.mt-4        { margin-top: 16px; }
.mt-6        { margin-top: 24px; }
.mb-4        { margin-bottom: 16px; }
.gap-10      { gap: 10px; }
.d-flex      { display: flex; }
.align-center{ align-items: center; }
.flex-wrap   { flex-wrap: wrap; }
.w-100       { width: 100%; }

.divider {
  border: none;
  border-top: 1px solid var(--gris-borde);
  margin: 20px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gris-texto);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }
