/* ===============================
   GENERAL
================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background: #eef1f5;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

button,
input,
select {
    font: inherit;
}

button {
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.app {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    background: #ffffff;
    padding: 25px 20px 100px;
    position: relative;
}


/* ===============================
   HEADER
================================ */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saludo {
    color: #777;
    font-size: 14px;
    margin-bottom: 5px;
}

header h1 {
    font-size: 25px;
}

.perfil {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #111;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}


/* ===============================
   CONTADORES
================================ */

.resumen {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 30px;
}

.card {
    background: #f5f6f8;
    border-radius: 15px;
    padding: 15px 12px;
}

.card span {
    font-size: 21px;
}

.card p {
    color: #777;
    font-size: 12px;
    margin: 10px 0 5px;
}

.card h2 {
    font-size: 24px;
}


/* ===============================
   CITAS INICIO
================================ */

.citas {
    margin-top: 35px;
}

.titulo-seccion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.titulo-seccion h2 {
    font-size: 19px;
}

.titulo-seccion button {
    border: none;
    background: transparent;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.cita {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    border-bottom: 1px solid #eee;
    padding: 16px 0;
}

.hora {
    min-width: 55px;
}

.hora strong {
    display: block;
    font-size: 16px;
}

.hora span {
    font-size: 11px;
    color: #888;
}

.cita h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.cita p {
    color: #777;
    font-size: 13px;
}

.info-cita {
    flex: 1;
    min-width: 0;
}


/* ===============================
   ACCIONES
================================ */

.acciones-cita {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.estado {
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 20px;
}

.estado.pendiente {
    background: #fff4d8;
}

.estado.completada {
    background: #def7e5;
}

.btn-completar {
    border: none;
    background: #111;
    color: white;
    padding: 6px 9px;
    border-radius: 7px;
    font-size: 11px;
    cursor: pointer;
}

.btn-editar,
.btn-eliminar {
    border: none;
    background: #f1f1f1;
    padding: 6px 9px;
    border-radius: 7px;
    font-size: 11px;
    cursor: pointer;
}


/* ===============================
   NUEVA CITA
================================ */

.nueva-cita {
    width: 100%;
    margin-top: 30px;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: #111;
    color: white;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}


/* ===============================
   MODAL
================================ */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 1000;
}

.modal.activo {
    display: flex;
}

.modal-contenido {
    background: white;
    width: 100%;
    max-width: 390px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 22px;
    padding: 25px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

#cerrarModal {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f1f1f1;
    cursor: pointer;
}

.modal-contenido label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin: 16px 0 7px;
}

.modal-contenido input,
.modal-contenido select {
    width: 100%;
    padding: 13px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    background: white;
}

.guardar-cita {
    width: 100%;
    padding: 15px;
    margin-top: 25px;
    border: none;
    border-radius: 12px;
    background: #111;
    color: white;
    font-weight: bold;
    cursor: pointer;
}


/* ===============================
   PANTALLAS
================================ */

.pantalla-citas,
.pantalla-clientes,
.pantalla-ajustes {
    display: none;
    padding-bottom: 90px;
}

.pantalla-citas.activa,
.pantalla-clientes.activa,
.pantalla-ajustes.activa {
    display: block;
}

.encabezado-citas,
.encabezado-clientes,
.encabezado-ajustes,
.detalle-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.encabezado-citas button,
.encabezado-clientes button,
.encabezado-ajustes button,
.detalle-header button {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #f2f2f2;
    cursor: pointer;
    font-size: 18px;
}


/* ===============================
   SELECTOR FECHAS
================================ */

.fecha-citas {
    margin-bottom: 20px;
}

.fecha-citas p {
    color: #777;
    font-size: 13px;
}

.selector-fechas {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 0 20px;
}

.selector-fechas::-webkit-scrollbar {
    display: none;
}

.dia-selector {
    min-width: 62px;
    padding: 12px 8px;
    border: none;
    border-radius: 14px;
    background: #f5f6f8;
    cursor: pointer;
}

.nombre-dia {
    display: block;
    font-size: 11px;
    color: #777;
}

.numero-dia {
    display: block;
    font-size: 19px;
    font-weight: bold;
    margin-top: 6px;
}

.dia-selector.activo {
    background: #111;
    color: white;
}

.dia-selector.activo .nombre-dia {
    color: #ddd;
}


/* ===============================
   AGENDA
================================ */

.cita-agenda {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    touch-action: manipulation;
}

.cita-agenda:hover,
.cita-agenda:focus-visible {
    background: #f5f6f8;
}

.cita-agenda:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.cita-agenda > div:last-child {
    min-width: 0;
}

.cita-agenda h4,
.cita-agenda p,
.cita-agenda small {
    overflow-wrap: anywhere;
}

.hora-agenda {
    min-width: 55px;
    font-weight: bold;
}

.sin-citas {
    text-align: center;
    color: #888;
    padding: 45px 10px;
}


/* ===============================
   CLIENTES
================================ */

.buscador-clientes {
    margin-bottom: 20px;
}

.buscador-clientes input {
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 12px;
}

.cliente-card {
    padding: 17px 5px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.cliente-card p,
.cliente-card small {
    color: #777;
    font-size: 13px;
}

.detalle-cliente {
    display: none;
}

.detalle-cliente.activo {
    display: block;
}

.detalle-info {
    background: #f7f7f7;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 25px;
}

.detalle-info p {
    color: #666;
    margin-top: 7px;
    font-size: 14px;
}

.total-cliente {
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
}

.btn-whatsapp {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 13px;
    border-radius: 10px;
    background: #111;
    color: white;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
}

.btn-nueva-cita-cliente {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 13px;
    border: 1px solid #111;
    border-radius: 10px;
    background: white;
    color: #111;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.btn-nueva-cita-cliente:hover {
    background: #f1f1f1;
}

.historial-item {
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}


/* ===============================
   AJUSTES
================================ */

.bloque-ajustes {
    margin-bottom: 35px;
}

.bloque-ajustes h3 {
    margin-bottom: 15px;
}

.bloque-ajustes label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 7px;
}

.bloque-ajustes input {
    width: 100%;
    padding: 13px;
    border: 1px solid #ddd;
    border-radius: 10px;
}

.fila-ajustes {
    display: grid;
    grid-template-columns: 1fr 90px;
    gap: 10px;
}

.btn-ajustes {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #111;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.item-ajuste {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid #eee;
}

.item-ajuste div strong {
    display: block;
}

.item-ajuste div span {
    font-size: 12px;
    color: #777;
}

.eliminar-ajuste {
    border: none;
    padding: 7px 9px;
    border-radius: 8px;
    background: #f1f1f1;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.detalle-cita-contenido {
    max-width: 390px;
}

#cerrarDetalleCita {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f1f1f1;
    cursor: pointer;
}

