/* =========================================================
   DIRECTORIO MÉDICO - SANATORIO SAN JOSÉ
   Diseño: credencial médica + expediente desplegable
   ========================================================= */

.directorio-medico {
    width: 100%;
}

/* =============================
   ENCABEZADO Y BUSCADOR
============================= */

.directorio-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 25px;
    margin-bottom: 25px;
}

.directorio-search {
    width: 360px;
    max-width: 100%;
    background: var(--beige-claro);
    border: 2px solid rgba(73, 52, 128, .14);
    border-radius: 18px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.directorio-search i {
    color: var(--morado);
    font-size: 20px;
}

.directorio-search input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    color: var(--texto);
    font-weight: 800;
}

.directorio-search input::placeholder {
    color: rgba(43, 36, 64, .65);
}

/* =============================
   FILTROS
============================= */

.especialidad-tabs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.tab-medico {
    border: 2px solid rgba(73, 52, 128, .14);
    background: var(--beige-claro);
    color: var(--morado);
    border-radius: 999px;
    padding: 9px 17px;
    font-weight: 900;
    cursor: pointer;
    transition: .25s ease;
}

.tab-medico:hover,
.tab-medico.active {
    background: var(--morado);
    color: var(--beige-claro);
    transform: translateY(-2px);
}

/* =============================
   GRID DE MÉDICOS
============================= */

.doctor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 300px));
    gap: 30px;
    align-items: start;
}

/* =============================
   CARD / CREDENCIAL MÉDICA
============================= */

.doctor-folder {
    width: 100%;
    transition: .35s ease;
}

.doctor-card-front {
    position: relative;
    min-height: 410px;
    height: 410px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: linear-gradient(180deg, rgba(255, 250, 241, .98), rgba(250, 247, 241, .98));
    border: 4px solid #F7B2D0;
    border-radius: 30px;
    box-shadow: 0 16px 30px rgba(47, 33, 87, .16);
    padding: 12px 22px 20px;
    text-align: center;
    overflow: hidden;
    transition: .35s ease;
}

/* Marca de agua individual por card */
.doctor-card-front::after {
    content: "";
    position: absolute;

    width: 190%;
    height: 190%;

    left: -58%;
    bottom: -70%;

    background-image: url("../images/Logo.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

    opacity: .035;
    transform: rotate(-28deg);

    pointer-events: none;
    z-index: 0;
}

.doctor-card-front > * {
    position: relative;
    z-index: 1;
}

.doctor-card-front:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 38px rgba(47, 33, 87, .20);
}

.doctor-card-front h3 {
    min-height: 82px;
    max-height: 92px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 0 10px;

    color: var(--morado);
    font-size: 19px;      /* antes 22px */
    font-weight: 900;
    line-height: 1.15;
    text-align: center;

    overflow: hidden;
}

.doctor-photo-box {
    width: 150px;
    height: 150px;
    margin: 0 auto 16px;
    border-radius: 24px;
    overflow: hidden;
    flex: 0 0 auto;
    background: var(--beige);
    border: 5px solid var(--beige-claro);
    box-shadow: 0 10px 24px rgba(47, 33, 87, .18);
}

.doctor-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doctor-specialty-line {
    min-height: 34px;
    margin-top: 6px;
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    font-size: 18px;
    font-weight: 950;
    margin-bottom: 20px;
}

.doctor-specialty-line i {
    font-size: 25px;
}

.ver-ficha-btn {
    width: 100%;
    border: none;
    border-top: 1px solid rgba(73, 52, 128, .18);
    background: transparent;
    color: #117d35;
    padding-top: 16px;
    font-weight: 950;
    cursor: pointer;
    transition: .25s ease;
    margin-top: auto;
}

.ver-ficha-btn i {
    margin-left: 5px;
    transition: .25s ease;
}

.ver-ficha-btn:hover {
    color: #2f2157;
}

.ver-ficha-btn:hover i {
    transform: translateX(5px);
}

/* =============================
   DETALLE / EXPEDIENTE
============================= */

.doctor-card-detail {
    display: none;
}

.doctor-folder.open {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);

    max-width: 980px;
    height: 520px;          /* NUEVO */
    max-height: 520px;      /* NUEVO */

    border: 4px solid #F7B2D0;
    border-radius: 30px;
    box-shadow: 0 18px 38px rgba(47, 33, 87, .20);
    overflow: hidden;

    animation: abrirExpediente .35s ease;
}

.doctor-folder.open .doctor-card-front {
    height: 520px;          /* NUEVO */

    border: none;
    border-right: 2px solid #F7B2D0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
}

.doctor-folder.open .doctor-card-front::after {
    width: 190%;
    height: 190%;
    left: -58%;
    bottom: -70%;
    opacity: .03;
    transform: rotate(-28deg);
}

.doctor-folder.open .doctor-card-detail {
    display: flex;                 /* CAMBIO */
    flex-direction: column;        /* CAMBIO */

    position: relative;
    background: var(--beige-claro);
    padding: 34px 30px;
    border-radius: 0;

    height: 520px;                 /* NUEVO */
    overflow: hidden;              /* NUEVO */
}

