/* ==============================================
   VISTA PACIENTE - ESTILOS CSS CON METODOLOGÍA BEM
   Bloque: .citas
   Elemento: .citas__elemento
   Modificador: .citas__elemento--modificador
============================================== */

.citas {
  width: 100%;
  margin: 0 auto;
  border-collapse: collapse;
}

.citas__tabla {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.citas__cabecera {
  background: var(--verde);
  color: var(--blanco);
}

.citas__fila {
  border-bottom: 1px solid #e0e0e0;
}

.citas__celda {
  padding: 0.7rem 0.5rem;
  text-align: left;
  vertical-align: middle;
}

.citas__celda--acciones {
  text-align: center;
  min-width: 110px;
}

.citas__boton {
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 1rem;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}
.citas__boton:hover {
  background: #c0392b;
}

/* ================= HISTORIAL MÉDICO - ESCRITORIO ================= */
.historial__tabla {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  overflow: hidden;
}

.historial__cabecera {
  background: var(--verde);
  color: var(--blanco);
}

.historial__fila {
  border-bottom: 1px solid #e0e0e0;
}

.historial__celda {
  padding: 0.7rem 0.5rem;
  text-align: left;
  vertical-align: middle;
}

.historial__celda--acciones {
  text-align: center;
  min-width: 110px;
}

.historial__boton {
  background: var(--verde);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 1rem;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.historial__boton:hover {
  background: var(--verde-oscuro);
}

/* ================= CONTENEDOR DE TABLAS - ESCRITORIO ================= */
.tabla-container {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Estilos para filtros */
.filtros {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  align-items: center;
  flex-wrap: wrap;
}

.filtros input[type="date"],
.filtros select {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 16px;
}

.filtros button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
}

#btn-filtrar {
  background-color: #15907c;
  color: white;
}

#btn-filtrar:hover {
  background-color: #0d5f51;
}

#btn-reset {
  background-color: #6c757d;
  color: white;
}

#btn-reset:hover {
  background-color: #5a6268;
}

