:root {
    --color-negro: #000000;
    --color-blanco: #f4f6f9;
    --color-amarillo: #f8aa00;
    --color-gris: #f5f5f5;
    --color-borde-gris: #dce3ea;
    --color-placeholder: #9ca3af;
}

/* ===========================
   Reset CSS Moderno (2026)
   =========================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    line-height: 1.5;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--color-negro);
    background: #fff;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
picture,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
}

textarea {
    resize: vertical;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

::placeholder {
    color: var(--color-placeholder);
    opacity: 1;
}

:focus-visible {
    outline: 2px solid var(--color-amarillo);
    outline-offset: 2px;
}

/* ===========================
   TITULO DE LAS PAGINAS
   =========================== */
.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--color-negro);
}

/* ===========================
   CAMPOS DE FORMULARIO
   =========================== */

/* Input de texto, email, password, number, date, etc.
   + textarea + select */

input:not([type="checkbox"]):not([type="radio"]),
textarea {
    width: 100%;
    min-height: 5vh;
    padding: 0 15px;

    border: 2px solid #e5e7eb;
    border-radius: 12px;

    background-color: #fff;
    color: var(--color-negro);

    font-size: .95rem;
    font-family: inherit;

    transition:
        border-color .25s,
        box-shadow .25s,
        background-color .25s,
        color .25s;
}

select {
    width: 100%;
    min-height: 5vh;
    padding: 0 40px 0 15px;

    border: 2px solid #e5e7eb;
    border-radius: 12px;

    background-color: #fff;
    color: var(--color-negro);

    font-size: .95rem;
    font-family: inherit;

    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23212529' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;

    transition:
        border-color .25s,
        box-shadow .25s,
        background-color .25s,
        color .25s;
}


/* ===========================
   TEXTAREA
   =========================== */

textarea {
    padding: 12px 15px;
    min-height: 120px;
}


/* ===========================
   HOVER
   =========================== */

input:not([type="checkbox"]):not([type="radio"]):hover,
textarea:hover,
select:hover {
    border-color: #cfd8e3;
}


/* ===========================
   FOCUS
   =========================== */

input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
    border-color: var(--color-amarillo);

    box-shadow:
        0 0 0 4px rgba(255, 193, 71, .20);

    outline: none;
}


/* ===========================
   READONLY
   =========================== */

input:not([type="checkbox"]):not([type="radio"]):read-only,
textarea:read-only {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
    border-color: #d1d5db !important;
    cursor: default;
}


/* ===========================
   DISABLED
   =========================== */

input:not([type="checkbox"]):not([type="radio"]):disabled,
textarea:disabled,
select:disabled {
    background-color: #e5e7eb !important;
    color: #9ca3af !important;
    border-color: #d1d5db !important;

    cursor: not-allowed;
    opacity: 1;
}


/* ===========================
   HOVER READONLY / DISABLED
   =========================== */

input:not([type="checkbox"]):not([type="radio"]):is(:read-only, :disabled):hover,
textarea:is(:read-only, :disabled):hover,
select:disabled:hover {
    background-color: #e5e7eb !important;
    border-color: #d1d5db !important;
}

/* Oculta el icono de "sugerencias guardadas" de Chrome (la llave) */
input::-webkit-credentials-auto-fill-button,
input::-webkit-caps-lock-indicator {
    visibility: hidden;
    display: none !important;
    pointer-events: none;
    position: absolute;
    right: 0;
}

/* Oculta el botón nativo de "revelar contraseña" si aparece */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

/* ================================
   MOSTRAR/OCULTAR CONTRASEÑA
   (Reutilizable en login, médicos, etc.)
================================ */
.password-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.password-input {
    position: relative;
    flex: 1;
}

.password-input input {
    width: 100%;
    padding-right: 48px;
}

.btn-view-password {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0;
    width: 48px;
    height: 100%;
    max-height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    background: none;
    cursor: pointer;
}

.btn-view-password img {
    width: 18px;
    height: 18px;
    opacity: 0.6;
    transition: 0.2s;
}

.btn-view-password:hover img {
    opacity: 1;
}

/* ===========================
   CHECKBOX Y RADIO
   =========================== */

/* Se excluyen del estilo general porque
   tienen un comportamiento visual diferente */

input[type="checkbox"],
input[type="radio"] {
    width: auto;
}

/* ===========================
   TOOLBAR (BUSCADOR + BOTONES)
   =========================== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 25px 0 10px 0;
}

/* ===========================
   TOOLBAR (BUSCADOR + BOTONES) (Excepción en aplicar en "Pacientes - Encuestas")
   =========================== */
.toolbar-column {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  margin: 25px 0 10px 0;
}