@keyframes abrirExpediente {
    from {
        opacity: .45;
        transform: scale(.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.doctor-card-detail h4 {
    color: var(--morado);
    font-size: 25px;
    font-weight: 950;
    margin-bottom: 22px;
    padding-right: 50px;
}

.cerrar-ficha-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--morado);
    color: var(--beige-claro);
    cursor: pointer;
    transition: .25s ease;
}

.cerrar-ficha-btn:hover {
    background: var(--morado-oscuro);
    transform: rotate(90deg);
}

.detail-row {
    background: rgba(255, 250, 241, .78);
    border-radius: 17px;
    padding: 16px 18px;
    margin-bottom: 13px;
    border-left: none;
}

.detail-row strong {
    display: block;
    color: var(--morado);
    font-weight: 950;
    margin-bottom: 4px;
}

.detail-row span {
    color: #201a35;
    font-weight: 650;
}

/* =============================
   SIN RESULTADOS
============================= */

.empty-doctors {
    grid-column: 1 / -1;
    background: var(--beige-claro);
    border-radius: 22px;
    padding: 40px;
    text-align: center;
    color: var(--morado);
}

.empty-doctors i {
    font-size: 42px;
}

.empty-doctors h3 {
    font-weight: 950;
    margin-top: 12px;
}

/* =============================
   RESPONSIVE
============================= */

@media(max-width: 1200px) {
    .doctor-folder.open {
        grid-column: 1 / -1;
        width: 100%;
        max-width: 100%;
    }
}

@media(max-width: 768px) {
    .directorio-header {
        flex-direction: column;
    }

    .directorio-search {
        width: 100%;
    }

    .doctor-grid {
        grid-template-columns: 1fr;
    }

    .doctor-folder,
    .doctor-card-front {
        min-height: auto;
    }

    .doctor-folder.open {
        width: 100%;
        grid-template-columns: 1fr;
    }

    .doctor-folder.open .doctor-card-front {
        border-right: none;
        border-bottom: 2px solid #F7B2D0;
        border-radius: 0;
    }

    .doctor-folder.open .doctor-card-detail {
        display: block;
        width: 100%;
    }

    .doctor-card-front::after {
        right: -65px;
        bottom: 40px;
        width: 240px;
        height: 115px;
    }
}

.especialidad-select-box {
    max-width: 430px;
    margin-bottom: 30px;
}

.especialidad-select-box label {
    display: block;
    color: var(--morado);
    font-weight: 950;
    margin-bottom: 8px;
}

.especialidad-select-box select {
    width: 100%;
    background: var(--beige-claro);
    border: 2px solid rgba(73, 52, 128, .18);
    border-radius: 18px;
    padding: 13px 16px;
    color: var(--morado);
    font-weight: 900;
    outline: none;
    cursor: pointer;
}

.especialidad-select-box select:focus {
    border-color: var(--morado);
    box-shadow: 0 0 0 4px rgba(73, 52, 128, .12);
}

.doctor-resumen-box {
    flex: 1;
    background: rgba(255, 250, 241, .78);
    border-radius: 17px;
    padding: 16px 18px;
    margin-top: 14px;
    overflow: hidden;
}

.doctor-resumen-box strong {
    display: block;
    color: var(--morado);
    font-weight: 950;
    margin-bottom: 10px;
}

.resumen-frame {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 260px;
    border: 0;
    border-radius: 14px;
    background: #ffffff;
}

/* Scroll elegante */

.doctor-resumen-box::-webkit-scrollbar {
    width: 8px;
}

.doctor-resumen-box::-webkit-scrollbar-track {
    background: rgba(73,52,128,.08);
    border-radius: 999px;
}

.doctor-resumen-box::-webkit-scrollbar-thumb {
    background: rgba(73,52,128,.45);
    border-radius: 999px;
}

.doctor-resumen-box::-webkit-scrollbar-thumb:hover {
    background: rgba(73,52,128,.70);
}

/* =========================================================
   INSTALACIONES PARA MÉDICOS
   ========================================================= */

.medicos-instalaciones {
    margin-top: 24px;
    padding: 30px;

    background: #fff;
    border: 1px solid #e7e1ef;
    border-radius: 24px;

    box-shadow: 0 8px 25px rgba(55, 35, 95, 0.06);
}

.medicos-instalaciones-header {
    margin-bottom: 24px;
}

.medicos-eyebrow {
    display: block;
    margin-bottom: 7px;

    color: #4f358c;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.4px;
}

.medicos-instalaciones-header h2 {
    margin: 0 0 8px;

    color: #4b3285;
    font-size: clamp(24px, 2vw, 34px);
    font-weight: 800;
}

.medicos-instalaciones-header p {
    max-width: 850px;
    margin: 0;

    color: #363047;
    line-height: 1.65;
}


/* FOTOGRAFÍAS */

.medicos-instalaciones-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.medicos-instalacion {
    position: relative;
    overflow: hidden;

    min-height: 340px;
    margin: 0;

    border-radius: 22px;

    background: #eee;
}

.medicos-instalacion img {
    width: 100%;
    height: 100%;
    min-height: 340px;

    display: block;
    object-fit: cover;

    transition: transform .4s ease;
}

.medicos-instalacion:hover img {
    transform: scale(1.025);
}


/* ETIQUETA SOBRE LA FOTO */

.medicos-instalacion figcaption {
    position: absolute;

    left: 18px;
    right: 18px;
    bottom: 18px;

    padding: 13px 18px;

    background: rgba(75, 50, 133, .94);
    color: #fff;

    border-radius: 14px;

    font-size: 15px;
    font-weight: 800;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 767px) {

    .medicos-instalaciones {
        padding: 20px 16px;
        border-radius: 20px;
    }

    .medicos-instalaciones-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .medicos-instalacion,
    .medicos-instalacion img {
        min-height: 260px;
    }

    .medicos-instalaciones-header h2 {
        font-size: 25px;
    }

    .medicos-instalacion figcaption {
        left: 12px;
        right: 12px;
        bottom: 12px;

        padding: 11px 14px;

        font-size: 14px;
    }
}