/* ==========================================================================
   PORTAL DE DOCUMENTACIÓN FUNCIONAL: SG-SST SINAPSSE v9.0
   Estilos Clínicos Modernos y Limpios (Palette SINAPSSE #0073CE)
   ========================================================================== */

:root {
  --primary: #0073CE;
  --primary-dark: #00569c;
  --primary-light: #e6f1fb;
  --primary-surface: #f4f8fc;
  
  --secondary: #176ac8;
  --accent: #22b2f0;
  --dark-bg: #0b1f3a;
  
  --text-main: #1c2d42;
  --text-muted: #5a6e85;
  --text-light: #8fa0b5;
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-light: #edf2f7;
  
  /* Semáforos Médicos y Legales */
  --badge-green: #0d8a4e;
  --badge-green-bg: #e6f7ef;
  --badge-yellow: #b47500;
  --badge-yellow-bg: #fff8e6;
  --badge-orange: #c85a00;
  --badge-orange-bg: #fff1e5;
  --badge-red: #d32f2f;
  --badge-red-bg: #fde8e8;
  --badge-gray: #64748b;
  --badge-gray-bg: #f1f5f9;

  --shadow-sm: 0 1px 3px rgba(11, 31, 58, 0.05);
  --shadow-md: 0 4px 12px rgba(11, 31, 58, 0.07);
  --shadow-lg: 0 10px 25px rgba(11, 31, 58, 0.09);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* Layout Principal */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar de Navegación */
.sidebar {
  width: 300px;
  background-color: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(0, 115, 206, 0.3);
}

.brand-text h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--dark-bg);
  letter-spacing: -0.02em;
}

.brand-text span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.05em;
  display: block;
}

.sidebar-search {
  padding: 14px 20px 10px;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background-color: var(--primary-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 115, 206, 0.15);
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.sidebar-nav {
  padding: 10px 16px 30px;
  flex: 1;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: 0.08em;
  padding: 16px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

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

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 600;
}

.nav-link .nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

/* Área de Contenido Principal */
.main-wrapper {
  margin-left: 300px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-navbar {
  height: 64px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.breadcrumbs span.current {
  color: var(--text-main);
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-header {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-main);
}

.btn-header:hover {
  background: var(--bg-page);
  border-color: var(--text-light);
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.content-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 36px 80px;
  width: 100%;
}

/* Tipografía de Contenido y Artículos */
.doc-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.doc-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.doc-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--dark-bg);
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 10px;
}

.doc-subtitle {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Secciones y Bloques Informativos */
.doc-section {
  margin-bottom: 40px;
}

.doc-section h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark-bg);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-section h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  margin: 20px 0 10px;
}

.doc-section p {
  margin-bottom: 14px;
  color: #2d3748;
}

/* Tarjetas Clínicas y Cajas Destacadas */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 20px 0;
}

.info-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.info-card h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-bg);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* Avisos y Banners Clínicos/Legales */
.notice-box {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  border-left: 4px solid;
  font-size: 14.5px;
}

.notice-box.medical {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: #0b3c68;
}

.notice-box.legal {
  background-color: var(--badge-yellow-bg);
  border-color: var(--badge-yellow);
  color: #5f3e00;
}

.notice-box.alert {
  background-color: var(--badge-red-bg);
  border-color: var(--badge-red);
  color: #721c24;
}

