:root {
    --color-nucleo: #7C6282;
    --color-nucleo-claro: #bd9bc4;
    --color-gris: #444;
    --color-whatsapp: #25D366;
    --fondo-gris-claro: #ffffff;
}

html {
    scroll-behavior: smooth;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #ffffff;
    color: var(--color-gris);
    line-height: 1.5;
    overflow-x: hidden;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Botón flotante WhatsApp */
.floating-ws {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--color-whatsapp);
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    opacity: 0;
    animation: slideUpBtn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 2.5s;
    transition: transform 0.3s;
}

.floating-ws:hover {
    transform: scale(1.05) translateY(-3px);
    background-color: #1da851;
}

/* Hero y Logo Animado */
.hero {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 80px;
    padding-bottom: 20px;
    min-height: 300px;
    position: relative;
}

.logo-animation-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0px;
    transform: scale(2.0);
    width: 100%;
}

.logo-part {
    height: auto;
    display: block;
    opacity: 0;
}

.disco-img {
    width: 39px;
    margin-right: 1px;
    transform: translateX(-100px);
    animation: slideInLeft 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.anillos-img {
    width: 70px;
    margin-left: -1px;
    transform: translateX(100px);
    animation: slideInRight 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.texto-img {
    width: 292px;
    margin-left: 11px;
    transform: translateY(30px);
    animation: fadeInUpText 1s ease-out forwards;
    animation-delay: 0.8s;
}

/* Animaciones */
@keyframes slideInLeft {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInUpText {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUpBtn {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInRightGeneral {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* Menú */
.menubar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 160px;
    margin-bottom: 180px;
    flex-wrap: wrap;
    animation: slideInRightGeneral 1.4s ease-out;
    position: relative;
    z-index: 10;
}

.menu-item {
    padding: 12px 25px;
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 15px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.menu-item:hover {
    transform: translateY(-5px);
    border-color: var(--color-nucleo-claro);
    color: var(--color-nucleo);
    box-shadow: 0 10px 20px rgba(124, 98, 130, 0.15);
}

/* Especialidades */
.section-title {
    text-align: center;
    font-weight: 300;
    font-size: 3rem;
    margin-bottom: 60px;
    color: #888;
    animation: slideInRightGeneral 1.2s ease-out;
    line-height: 1.2;
}

.especialidades-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding-bottom: 100px;
}

.item-especialidad {
    padding: 35px 25px;
    border-radius: 20px;
    border: 1px solid #eaeaea;
    background: #fff;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    text-align: center;
    width: 300px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    animation: popIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    transform: scale(0.5);
    position: relative;
    overflow: hidden;
}

.item-especialidad:nth-child(1) { animation-delay: 0.2s; }
.item-especialidad:nth-child(2) { animation-delay: 0.3s; }
.item-especialidad:nth-child(3) { animation-delay: 0.4s; }

.specialty-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--color-nucleo);
    transition: 0.3s;
}

.item-especialidad h3 {
    font-size: 1.5rem;
    font-weight: 500;
    color: #555;
    transition: 0.3s;
}

.contenido-inicial {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: 0.3s;
}

.contenido-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-nucleo);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: 0.4s ease;
    padding: 20px;
}

.item-especialidad:hover .contenido-hover,
.item-especialidad.active-touch .contenido-hover {
    opacity: 1;
}

.item-especialidad:hover,
.item-especialidad.active-touch {
    transform: translateY(-12px);
    box-shadow: 0 25px 50px rgba(124, 98, 130, 0.25);
    border-color: var(--color-nucleo);
}

.doctores-grid {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.doctor-perfil {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.doc-img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    margin-bottom: 10px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    background-color: white;
}

.doctor-perfil:hover .doc-img {
    transform: scale(1.08);
}

.doctor-perfil p {
    font-size: 1rem;
    margin: 0;
    line-height: 1.3;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-ver-info {
    display: inline-block;
    padding: 12px 30px;
    background-color: white;
    color: var(--color-nucleo);
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-ver-info:hover {
    transform: scale(1.05);
    background-color: #f0f0f0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Detalles Section */
.detalles-section {
    background-color: var(--fondo-gris-claro);
    padding: 0px 0;
    border-top: 1px solid #ffffff;
}

.detalle-card {
    background: white;
    padding: 35px;
    margin-bottom: 30px;
    border-radius: 15px;
    border: 2px solid var(--color-nucleo-claro);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.02);
    scroll-margin-top: 50px;
    transition: all 0.4s ease;
}

.detalle-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(189, 155, 196, 0.2);
    border-color: var(--color-nucleo);
}

.detalle-card h3 {
    color: var(--color-nucleo);
    margin-bottom: 15px;
    font-size: 1.75rem;
}

.contenido-oculto {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.6s ease-out;
}

.detalle-card.expanded .contenido-oculto {
    max-height: 800px;
    opacity: 1;
    margin-top: 20px;
}

.contenido-oculto ul {
    list-style-type: disc;
    margin-left: 25px;
    margin-top: 15px;
    margin-bottom: 15px;
    text-align: left;
}

.contenido-oculto li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.btn-leermas-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    width: 100%;
}

.btn-leermas {
    background: transparent;
    border: 2px solid var(--color-nucleo);
    color: var(--color-nucleo);
    padding: 10px 25px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-leermas:hover {
    background: var(--color-nucleo);
    color: white;
}

.detalle-card.expanded .btn-leermas {
    background-color: var(--color-nucleo-claro);
    border-color: var(--color-nucleo-claro);
    color: white;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    padding: 30px;
    width: 90%;
    max-width: 500px;
    background: white;
    border-radius: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

.form-grid label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-gris);
}

.form-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: 1fr 1fr;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
}

.form-input.error {
    border-color: red;
}

.full-width {
    grid-column: span 2;
}

.btn-modal-action {
    width: 100%;
    padding: 12px;
    margin-top: 25px;
    background-color: var(--color-nucleo);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    height: 50px;
}

/* Footer y Mapa */
.map-section {
    padding-top: 50px;
    padding-bottom: 20px;
}

.map-container-style {
    border-radius: 20px;
    overflow: hidden;
    height: 350px;
}

.map-frame {
    width: 100%;
    height: 100%;
    border: 0;
}

.horarios-info {
    text-align: center;
    margin-top: 40px;
    padding: 30px;
    background: #fff;
    border-radius: 15px;
    border: 1px solid #eee;
}

footer {
    padding: 40px 0;
    text-align: center;
    font-size: 0.8rem;
    background: #333;
    color: #fff;
    margin-top: 40px;
}

/* --- AJUSTES PARA MÓVILES --- */
@media (max-width: 768px) {
    main .hero .logo-animation-container {
        transform: scale(1);
    }

    .menubar {
        margin-top: 30px;
        margin-bottom: 100px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 0 10px;
    }

    .btn-receta {
        grid-column: span 2;
    }

    .item-especialidad {
        width: 100%;
        min-height: 380px;
    }

    .doc-img {
        width: 100px;
        height: 100px;
    }

    /* Formulario optimizado mediante especificidad */
    #modalRecetas .form-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    #modalRecetas .form-grid div, 
    #modalRecetas .full-width {
        width: 100%;
    }

    #modalRecetas .modal-content {
        width: 92%;
        padding: 20px;
        margin: 10px auto;
    }

    #modalRecetas .form-input {
        font-size: 16px; 
        padding: 12px;
    }

    /* Botón flotante */
    body a.floating-ws {
        bottom: 20px;
        right: 20px;
        padding: 0;
        width: 60px;  
        height: 60px;
        justify-content: center;
        border-radius: 50%; 
    }

    body a.floating-ws span {
        display: none;
    }
    
    body a.floating-ws i {
        font-size: 1.8rem;
        margin: 0;
    }
}