.detalle-cita-datos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}

.detalle-cita-datos div {
    min-width: 0;
}

.detalle-cita-datos dt {
    margin-bottom: 5px;
    color: #777;
    font-size: 12px;
}

.detalle-cita-datos dd {
    color: #111;
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.acciones-detalle-cita {
    display: grid;
    gap: 10px;
    margin-top: 26px;
}

.acciones-detalle-cita button {
    width: 100%;
    min-height: 46px;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

.btn-detalle-principal {
    border: none;
    background: #111;
    color: white;
}

.btn-detalle-secundario {
    border: 1px solid #111;
    background: white;
    color: #111;
}

.btn-detalle-eliminar {
    border: 1px solid #ddd;
    background: #f5f6f8;
    color: #333;
}

.bloque-sesion {
    padding-top: 5px;
    border-top: 1px solid #eee;
}

.btn-cerrar-sesion {
    width: 100%;
    min-height: 46px;
    padding: 12px 18px;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    background: #f5f6f8;
    color: #111;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.btn-cerrar-sesion:hover {
    background: #ebedf0;
}

.btn-cerrar-sesion:focus-visible,
.btn-ajustes:focus-visible,
#btnLogin:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}


/* ===============================
   HORARIOS
================================ */

.texto-ayuda {
    font-size: 13px;
    color: #777;
    margin-bottom: 15px;
}

.horario-dia {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.horario-superior {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.horario-superior strong {
    font-size: 14px;
}

.horario-horas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.horario-horas input {
    width: 100%;
}

.estado-dia {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #666;
}

.estado-dia input {
    width: auto;
}


/* ===============================
   NAV
================================ */

nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 430px;
    margin-left: -20px;
    display: flex;
    background: white;
    border-top: 1px solid #eee;
    padding: 12px 0;
    z-index: 100;
}

nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: #999;
    cursor: pointer;
}

nav a span {
    font-size: 11px;
}

nav a.activo {
    color: #111;
}

/* ===============================
   HORAS DISPONIBLES
================================ */

.horarios-disponibles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.hora-disponible {
    border: 1px solid #ddd;
    background: #f7f7f7;
    padding: 10px 5px;
    border-radius: 9px;
    font-size: 13px;
    cursor: pointer;
}

.hora-disponible:hover {
    border-color: #111;
}

.hora-disponible.seleccionada {
    background: #111;
    color: white;
    border-color: #111;
}

.mensaje-horarios {
    grid-column: 1 / -1;
    color: #777;
    font-size: 13px;
    padding: 12px 0;
}

/* ===============================
   LOGIN
================================ */

.login {
    position: fixed;
    inset: 0;
    background: #f5f6f8;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 25px;
    z-index: 9999;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: white;

    padding: 35px 28px;
    border-radius: 22px;
}

.login-logo {
    width: 60px;
    height: 60px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 20px;

    background: #111;
    color: white;

    border-radius: 50%;

    font-size: 20px;
    font-weight: bold;
}

.login-card h1 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 8px;
}

.login-card>p {
    text-align: center;
    color: #777;
    margin-bottom: 30px;
}

.login-card label {
    display: block;

    margin-top: 16px;
    margin-bottom: 7px;

    font-size: 14px;
    font-weight: 600;
}

.login-card input {
    width: 100%;

    padding: 14px;

    border: 1px solid #ddd;
    border-radius: 12px;

    font-size: 16px;

    box-sizing: border-box;
}

.login-card input:focus {
    outline: none;
    border-color: #111;
}

#btnLogin {
    width: 100%;

    margin-top: 25px;
    padding: 15px;

    border: none;
    border-radius: 12px;

    background: #111;
    color: white;

    font-size: 16px;
    font-weight: bold;

    cursor: pointer;
}

#btnLogin:hover {
    background: #292929;
}

.login-error {
    color: #d93025 !important;
    font-size: 13px;
    text-align: center;

    margin-top: 15px !important;
    margin-bottom: 0 !important;
}

/* ===============================
   RESPONSIVE MÓVIL
================================ */

@media (max-width: 380px) {
    .app {
        padding: 20px 16px 100px;
    }

    nav {
        margin-left: -16px;
    }

    .login {
        padding: 16px;
    }

    .login-card {
        padding: 30px 20px;
    }

    .modal {
        padding: 12px;
    }

    .modal-contenido {
        max-height: calc(100dvh - 24px);
        padding: 22px 20px;
        border-radius: 18px;
    }

    .horarios-disponibles {
        grid-template-columns: repeat(3, 1fr);
    }

    .detalle-cita-datos {
        grid-template-columns: 1fr;
        gap: 13px;
    }
}

@media (max-width: 340px) {
    .fila-ajustes {
        grid-template-columns: 1fr;
    }
}
