/* CONFIGURACIÓN BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f5f7fb;
    color: #333;
}

/* LAYOUT PRINCIPAL */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Contenido principal de la parte derecha */
.main-content {
    flex: 1;
    padding: 3rem 4rem;
    background-color: #7084c7; 
    min-height: 100vh;
}

/* Cada sección: calendario, perfil, citas, farmacia... */
.section {
    display: none;
    animation: fadeIn 0.5s ease;
}

.section.active {
    display: block;
}

/* PÁGINA LOGIN/REGISTRO */
/* página de autenticación */
.auth-page {
    width: 100%;
    min-height: 100vh;
    /*  Fondo degradado animado visual */
    background: linear-gradient(-45deg, #e3f2fd, #bbdefb, #b3c3f8, #c5fadd);
    background-size: 400% 400%;
    animation: gradientBG 5s ease infinite;   
    /* animación de colores en movimiento */
    /* centrar el login */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
}

/* CAJA DE LOGIN/REGISTRO CENTRAL */
.auth-box {
    background: rgba(255, 255, 255, 0.85);
    /* efecto visual difuminado */
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 500px;
    padding: 40px;
    /* Bordes redondeados */
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-form {
    display: none;
    width: 100%;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

/* ENLACES LOGIN   */
/* Esitlos a "No tienes cuenta?" */
.auth-link-container {
    font-size: 0.95rem;
    color: #444;
    margin-top: 30px; /*  espacio entre el botón y el enlace */
    text-align: center;
}

.auth-link {
    color: #2a1b63;
    font-weight: 600;
    text-decoration: none;
    margin-left: 5px;
}

.auth-link:hover {
    text-decoration: underline;
}


/* LOGOTIPO DEL LOGIN/REGISTRO */
.auth-logo { 
    width: 220px; 
    margin: 0 auto 15px; 
    display: block; 
}

.auth-subtitle { 
    font-size: 1.6rem; 
    color: #444; 
    font-weight: 600; 
    text-align: center; 
    margin-bottom: 20px; 
}

/* CAMPOS DE FORMULARIO  */

/* caja de inputs  */
.input-group, .input-group-auth {
    background: #f0f2f7;
    padding: 12px 18px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    border: 1px solid transparent;
}

/* pequeños icónos de inputs  */
.input-group i, .input-group-auth i { 
    margin-right: 15px; 
    color: #667eea; 
}
.input-group input, .input-group-auth input, .input-group-auth select {
    border: none; 
    background: transparent; 
    width: 100%; outline: none; 
    font-family: inherit;
}

/* SIDEBAR PARA SCROLLEAR */
.sidebar {
    width: 380px;
    background: white;
    box-shadow: 2px 0 20px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    gap: 5px;
}


.logo-img { 
    width: 180px; 
    height: auto; 
}
.hospital-name { 
    font-size: 1.3rem; 
    font-weight: 700; 
    color: #333; 
}
/* texto de bienvenida  */
.user-welcome { font-size: 0.95rem; color: #666; }


/* NAVEGACIÓN  */
.nav-links a {
    display: flex;
    align-items: center;
    padding: 1rem;
    color: #666;
    text-decoration: none;
    border-radius: 10px;
    margin: 5px 1rem;
    transition: 0.3s;
}

/* OPCIÓN SELECCIONADA  */
.nav-links a.active {
    background: #eef2ff;
    color: #667eea;
    font-weight: 600;
}

/* PERFIL */
.profile-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.info-item { 
    margin-bottom: 20px; 
}
.info-label { 
    color: #000080; 
    font-weight: 700; 
    text-transform: uppercase; 
    font-size: 0.85rem; 
    display: block;
    margin-bottom: 5px; 
}
.info-value { 
    color: #000; 
    font-size: 1.1rem; 
}

/* para poder editar los datos del perfil  */
.edit-field {
    display: none;
    width: 100%;
    padding: 10px;
    border: 1px solid #667eea;
    border-radius: 8px;
    font-family: inherit;
    background: #fff;
}

.edit-field.active { 
    display: block; 
}

/* oculta el texto normal cuando aparece el input */
.info-value.hidden { 
    display: none; 
}

/* botones ocultos */
.btn-primary.hidden { 
    display: none; 
}

/* inputs de los datos del usuario que sólo pueden leerse y no editarse*/
.edit-field[readonly] {
    background-color: #f0f0f0 !important;
    color: #666;
    cursor: not-allowed;
}

/* GRID Y TARJETAS */
.specialists-grid, .appointments-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.pharmacy-card { background: white; border-radius: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); padding: 25px; }




/* tarjeta de cita */
.appointment-card-modern {
    background: white;
    border-radius: 20px;
    padding: 25px;
    border-left: 8px solid #000080;
}

/* BOTÓN PRINCIPAL */
.btn-primary {
    background: #2a1b63;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

/* BOTÓN DE LOGOUT */
.btn-logout {
    background: #fff;
    color: #ff5252;
    border: 1px solid #ff5252;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
}

/* SECCIÓN DE LA FARMACIA Y REMEDIOS */
.pharmacy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    align-items: start;
}

.remedies-container {
    margin-top: 15px;
}

.remedy-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: #f8f9ff;
    border-radius: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.remedy-item i {
    font-size: 1.2rem;
    color: #667eea;
}

.remedy-item p {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}
/* Cabecera de la sección */
.pharmacy-header { text-align: center; margin-bottom: 30px; color: white; }
.pharmacy-header h2 { font-size: 2rem; margin-bottom: 5px; }


/* Formulario Moderno */
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; color: #2a1b63; border-bottom: 2px solid #f0f0f0; padding-bottom: 10px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: #555; margin-bottom: 5px; }
.form-group input, .form-group select { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-family: inherit; }
.read-only-input { background: #f9f9f9; color: #888; border-color: #eee; }

/* Botón de pedido */
.btn-order { width: 100%; padding: 15px; background: #2a1b63; color: white; border: none; border-radius: 10px; font-weight: 600; cursor: pointer; transition: 0.3s; }
.btn-order:hover { background: #3d2a8a; transform: translateY(-2px); }

/* Lista de Pedidos */
.modern-orders-list { max-height: 300px; overflow-y: auto; margin-top: 15px; }
.order-item-modern { 
    background: #f8f9ff; padding: 15px; border-radius: 10px; margin-bottom: 10px; 
    border-left: 5px solid #2a1b63; animation: fadeIn 0.4s ease;
}
.order-item-modern strong { display: block; color: #2a1b63; }
.order-item-modern small { color: #777; }

/* Remedios */
/* Cabecera */
.pharmacy-subtitle-main {
    color: #ffffff; 
    font-size: 1.1rem;
    margin-top: 5px;
    font-weight: 300;
}

/* Remedios con claridad */
.remedies-title {
    color: #1a1a1a !important;
    margin-bottom: 15px;
}

.remedy-simple-card {
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.remedy-simple-card strong {
    color: #2a1b63;
    display: block;
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.remedy-simple-card p {
    color: #333333 !important; 
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

/* Divisor */
.card-divider {
    margin: 20px 0;
    border: none;
    border-top: 1px solid #eee;
}

/* Lista de pedidos */
.modern-orders-list {
    max-height: 250px;
    overflow-y: auto;
}

.order-item-modern {
    background: #f8f9ff;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid #2a1b63;
}

.order-item-modern strong {
    color: #1a1a1a;
    font-size: 0.95rem;
}

.order-item-modern small {
    color: #666;
    display: block;
}

.empty-msg {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 10px;
}


/* ESTILOS DEL CALENDARIO */
/* caja principal del calendario */
.calendar-container { 
    background: white; 
    padding: 20px; 
    border-radius: 20px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
}
.calendar-header { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 20px; 
    margin-bottom: 20px; 
}
/* cuadricula con las 7 columnas */
.calendar-grid { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 10px; 
}
/* nombre de los días */
.calendar-day-name { 
    text-align: center; 
    font-weight: bold; 
    color: #5a378c; 
    padding: 10px 0; 
    font-size: 0.9rem;
}
/* casilla del día  */
.day-cell { 
    background: #f8f9ff; 
    border: 1px solid #eee; 
    border-radius: 10px; 
    min-height: 90px; 
    padding: 10px; 
    transition: 0.3s; 
    cursor: pointer; 
}
.day-cell:hover { 
    background: #eef2ff; 
    border-color: #667eea; 
}
/* día actual  */
.day-cell.today { 
    background: #eef2ff; 
    border: 2px solid #667eea; 
}

.day-cell.empty { 
    background: transparent; 
    border: none; 
    cursor: default; 
}
/* día pasado  */
.day-cell.past-day { 
    background-color: #f0f0f0; 
    color: #aaa; 
    cursor: not-allowed; 
}

/* mini cita  */
.calendar-apt { 
    background: #667eea; 
    color: white; 
    font-size: 0.65rem; 
    padding: 2px 4px; 
    border-radius: 4px; 
    margin-top: 3px; 
    white-space: nowrap; 
    overflow: hidden; 
}

/* NUEVA CITA  */
/* contenedor para centrar el formulario de citas */
.appointment-container-centered {
    max-width: 600px; 
    margin: 0 auto;   
    padding: 20px;
}

.appointment-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* estilo para las opciones de hora ocupadas */
select option:disabled {
    color: #ccc;
    background-color: #f9f9f9;
    font-style: italic;
}

#appointmentTime option:disabled {
    background-color: #f2f2f2;
    cursor: not-allowed;
}

#appointmentTime option {
    padding: 8px;
    font-weight: 500;
}

.hora-ocupada {
    color: #ff4d4d !important; /* Rojo para advertir ocupación */
    background-color: #fce8e8;
    font-style: italic;
}

select option:disabled {
    cursor: not-allowed;
}

/* ESPECIALISTAS  *//* ELIMINA cualquier regla anterior de #specialistsGrid que use display: grid */

#specialistsGrid {
    display: block !important; /* IMPORTANTE: Debe ser block para que los grupos bajen */
    padding: 20px;
}

.especialidad-bloque {
    margin-bottom: 60px;
    width: 100%;
}

.titulo-categoria {
    color: #ffffff !important;
    font-size: 2rem;
    border-left: 8px solid #2a1b63;
    padding-left: 20px;
    margin-bottom: 30px;
    margin: 20px 0;
    text-align: left;
}

.medicos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.tarjeta-medico {
    background: white;
    border-radius: 20px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.tarjeta-medico img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #7084c7;
}

.tarjeta-medico:hover {
    transform: scale(1.03); /* Efecto de aumento al pasar el ratón */
}

.tarjeta-medico h4 {
    margin: 0;
    font-size: 1.3rem;
    color: #333;
}

.tarjeta-medico span {
    color: #666;
    font-size: 0.85rem;
}
.tag-especialidad {
    color: #666;
    font-size: 1rem;
    display: block;
    margin-top: 5px;
}


/* --- OTROS --- */
.hidden { display: none !important; }
.edit-field { display: none; }
.edit-field.active { display: block; }
.info-value.hidden { display: none; }

/* ANIMACIONES */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.hidden { display: none !important; }

/* títulos principales  */
.main-content h2 {
    color: #ffffff;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.2rem;
}

/* NUEVA CITA  */
/* contenedor para centrar el formulario de citas */
.appointment-container-centered {
    max-width: 600px; 
    margin: 0 auto;   
    padding: 20px;
}

.appointment-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* estilo para las opciones de hora ocupadas */
select option:disabled {
    color: #ccc;
    background-color: #f9f9f9;
    font-style: italic;
}

#appointmentTime option:disabled {
    background-color: #f2f2f2;
    cursor: not-allowed;
}

#appointmentTime option {
    padding: 8px;
    font-weight: 500;
}

.hora-ocupada {
    color: #ff4d4d !important; 
    background-color: #fce8e8;
    font-style: italic;
}

select option:disabled {
    cursor: not-allowed;
}

/* ESPECIALISTAS  */
#specialistsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Se adapta al número de cartas */
    gap: 20px;
    padding: 20px;
}

.specialist-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.specialist-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