.notice-title {
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tablas Clínicas Comparativas */
.table-container {
  overflow-x: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

table.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

table.doc-table th {
  background-color: var(--primary-surface);
  color: var(--dark-bg);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

table.doc-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: top;
}

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

table.doc-table tr:hover td {
  background-color: #fbfcfe;
}

/* Badges y Tags Semafóricos */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green { background: var(--badge-green-bg); color: var(--badge-green); }
.badge-yellow { background: var(--badge-yellow-bg); color: var(--badge-yellow); }
.badge-orange { background: var(--badge-orange-bg); color: var(--badge-orange); }
.badge-red { background: var(--badge-red-bg); color: var(--badge-red); }
.badge-gray { background: var(--badge-gray-bg); color: var(--badge-gray); }

/* Fórmulas y Bloques de Algoritmo */
.formula-box {
  background: #f8fafd;
  border: 1px solid #d9e6f2;
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin: 18px 0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: #1a365d;
  line-height: 1.7;
}

.formula-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

/* Pasos / Steppers Funcionales */
.stepper {
  margin: 20px 0;
  position: relative;
  padding-left: 28px;
}

.stepper::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 10px;
  width: 2px;
  background-color: #cbd5e1;
}

.step-item {
  position: relative;
  margin-bottom: 24px;
}

.step-item:last-child {
  margin-bottom: 0;
}

.step-number {
  position: absolute;
  left: -28px;
  top: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.step-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--dark-bg);
  margin-bottom: 4px;
}

.step-desc {
  font-size: 14px;
  color: var(--text-muted);
}

/* Pie de Página */
.doc-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-light);
  font-size: 13px;
}

/* Responsividad */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .content-container {
    padding: 24px 18px;
  }
}

/* ==========================================================================
   ESTILOS DE LOGIN Y PANEL DE COMENTARIOS MÉDICOS
   ========================================================================== */

/* Barra de Médico en Header */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--primary-light);
  border: 1px solid #b9d8f3;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-dark);
}

.user-badge .avatar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  margin-left: 4px;
}

.btn-logout:hover {
  color: var(--badge-red);
}

/* Modal de Autenticación */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 31, 58, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: white;
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 36px;
  position: relative;
  transform: translateY(15px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--dark-bg);
  margin-bottom: 6px;
}

.modal-header p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 18px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 115, 206, 0.15);
}

.btn-submit {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-submit:hover {
  background: var(--primary-dark);
}

.auth-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.auth-alert.error {
  background-color: var(--badge-red-bg);
  color: var(--badge-red);
  display: block;
}

.auth-alert.success {
  background-color: var(--badge-green-bg);
  color: var(--badge-green);
  display: block;
}

/* Sección de Comentarios Clínicos en cada Módulo */
.comments-section {
  margin-top: 50px;
  padding-top: 36px;
  border-top: 2px dashed var(--border);
}

.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.comments-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark-bg);
  display: flex;
  align-items: center;
  gap: 10px;
}

.comments-header .badge-count {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.comments-auth-banner {
  background: #fdf8e6;
  border: 1px solid #f9e39e;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
  color: #78350f;
}

.comment-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.comment-card:hover {
  border-color: #cbd5e1;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.comment-author-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.comment-author-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark-bg);
}

.comment-author-spec {
  font-size: 12px;
  color: var(--text-muted);
}

.comment-date {
  font-size: 12px;
  color: var(--text-light);
}

.comment-body {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.6;
  white-space: pre-wrap;
}

.comment-type-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.type-clinica { background: #e0f2fe; color: #0284c7; }
.type-normativa { background: #fef3c7; color: #d97706; }
.type-sugerencia_mejora { background: #dcfce7; color: #16a34a; }
.type-correccion { background: #fee2e2; color: #dc2626; }

/* Botón de Dictado por Voz y Estados */
.btn-dictate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-dictate:hover {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
}

.btn-dictate.recording {
  background-color: #fde8e8;
  color: #d32f2f;
  border-color: #f87171;
  animation: pulse-border 1.5s infinite;
}

.btn-dictate .mic-icon {
  width: 15px;
  height: 15px;
  transition: transform 0.2s;
}

.btn-dictate.recording .mic-icon {
  transform: scale(1.15);
}

.dictation-status {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.dictation-status.active {
  color: #d32f2f;
  font-weight: 600;
}

.recording-dot {
  width: 8px;
  height: 8px;
  background-color: #d32f2f;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 1s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

