/*==================================================
      PENSIONHUB CRM - MÓDULO FICHA Y LISTA DE CLIENTES
==================================================*/

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

.phcrm-clients {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    color: #0f172a;
    max-width: 1100px;
    margin: 0 auto;
}

/* Encabezados generales del CRM */
.phcrm-clients h2,
#contenidoPestana h3 {
    color: #04034a;
    font-size: 22px;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 18px;
    letter-spacing: -0.4px;
}

.phcrm-clients h3 {
    color: #04034a;
    font-size: 16px;
    font-weight: 800;
    margin-top: 20px;
    margin-bottom: 12px;
}

/*==================================================
     BARRA SUPERIOR DE BÚSQUEDA Y NUEVO CLIENTE
==================================================*/

.phcrm-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.phcrm-search-box {
    flex: 1;
    min-width: 280px;
}

#buscarCliente {
    width: 100%;
    padding: 12px 18px;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.25s ease;
    background-color: #ffffff;
    box-sizing: border-box;
}

#buscarCliente:focus {
    border-color: #5b9f3b;
    box-shadow: 0 0 0 4px rgba(91, 159, 59, 0.15);
}

#contadorClientes {
    font-size: 12px;
    color: #64748b;
    font-weight: 700;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Botón + Nuevo Cliente */
#phcrm-new-client,
#btnGuardarCliente {
    background: linear-gradient(135deg, #5b9f3b 0%, #48842e 100%);
    color: #ffffff;
    border: none;
    padding: 13px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(91, 159, 59, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#phcrm-new-client:hover,
#btnGuardarCliente:hover {
    background: linear-gradient(135deg, #4b8730 0%, #3c6e26 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(91, 159, 59, 0.45);
}

#btnLimpiarCliente {
    background: #f0f4f9;
    color: #04034a;
    border: 1.5px solid #d5e0eb;
    padding: 13px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-left: 8px;
}

#btnLimpiarCliente:hover {
    background: #e2ebf5;
    border-color: #b8cde0;
}

/*==================================================
    FORMULARIO REGISTRO DE CLIENTE (MODAL / CARD)
==================================================*/

#phcrm-client-form {
    background: #ffffff;
    border-radius: 20px;
    padding: 32px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 35px rgba(4, 3, 74, 0.08);
    margin-bottom: 35px;
    position: relative;
    overflow: hidden;
}

#phcrm-client-form::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #04034a 0%, #5b9f3b 100%);
}

#phcrm-client-form p {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 12px;
}

/* ZONA DE CARGA DE PDF (DRAG & DROP ZONE) */
#phcrm-pdf {
    width: 100%;
    padding: 16px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-sizing: border-box;
    font-size: 13px;
    color: #64748b;
}

#phcrm-pdf:hover {
    background: #eef8ea;
    border-color: #5b9f3b;
    color: #5b9f3b;
}

/* Barra de Carga PDF */
#estadoCargaPDF {
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

#barraCargaPDF {
    background: linear-gradient(90deg, #5b9f3b, #74bf4f) !important;
}

#mensajeCargaPDF {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
    margin-top: 8px;
    margin-bottom: 0;
}

/* Formulario Manual en Grid (2 Columnas) */
#phcrm-client-form input[type="text"],
#phcrm-client-form input[type="date"] {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.25s ease;
    background-color: #ffffff;
}

#phcrm-client-form input:focus {
    border-color: #5b9f3b;
    box-shadow: 0 0 0 4px rgba(91, 159, 59, 0.15);
    outline: none;
}

#phcrm-client-form hr {
    border: none;
    height: 1px;
    background: #e2e8f0;
    margin: 24px 0;
}

/* Vista previa del historial laboral detectado */
#vistaPreviaHistorial {
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 14px;
    padding: 20px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
}

/*==================================================
        CONTENEDOR DE LA FICHA DEL CLIENTE
==================================================*/

#phcrm-ficha-cliente {
    background: #ffffff;
    border-radius: 20px;
    padding: 30px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px rgba(4, 3, 74, 0.07);
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

#phcrm-ficha-cliente::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #04034a 0%, #5b9f3b 100%);
}

.phcrm-header {
    display: flex;
    align-items: center;
    gap: 22px;
    padding-bottom: 22px;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 22px;
}

.phcrm-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #04034a 0%, #120e6e 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(4, 3, 74, 0.2);
    border: 3px solid #ffffff;
    outline: 2px solid #5b9f3b;
}

.phcrm-avatar svg {
    width: 30px;
    height: 30px;
}

.phcrm-info {
    flex: 1;
}

#clienteNombre {
    color: #04034a;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0 0 8px 0;
    line-height: 1.1;
}

/* Insignias de Datos (NSS, CURP, Semanas) */
.phcrm-datos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.phcrm-datos > span {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.phcrm-datos > span strong {
    color: #04034a;
    font-weight: 700;
}

.phcrm-datos > span span {
    color: #1e293b;
    font-weight: 700;
}

/* Destacado Verde para Semanas */
.phcrm-datos > span:last-child {
    background: #eef8ea;
    border-color: rgba(91, 159, 59, 0.3);
}

.phcrm-datos > span:last-child strong,
.phcrm-datos > span:last-child span {
    color: #5b9f3b;
    font-weight: 800;
}

/* Pestañas de la Ficha */
.phcrm-tabs {
    display: flex;
    gap: 6px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 14px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.phcrm-tab {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    text-align: center;
}

.phcrm-tab:hover {
    color: #04034a;
    background: rgba(255, 255, 255, 0.6);
}

.phcrm-tab.activo {
    background: #04034a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(4, 3, 74, 0.2);
}

#contenidoPestana {
    min-height: 250px;
    animation: phcrmFadeIn 0.3s ease-in-out;
}

@keyframes phcrmFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/*==================================================
           TABLAS Y ACCIONES DEL HISTORIAL
==================================================*/

.phcrm-tabla {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    margin-bottom: 20px;
}

.phcrm-tabla th {
    background-color: #04034a;
    color: #ffffff;
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.phcrm-tabla td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #334155;
    vertical-align: middle;
}

.phcrm-tabla tr:last-child td {
    border-bottom: none;
}

.phcrm-tabla tr:nth-child(even) {
    background-color: #f8fafc;
}

.phcrm-historial-acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.phcrm-historial-acciones button {
    background: #ffffff;
    color: #04034a;
    border: 1.5px solid #cbd5e1;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

.phcrm-historial-acciones button:hover {
    border-color: #5b9f3b;
    color: #5b9f3b;
}

/* Tarjeta de Calculadoras */
.phcrm-calculos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.phcrm-calculadora {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.phcrm-calculadora h4 {
    margin-top: 0;
    color: #04034a;
    font-size: 18px;
    font-weight: 800;
}

#btnModalidad40 {
    background: #04034a;
    color: white;
    border: none;
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s ease;
}

#btnModalidad40:hover {
    background: #5b9f3b;
}

/* Adaptabilidad Responsiva */
@media (max-width: 768px) {
    .phcrm-top-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .phcrm-header {
        flex-direction: column;
        text-align: center;
    }
    .phcrm-datos {
        justify-content: center;
    }
    .phcrm-tabs {
        flex-direction: column;
    }
}