/* ===========================
   BUSCADORES
   =========================== */
.search-box {
    position: relative;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
}

.search-box img {
    position: absolute;
    top: 50%;
    left: 16px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    opacity: .55;
    pointer-events: none;
}

.search-box input:not([type="checkbox"]):not([type="radio"]) {
    padding-left: 44px;
}

/* ===========================
   BOTONES DE FILTROS (Excepción en aplicar en "Pacientes - Encuestas")
   =========================== */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter {
    padding: 10px 16px;
    border: 1px solid var(--color-borde-gris);
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: .25s;
}

.filter:hover {
    background: #f8f8f8;
}

.filter.active {
    background: var(--color-amarillo);
    border-color: var(--color-amarillo);
    font-weight: 600;
}

/* ===========================
   SELECT FILTRADO POR MEDICO (Excepción en aplicar en para los administradores)
   =========================== */
.filtro-medico  {
    display: none;
}

.filtro-medico label {
    font-weight: 500;
}

.titulo-cantidad  {
    display: inline-block;
    padding: 4px 14px;
    border: 1px solid var(--color-amarillo);
    border-radius: 6px;
    background-color: #fff8e6;
    font-weight: 500;
}

.cantidad-pacientes {
    display: inline-block;
    padding: 4px 14px;
    border: 1px solid var(--color-amarillo);
    border-radius: 6px;
    background-color: var(--color-amarillo);
    font-weight: 500;
}

.medico-letra {
    width: auto;
    display: none;
}

/* ==============================
   TABLA DE DATOS
============================== */
.table-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,.05);
    border: 1px solid #edf2f7;
    overflow: hidden;
    margin-top: 10px;
}


.tabla {
    width: 100%;
    border-collapse: collapse;
}

.tabla thead {
    background: #f8fafc;
}

.tabla th {
    text-align: left;
    padding: 16px;
    font-size: .95rem;
}

.tabla td {
    padding: 12px;
    border-top: 1px solid #edf2f7;
}

.tabla tbody tr:hover {
    background: #fafafa;
}

.acciones {
    display: flex;
    gap: 10px;
}

.acciones a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f4f6f9;
    transition: .25s;
}

.acciones a:hover {
    background: var(--color-amarillo);
}

.acciones img {
    width: 18px;
}


/* ==============================
   TABLA DE DATOS
============================== */
.paginacion {
    display:flex;
    justify-content:center;
    align-items:center;
    gap:.5rem;
    margin-top:0.75rem;
}

.btn-pagina{
    min-width:40px;
    height:40px;
    border:none;
    border-radius:8px;
    cursor:pointer;
    background:#f3f4f6;
    transition:.2s;
}

.btn-pagina:hover:not(:disabled){
    background:var(--color-amarillo);
}

.btn-pagina.activa{
    background:var(--color-amarillo);
    color:white;
    font-weight:bold;
}

.btn-pagina:disabled{
    opacity:.4;
    cursor:not-allowed;
}

/* ==============================
   ORDENAMIENTO FECHA PREVITA TABLA
============================== */

th.sortable{
    cursor:pointer;
    user-select:none;
}

.th-content{
    display:flex;
    align-items:center;
}

th.sortable:hover {
    background-color: #f3f4f6;
}

th.sortable img {
    width: 16px;
    height: 16px;
    margin-left: 10px;
    vertical-align: middle;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

th.sortable:hover img {
    opacity: 1;
}


/* Estado orden ascendente */
th.sortable.asc img {
    transform: rotate(180deg);
}


/* Estado orden descendente */
th.sortable.desc img {
    transform: rotate(0deg);
}


/* Animación al cambiar orden */
th.sortable img.cambiando {
    transform: scale(1.2);
}

/* ===========================
   MENSAJE AVISO SIN ENCUESTAS, NI PACIENTES (PACIENTES Y PACIENTES - ENCUESTAS)
   =========================== */
.sin-datos {
    padding: 40px;
    text-align: center;
    font-size: 16px;
    color: #64748b;
    background: #fff;
    border-radius: 0 0 16px 16px;
}

/* ===========================
   BOTON NARANJA PRIMARIO (Se aplica los botones de Aceptar o Guardar)
   =========================== */
.btn-primario {
    padding: 10px 16px;
    border: 1px solid var(--color-borde-gris);
    background: var(--color-amarillo);
    border-color: var(--color-amarillo);
    border-radius: 10px;
    color: #212529;
    cursor: pointer;
    transition: 0.25s;
    text-decoration: none;
    font-weight: 600;
}

.btn-primario:hover {
   transform: translateY(-2px);
   box-shadow: 0 10px 20px rgba(255, 193, 71, 0.35);
}

/* ===========================
   BOTON GRIS PRIMARIO CANCELAR (Se aplica los botones de Cerrar o Cancelar)
   =========================== */
.btn-primario-cancelar {
  padding: 10px 16px;
  border: 1px solid grey;
  background: grey;
  border-radius: 10px;
  color: #fdfeff;
  cursor: pointer;
  transition: 0.25s;
  text-decoration: none;
  font-weight: 600;
}

.btn-primario-cancelar:hover {
   transform: translateY(-2px);
   box-shadow: 0 10px 20px rgba(253, 247, 234, 0.35);
}

/* ===========================
   BASE COMÚN (MENSAJE + CONFIRMACIÓN + REACTIVAR)
   =========================== */
.dialog-mensaje,
.dialog-confirmacion,
.dialog-reactivar {
    width: 500px;
    max-width: calc(100vw - 40px);
    max-height: 72vh;
    margin: auto;
    padding: 0;

    border: none;
    border-radius: 18px;
    overflow: hidden;

    background: #fff;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .18);
}

.dialog-mensaje::backdrop,
.dialog-confirmacion::backdrop,
.dialog-reactivar::backdrop {
    backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, .25);
}

