/* --- Variables --- */
:root {
    --color-principal: #5693aa;
    --color-texto-gris: #5f6368;
}

/* --- Loader & Fuentes --- */
#loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: sans-serif;
    font-size: 1.1rem;
    color: var(--color-texto-gris);
    background: #ffffff;
    padding: 20px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 2000;
}

@font-face {
    font-family: 'titulos';
    src: url('../titulos.ttf');
    font-display: swap;
}

/* --- Global --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f1f3f4;
    color: #202124;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding-top: 8px;
}

.app-container {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    margin: 8px auto 0;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border: 1px solid #dadce0;
    overflow: hidden;
    opacity: 0; /* Para el efecto de carga */
    transition: opacity 0.5s ease-in-out;
}

/* --- Cabecera --- */
.header {
    padding: 16px 16px 10px;
    border-bottom: 1px solid #dadce0;
    display: flex;
    align-items: center;
}

.header-logo {
    width: 100px;
    margin: 0 20px 0 20px;
}

.header h1 {
    font-size: 2.8em;
    font-weight: 500;
    color: var(--color-principal);
    flex-grow: 1;
    font-family: 'titulos', system-ui, sans-serif;
    line-height: 1.1em;
    margin-left: 8px; /* Empuja el título a la derecha */
}

.home-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 17px;
    padding: 5px;
    transition: opacity 0.2s;
    cursor: pointer;
}

.home-icon:hover {
    opacity: 0.6;
}

/* --- Selector de Mes --- */
.month-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: #f8f9fa;
}

.month-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-texto-gris);
    font-size: 18px;
}