/* Responsive: mostrar como cards en móvil */
@media (max-width: 900px) {
  .citas__tabla {
    min-width: unset !important;
    width: 100% !important;
    overflow-x: visible !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  .tabla-container {
    overflow-x: visible !important;
    box-sizing: border-box !important;
    background: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 0.5rem !important;
    padding: 0 !important;
    max-width: calc(100% - 1rem) !important;
  }
  .citas__cabecera {
    display: none;
  }
  .citas__fila {
    margin-bottom: 1.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    padding: 1.5rem;
    border: 1px solid #e8e8e8;
    border-left: 6px solid var(--verde);
    position: relative;
    margin-left: 0;
    margin-right: 0;
    overflow: visible;
    word-break: break-word;
    display: block;
  }
  .citas__celda {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.8rem 0;
    border: none;
    font-size: 1rem;
    background: none;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
  }
  .citas__celda:last-child {
    border-bottom: none;
  }
  .citas__celda--acciones {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-bottom: 0;
    background: none;
    padding: 0.8rem 0;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    min-width: unset;
    justify-content: flex-start;
    border-bottom: none;
  }
  .citas__celda[data-label]:before {
    content: attr(data-label) ': ';
    font-weight: 600;
    color: var(--verde-oscuro);
    flex: 0 0 auto;
    min-width: 100px;
    margin-right: 0.8rem;
    word-break: break-word;
    text-align: left;
    display: inline;
    padding-left: 0;
    font-size: 0.95rem;
  }
  .citas__celda > *:not([data-label]):not(:before) {
    flex: 1 1 auto;
    text-align: left;
    margin-left: 0;
    font-weight: 500;
  }
  .citas__celda[data-label="Acciones"]:before {
    min-width: 100px;
    text-align: left;
    display: inline;
  }
  .citas__celda[data-label="Motivo"] {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }
  .citas__celda[data-label="Calificación"] {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .citas__boton {
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-weight: 600;
  }
  /* Contenedor principal y títulos */
  .contenedor-citas,
  .contenedor-principal,
  .contenedor {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    box-sizing: border-box;
    width: 100%;
    overflow: visible;
    margin-top: 3.5rem;
  }
  .titulo-citas,
  .titulo-principal,
  .titulo {
    text-align: center;
    font-size: 1.4em;
    margin-top: 1rem;
    margin-bottom: 1rem;
    word-break: break-word;
  }
  /* Filtros centrados en móvil */
  .filtros-citas,
  .filtros {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
  }
  .filtros input[type="date"],
  .filtros select {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }
  .filtros button {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }
  /* Calificación: estrellas en una sola línea */
  .citas__celda[data-label="Calificación"] .estrellas,
  .citas__celda[data-label="Calificación"] form .estrellas {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    align-items: center;
    justify-content: flex-start;
  }
  .citas__celda[data-label="Calificación"] form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .citas__celda[data-label="Calificación"] input[type="text"] {
    width: 100%;
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
  }
}

/* ================= HISTORIAL MÉDICO RESPONSIVE ================= */
@media (max-width: 900px) {
  .historial__tabla {
    min-width: unset !important;
    width: 100% !important;
    overflow-x: visible !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  .tabla-container {
    overflow-x: visible !important;
    box-sizing: border-box !important;
    background: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 0.5rem !important;
    padding: 0 !important;
    max-width: calc(100% - 1rem) !important;
  }
  .historial__cabecera {
    display: none !important;
  }
  .historial__fila {
    margin-bottom: 1.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    padding: 1.5rem;
    border: 1px solid #e8e8e8;
    border-left: 6px solid var(--verde);
    position: relative;
    margin-left: 0;
    margin-right: 0;
    overflow: visible;
    word-break: break-word;
    display: block;
  }
  .historial__celda {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.8rem 0;
    border: none;
    font-size: 1rem;
    background: none;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    border-bottom: 1px solid #f0f0f0;
  }
  .historial__celda:last-child {
    border-bottom: none;
  }
  .historial__celda[data-label]:before {
    content: attr(data-label) ': ';
    font-weight: 600;
    color: var(--verde-oscuro);
    flex: 0 0 auto;
    min-width: 100px;
    margin-right: 0.8rem;
    word-break: break-word;
    text-align: left;
    display: inline;
    padding-left: 0;
    font-size: 0.95rem;
  }
  .historial__celda--acciones {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
    margin-bottom: 0;
    background: none;
    padding: 0.8rem 0;
    border-radius: 0;
    box-shadow: none;
    border-bottom: none;
  }
  .historial__boton {
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
    display: block;
    font-size: 0.95rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    background: var(--verde);
    color: #fff;
    border: none;
    transition: background 0.2s;
  }
  .historial__boton:hover {
    background: var(--verde-oscuro);
  }
  .filtros-historial {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.7rem;
  }
  .filtros-historial button {
    margin: 0;
  }
  /* Filtros de historial centrados en móvil */
  .filtros-historial {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin-bottom: 1.2rem;
    text-align: center;
  }
  .filtros-historial select {
    width: 100%;
    max-width: 250px;
    text-align: center;
  }
  .filtros-historial button {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
  }
  .fila-detalles td {
    margin-bottom: 1.2rem;
    display: block;
    margin-left: 1.2rem;
  }
} 

/* ================= MEDICAMENTOS RESPONSIVE ================= */
@media (max-width: 900px) {
  .medicamentos__tabla {
    min-width: unset !important;
    width: 100% !important;
    overflow-x: visible !important;
    border-collapse: separate;
    border-spacing: 0;
  }
  .medicamentos__cabecera {
    display: none;
  }
  .medicamentos__fila {
    margin-bottom: 1.7rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    padding: 1.2rem 1.3rem 0.7rem 1.3rem;
    border: 1.5px solid #e0e0e0;
    border-left: 5px solid var(--verde);
    position: relative;
    margin-left: 0.7rem;
    margin-right: 0.7rem;
    overflow: visible;
    word-break: break-word;
    display: block;
  }
  .medicamentos__celda {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border: none;
    font-size: 1.05em;
    background: none;
    word-break: break-word;
    white-space: pre-line;
    overflow-wrap: anywhere;
    border-bottom: none !important;
    text-align: right;
  }
  .medicamentos__celda[data-label]:before {
    content: attr(data-label) ': ';
    font-weight: bold;
    color: var(--verde-oscuro);
    flex: 1 0 50%;
    min-width: 120px;
    margin-right: 0.5rem;
    word-break: break-word;
    text-align: left;
    display: block;
    padding-left: 0.5rem;
  }
  .medicamentos__celda--acciones {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.7rem;
    margin-bottom: 0.3rem;
    background: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .medicamentos__boton {
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
    display: block;
    font-size: 1.1em;
    padding: 0.6rem 0;
    border-radius: 6px;
    font-weight: bold;
    background: var(--verde);
    color: #fff;
    border: none;
    transition: background 0.2s;
  }
  .medicamentos__boton:hover {
    background: var(--verde-oscuro);
  }
} 

.titulo-citas {
  text-align: center;
  color: var(--verde);
  margin-bottom: 30px;
  font-size: 2rem;
  margin-top: 0 !important;
}

@media (max-width: 900px) {
  .titulo-citas {
    margin-top: 4.5rem !important;
  }
} 

@media (max-width: 900px) {
  .container:first-of-type {
    margin-bottom: 2.5rem !important;
  }
} 