.dialog-mensaje form,
.dialog-confirmacion form,
.dialog-reactivar form {
    display: flex;
    flex-direction: column;
}

/* === Header / Footer === */
.dialog-header-mensaje,
.dialog-footer-mensaje,
.dialog-header-confirm,
.dialog-footer-confirm,
.dialog-header-reactivar,
.dialog-footer-reactivar {
    padding: 18px 24px;
}

.dialog-header-mensaje,
.dialog-header-confirm,
.dialog-header-reactivar {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #ececec;
}

.dialog-footer-mensaje,
.dialog-footer-confirm,
.dialog-footer-reactivar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #ececec;
}

/* === Body === */
.dialog-body-mensaje,
.dialog-body-confirm,
.dialog-body-reactivar {
    padding: 24px;
}

.dialog-body-mensaje p,
.dialog-body-confirm p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
}

.dialog-body-confirm {
    display: flex;
    flex-direction: column;
}

.icono-confirmacion {
    display: block;
    max-width: 100px;
    max-height: 100px;
    width: 100%;
    height: auto;
    margin: 0 auto 12px;
}

.icono-confirmacion[hidden] {
    display: none;
}

.dialog-body-confirm p.mensaje-confirmacion {
    color: #3a3a3a;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0.1px;
    white-space: pre-line;
}

.mensaje-confirmacion {
    text-align: left;
}

.mensaje-confirmacion.mensaje-centrado {
    text-align: center;
}

.mensaje-confirmacion strong {
    color: #1a1a1a;
    font-weight: 600;
}


/* ===========================
   DIÁLOGO ENCUESTA (estilo propio, centrado)
   =========================== */
.dialog-encuesta {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: min(90vw, 500px);
    padding: 32px;

    border: none;
    border-radius: 18px;

    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.dialog-encuesta::backdrop {
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(3px);
}

.dialog-encuesta img {
    display: block;
    width: 20%;
    margin: 0 auto;
}

.dialog-icono {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 70px;
    height: 70px;
    margin: 0 auto 20px;

    border-radius: 50%;
    background: #22c55e;
    color: #fff;

    font-size: 2rem;
    font-weight: bold;
}

.dialog-encuesta h2,
.dialog-encuesta p {
    text-align: center;
}

.dialog-encuesta h2 {
    margin-bottom: 12px;
}

.dialog-encuesta p {
    line-height: 1.5;
}

.dialog-texto-secundario {
    margin-top: 8px;
    color: #666;
    font-size: .9rem;
}

.dialog-botones-encuesta {
    display: flex;
    justify-content: center;
    gap: 12px;

    margin-top: 28px;
    padding: 5px;
    border-radius: 10px;
}

.dialog-botones-encuesta button {
    padding: 10px;
    border-radius: 10px;
}


/* ===========================
   DIÁLOGO REACTIVAR (formulario propio)
   =========================== */
.label-reactivar {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.input-fecha-reactivar {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
}

.input-fecha-reactivar:focus {
    outline: none;
    border-color: #22c55e;
}

/* ===========================
   VALIDACIÓN DE CAMPOS - ENCUESTAS FORMULARIO
   =========================== */
.campo-invalido {
    border: 1px solid #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .15) !important;
    border-radius: 8px;
}

/* Para grupos de radios/checkboxes, marca el contenedor en vez del input */
.form-group.campo-invalido {
    border: 1px solid #ef4444;
    border-radius: 10px;
    padding: 8px;
    background: rgba(239, 68, 68, .04);
}

/* ===========================
   REDUCIR ANIMACIONES
   =========================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}