.month-btn:hover { background-color: #eaeaea; }

.month-label { font-weight: 500; font-size: 18px; color: #3c4043; }

/* --- Calendario --- */
.calendar-grid { padding: 12px 8px; }

.weekdays {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    text-align: center;
    font-weight: 500;
    font-size: 12px;
    color: #70757a;
    margin-bottom: 8px;
}

.days-container { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }

.day-cell {
    aspect-ratio: 1.8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.1s ease;
}

.day-cell.disponible { background-color: #ffffff; color: #202124; border-color: #dadce0; }
.day-cell.disponible:hover { border-color: #1a73e8; background-color: #e8f0fe; }
.day-cell.parcial { background-color: #e8f0fe; color: #1a73e8; border-color: #d2e3fc; }
.day-cell.parcial:hover { background-color: #d2e3fc; border-color: #1a73e8; }
.day-cell.seleccionado { background-color: #e8f0fe !important; color: #1a73e8 !important; border: 2px solid #1a73e8 !important; font-weight: bold; }
.day-cell.no-disponible { background-color: #555555; color: #ffffff; cursor: not-allowed; }
.day-cell.ocupado { background-color: #244b7d; color: #ffffff; cursor: not-allowed; }

/* --- Leyenda y Horarios --- */
.legend { display: flex; justify-content: space-between; padding: 0 16px 12px; font-size: 11px; color: var(--color-texto-gris); }
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-color { width: 12px; height: 12px; border-radius: 3px; }

.hours-section { padding: 16px; border-top: 1px solid #dadce0; background-color: #ffffff; }
.hours-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }

#hoursTitle {
    font-size: 12px;
    margin-top: -8px;
    margin-bottom: 8px;
    text-align: center;
    font-weight: bold;
    color: var(--color-texto-gris);
}

.hour-card {
    padding: 4px;
    height: 44px;
    border-radius: 6px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hour-card.disponible { background-color: #34a853; color: #ffffff; }
.hour-card.disponible:hover { background-color: #2b8c44; }
.hour-card.seleccionado { background-color: #1a73e8 !important; color: #ffffff !important; box-shadow: 0 0 0 4px #1a73e8; }
.hour-card.ocupado { background-color: #757575; color: #e0e0e0; cursor: not-allowed; }
.status-text { font-size: 10px; font-weight: normal; opacity: 0.9; }

.action-button {
    width: 100%;
    padding: 14px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.action-button:disabled { background-color: #f1f3f4; color: #9aa0a6; cursor: not-allowed; }


/* --- Nuevos Ajustes de Modalidades y Horarios --- */
.app-container .hours-grid .hour-card.disponible {
    background-color: #2d6b3d !important;
    color: #ffffff !important;
    border: 1px solid #22522e !important;
    padding-left: 10px !important;
    text-align: left !important;
}

.app-container .hours-grid .hour-card.disponible:hover {
    background-color: #22522e !important;
}

.app-container .hours-grid .hour-card.online {
    border-left: 6px solid #00ff66 !important;
}

.app-container .hours-grid .hour-card.presencial {
    border-left: 6px solid #00bfff !important;
}

.legend-modalidad {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 13px;
    justify-content: center;
}

.legend-mod-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot-online { 
    width: 12px; 
    height: 12px; 
    background: #00ff66; 
    border-radius: 50%; 
}

.dot-presencial { 
    width: 12px; 
    height: 12px; 
    background: #00bfff; 
    border-radius: 50%; 
}


/* --- Modales --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.8em;
    color: #202124;
    font-family: 'titulos', system-ui, sans-serif;
    border-bottom: 2px solid #e8f0fe;
    padding-bottom: 10px;
}

/* --- Campos del Formulario --- */
.form-group {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-texto-gris);
    margin-bottom: 4px;
}

.form-group input, 
.form-group textarea {
    width: 100%;
    padding: 4px 12px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.form-group input:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: #1a73e8;
}

.form-group textarea {
    resize: vertical;
    height: 60px;
}

.label-registro-paciente {
    color: var(--color-texto-gris);
}

/* --- Sección de Consentimiento Informado --- */
.btn-link-consentimiento {
    background: none;
    border: none;
    color: var(--color-principal); /* Aplicado el color de la identidad visual */
    font-weight: bold;             /* En negrita */
    text-decoration: none;         /* Sin subrayado */
    font-size: 13px;               /* Ajustado levemente para mejorar legibilidad */
    cursor: pointer;
    padding: 0;
    margin-bottom: 10px;
    display: block;
    text-align: left;
    transition: opacity 0.2s;
}

.btn-link-consentimiento:hover {
    opacity: 0.8;                  /* Un sutil efecto al pasar el mouse */
}

/* Texto de firma del consentimiento */
.chk-consentimiento-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--color-texto-gris);
    font-weight: bold;             /* En negrita */
}

.texto-consentimiento-scroll {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dadce0;
    border-radius: 6px;
    padding: 12px;
    background-color: #f8f9fa;
    margin-bottom: 15px;
    font-size: 13px;
    line-height: 1.5;
    color: #3c4043;
}

/* --- Alerta de Pago --- */
.alerta-pago {
    background-color: #b71c1c;        /* Un rojo oscuro/intenso muy serio */
    border: 3px solid hsl(35, 100%, 55%);        /* Borde amarillo chillón que encierra el cartel */
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    color: #ffe01a;                   /* Letras amarillas vibrantes */;
    text-align: center;
    line-height: 1.2;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(183, 28, 28, 0.4);
    text-transform: uppercase;        /* Pone todo el texto en mayúsculas para que grite más */
    letter-spacing: 0.5px;            /* Separa un poquito las letras para que se lea mejor */
}

/* --- Botones --- */
.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

.btn-cancelar, 
.btn-guardar {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-cancelar {
    background-color: #f1f3f4;
    color: #3c4043;
}

.btn-cancelar:hover {
    background-color: #e8eaed;
}

.btn-guardar {
    background-color: #1a73e8;
    color: #ffffff;
}

.btn-guardar:hover {
    background-color: #1557b0;
}

.btn-guardar:disabled {
    background-color: #dadce0;
    color: #9aa0a6;
    cursor: not-allowed;
}

#chkConsentimiento:focus,
#chkYaSoyPaciente:focus {
    outline: 2px solid #1a73e8 !important;
    outline-offset: 2px !important;
}