/**
 * HistoLab - Portal de Pacientes y Médicos
 * Estilos del portal (front y admin). Podés modificar este archivo para adaptar la apariencia.
 */

/* ---- Contenedor general (mismo fondo para todos los portales, incluido login administrador) ---- */
.histolab-portal,
.histolab-portal.histolab-admin-login {
    max-width: 1140px;
    margin: 2rem auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
    border-radius: 8px;
    box-sizing: border-box;
}

/* ---- Títulos y texto ---- */
.histolab-portal .histolab-title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    font-weight: 600;
    color: #1a1a1a;
}

.histolab-portal .histolab-desc {
    margin: 0 0 1.5rem;
    color: #555;
}

/* ---- Formulario de login (paciente) ---- */
.histolab-login .histolab-form {
    margin: 0;
}

.histolab-field {
    margin: 0 0 1rem;
}

.histolab-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.histolab-field input[type="email"],
.histolab-field input[type="text"],
.histolab-field input[type="password"] {
    width: 100%;
    max-width: 100%;
    min-height: 55px;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.histolab-field input:focus {
    border-color: #844671;
    outline: none;
    box-shadow: 0 0 0 1px #844671;
}

/* Altura mínima unificada para todos los inputs y passwords del portal */
.histolab-portal input[type="text"],
.histolab-portal input[type="email"],
.histolab-portal input[type="password"] {
    min-height: 55px;
}

.histolab-actions {
    margin: 1.25rem 0 0;
}

/* ---- Botones ---- */
.histolab-btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.histolab-btn-primary {
    background: #844671;
    color: #fff;
}

.histolab-btn-primary:hover {
    background: #6d3a5d;
    color: #fff;
}

.histolab-btn-secondary {
    background: #f0f0f1;
    color: #2c3338;
}

.histolab-btn-secondary:hover {
    background: #dcdcde;
    color: #2c3338;
}

/* ---- Mensajes ---- */
.histolab-msg {
    margin: 1rem 0 0;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

.histolab-msg.histolab-error {
    background: #fcf0f1;
    color: #b32d2e;
}

.histolab-msg.histolab-success {
    background: #edfaef;
    color: #00a32a;
}

/* ---- Lista de estudios (paciente) ---- */
.histolab-estudios .histolab-logout {
    margin: 0 0 1.5rem;
}

.histolab-list-estudios {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.histolab-estudio-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}

.histolab-estudio-item:last-child {
    border-bottom: none;
}

.histolab-estudio-fecha {
    font-weight: 500;
}

.histolab-estudio-link {
    color: #844671;
    text-decoration: none;
}

.histolab-estudio-link:hover {
    text-decoration: underline;
}

.histolab-empty {
    color: #666;
    font-style: italic;
}

/* ---- Nombre médico y paciente (shortcodes [histolab_nombre_medico] y [histolab_paciente_nombre]) ---- */
.histolab-nombre-medico,
.histolab-nombre-paciente {
    font-weight: 600;
    color: #1a1a1a;
}

/* ---- Portal médico (lista de pacientes) ---- */
.histolab-portal.histolab-medicos {
    max-width: 1140px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.histolab-search-wrap {
    margin: 0 0 1.25rem;
}

.histolab-search-input {
    width: 100%;
    max-width: 360px;
    min-height: 55px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.histolab-search-input:focus {
    border-color: #844671;
    outline: none;
    box-shadow: 0 0 0 1px #844671;
}

.histolab-search-input::placeholder {
    color: #757575;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.histolab-list-pacientes {
    list-style: none;
    margin: 0;
    padding: 0;
}

.histolab-paciente-item {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    box-sizing: border-box;
}

.histolab-paciente-datos {
    flex: 0 1 280px;
    min-width: 0;
}

.histolab-paciente-item .histolab-paciente-nombre {
    display: block;
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: #1a1a1a;
}

.histolab-paciente-meta {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    color: #555;
}

.histolab-paciente-meta:last-of-type {
    margin-bottom: 0;
}

.histolab-paciente-estudios {
    flex: 1 1 300px;
    min-width: 0;
}

.histolab-estudio-fila {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.histolab-estudio-fila:last-of-type {
    border-bottom: none;
}

.histolab-estudio-fila .histolab-estudio-fecha {
    font-size: 0.95rem;
    color: #333;
}

.histolab-pdf-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #844671;
    transition: color 0.15s ease, transform 0.15s ease;
}

.histolab-pdf-icon:hover {
    color: #6d3a5d;
    transform: scale(1.1);
}

.histolab-icon-pdf {
    width: 24px;
    height: 24px;
    display: block;
}

.histolab-sin-estudios {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* compat con listado antiguo por si algo lo usa */
.histolab-meta {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.histolab-sublist-estudios {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.95rem;
}

.histolab-sublist-estudios li {
    padding: 0.35rem 0;
    border-bottom: 1px solid #eee;
}

.histolab-sublist-estudios li:last-child {
    border-bottom: none;
}

.histolab-sublist-estudios .histolab-estudio-fecha {
    margin-right: 0.5rem;
}

/* ---- Admin (lista en backend) ---- */
.histolab-admin-wrap {
    margin-right: 20px;
}

.histolab-admin-wrap .wp-list-table {
    margin-top: 1rem;
}

/* Filas de estudios en editor (CPT) */
.histolab-estudio-row input[type="text"] {
    width: 160px;
    margin-right: 8px;
}

/* ---- Panel administrador (carga de pacientes) ---- */
.histolab-portal.histolab-admin-panel {
    max-width: 640px;
}

.histolab-admin-panel .histolab-form-paciente {
    max-width: 100%;
}

/* Botones del panel de carga y login admin siempre en #844671, texto blanco en todos los estados */
.histolab-portal.histolab-admin-panel .histolab-btn-primary,
.histolab-portal.histolab-admin-login .histolab-btn-primary {
    background: #844671;
    border-color: #844671;
    color: #fff;
}
.histolab-portal.histolab-admin-panel .histolab-btn-primary:hover,
.histolab-portal.histolab-admin-panel .histolab-btn-primary:focus,
.histolab-portal.histolab-admin-panel .histolab-btn-primary:active,
.histolab-portal.histolab-admin-login .histolab-btn-primary:hover,
.histolab-portal.histolab-admin-login .histolab-btn-primary:focus,
.histolab-portal.histolab-admin-login .histolab-btn-primary:active {
    background: #6d3a5d;
    border-color: #6d3a5d;
    color: #fff;
}

.histolab-estudios-carga {
    margin: 1.25rem 0;
}

.histolab-estudios-carga > label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.histolab-hint {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 0.5rem;
}

.histolab-fila-estudio {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.histolab-fila-estudio input[type="text"] {
    width: 140px;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.histolab-fila-estudio input[type="file"] {
    font-size: 0.95rem;
}

/* ---- Popup loading al cargar paciente ---- */
.histolab-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.histolab-loading-box {
    background: #fff;
    padding: 2rem 2.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.histolab-loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 3px solid #e0e0e0;
    border-top-color: #844671;
    border-radius: 50%;
    animation: histolab-spin 0.8s linear infinite;
}

@keyframes histolab-spin {
    to { transform: rotate(360deg); }
}

.histolab-loading-text {
    margin: 0;
    font-weight: 500;
    color: #333;
}

/* ---- Select en formularios ---- */
.histolab-field select {
    width: 100%;
    max-width: 320px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

/* ---- Panel admin front (dashboard) ---- */
.histolab-portal.histolab-admin-dashboard {
    max-width: 900px;
}

.histolab-dashboard-nav {
    margin: 0 0 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.histolab-dashboard-nav .histolab-nav-active {
    background: #844671;
    color: #fff;
}

.histolab-dashboard-section {
    margin-bottom: 2rem;
}

.histolab-dashboard-section h3 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
}

.histolab-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.histolab-table th,
.histolab-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.histolab-table th {
    background: #f6f7f7;
    font-weight: 600;
}

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

.histolab-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 4px;
}

.histolab-badge-pendiente {
    background: #fcf0e3;
    color: #94660c;
}

.histolab-badge-ok {
    background: #edfaef;
    color: #00a32a;
}

.histolab-btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
}

/* ---- Página acceso médicos (login + registro, misma página siempre visible) ---- */
.histolab-portal.histolab-registro-medico {
    max-width: 960px;
}

.histolab-acceso-medicos-doble {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    margin-top: 1.5rem;
}

@media (max-width: 700px) {
    .histolab-acceso-medicos-doble {
        grid-template-columns: 1fr;
    }
}

/* Tarjetas modernas para cada formulario */
.histolab-form-card {
    padding: 1.75rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.histolab-form-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
}

.histolab-login-medico-wrap,
.histolab-registro-medico-wrap {
    margin: 0;
}

.histolab-registro-medico-wrap .histolab-hint,
.histolab-login-medico-wrap .histolab-hint {
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
    color: #5c5c5c;
}

.histolab-subtitle {
    margin: 0 0 0.35rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: -0.01em;
}

/* Campos con etiqueta flotante (floating label) */
.histolab-field-floating {
    position: relative;
    margin-bottom: 1.25rem;
}

.histolab-field-floating input {
    width: 100%;
    min-height: 55px;
    padding: 1rem 0.75rem 0.35rem;
    padding-right: 2.5rem;
    font-size: 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    background: #fafafa;
    color: #1a1a1a;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
}

.histolab-field-floating input:hover {
    background: #fff;
}

.histolab-field-floating input:focus {
    outline: none;
    border-color: #844671;
    box-shadow: 0 0 0 3px rgba(132, 70, 113, 0.15);
    background: #fff;
}

.histolab-field-floating input::placeholder {
    color: transparent;
}

.histolab-field-floating label {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    transform-origin: left center;
    margin: 0;
    font-size: 1rem;
    color: #6b7280;
    pointer-events: none;
    transition: transform 0.2s ease, font-size 0.2s ease, color 0.2s ease;
}

.histolab-field-floating input:focus ~ label,
.histolab-field-floating input:not(:placeholder-shown) ~ label {
    transform: translateY(-1.6rem) scale(0.85);
    font-size: 0.8125rem;
    color: #844671;
}

.histolab-field-floating.histolab-password-wrap {
    width: 100%;
    display: block;
}

.histolab-field-floating .histolab-pwd-toggle {
    right: 10px;
}

/* Recuérdame */
.histolab-field-remember {
    margin-bottom: 1rem;
}

.histolab-remember {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: #5c5c5c;
    cursor: pointer;
}

.histolab-remember input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: #844671;
    cursor: pointer;
}

/* Botón ancho completo y estado de carga */
.histolab-btn-block {
    width: 100%;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.05s ease, opacity 0.2s ease;
}

.histolab-btn-block:active {
    transform: scale(0.99);
}

.histolab-btn.histolab-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.histolab-btn.histolab-loading::after {
    content: "";
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    left: 50%;
    top: 50%;
    margin-left: -0.625rem;
    margin-top: -0.625rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: histolab-spin 0.6s linear infinite;
}

.histolab-btn-primary.histolab-loading::after {
    border-color: rgba(255,255,255,0.4);
    border-right-color: transparent;
}

@keyframes histolab-spin {
    to { transform: rotate(360deg); }
}

/* Mensajes bajo el botón */
.histolab-form-card .histolab-msg {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: opacity 0.2s ease;
}

.histolab-form-card .histolab-msg.histolab-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.histolab-form-card .histolab-msg.histolab-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ============================================================
   Botón ojo mostrar/ocultar contraseña (solo este control, no .histolab-btn)
   ============================================================ */
.histolab-password-wrap {
    display: inline-block;
    position: relative;
    max-width: 100%;
}

.histolab-password-wrap input[type="password"],
.histolab-password-wrap input[type="text"] {
    padding-right: 30px;
}

.histolab-pwd-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    margin: 0;
    border: none;
    outline: none;
    background: none;
    cursor: pointer;
    color: #666666;
    display: flex;
    align-items: center;
    justify-content: center;
}

.histolab-pwd-toggle:hover,
.histolab-pwd-toggle:focus {
    color: #666666;
    border: none;
    outline: none;
    background: none;
}

.histolab-pwd-toggle .histolab-icon-eye,
.histolab-pwd-toggle .histolab-icon-eye-off {
    width: 14px;
    height: 14px;
    pointer-events: none;
}

.histolab-pwd-toggle .histolab-icon-eye-off {
    display: none;
}

.histolab-pwd-toggle.is-visible .histolab-icon-eye {
    display: none;
}

.histolab-pwd-toggle.is-visible .histolab-icon-eye-off {
    display: block;
}
