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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #222;
    padding: 20px;
}

.calendario {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    background: white;
    border-radius: 18px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 24px;
    position: relative;
}


/* CABECERA */

.cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 22px;
}

.cabecera h1 {
    font-size: 28px;
    color: #2d3748;
    margin-bottom: 6px;
}

.cabecera p {
    color: #6b7280;
    font-size: 15px;
}

.boton-hoy {
    border: none;
    background: #2f6f9f;
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
}

.boton-hoy:hover {
    opacity: 0.9;
}


/* NAVEGACIÓN */

.navegacion {
    display: grid;
    grid-template-columns: 55px 1fr 55px;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.navegacion h2 {
    text-align: center;
    font-size: 24px;
    color: #374151;
}

.boton-nav {
    border: none;
    background: #e8edf2;
    color: #333;
    width: 50px;
    height: 42px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
}

.boton-nav:hover {
    background: #dfe5ea;
}


/* SELECTOR DE VISTA */

.selector-vista {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.boton-vista {
    border: none;
    background: #edf1f4;
    color: #555;
    padding: 9px 18px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.boton-vista.activo {
    background: #2f6f9f;
    color: white;
}


/* TABLA */

.contenedor-tabla {
    overflow-x: auto;
    padding-bottom: 6px;
}

.tabla-calendario {
    display: grid;
    grid-template-columns: 90px repeat(5, minmax(180px, 1fr));
    min-width: 1050px;
    border: 1px solid #d6dbe0;
    border-radius: 14px;
    overflow: hidden;
}

.celda {
    min-height: 105px;
    border-right: 1px solid #d6dbe0;
    border-bottom: 1px solid #d6dbe0;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.35;
}

.celda:nth-child(6n) {
    border-right: none;
}


/* CABECERAS DE DÍA */

.cabecera-hora,
.cabecera-dia {
    min-height: 62px;
    background: #eef1f3;
    font-weight: bold;
    color: #40464d;
}

.cabecera-dia {
    font-size: 16px;
}

.cabecera-hora {
    font-size: 14px;
}


/* HORAS */

.hora {
    background: #f8f9fa;
    font-weight: bold;
    color: #555;
    font-size: 14px;
}


/* CELDAS VACÍAS */

.buida {
    background: #ffffff;
}


/* ASIGNATURAS */

.assignatura {
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.assignatura {
    flex-direction: column;
    gap: 5px;
}

.assignatura:hover {
    transform: scale(1.015);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.08);
}


/* COLORES DE ASIGNATURAS */

.angles {
    background: #fce8d7;
    color: #8a4b12;
}

.mostres {
    background: #e3f2e5;
    color: #2f6b3c;
}

.laboratori {
    background: #e3ecf8;
    color: #315a87;
}

.biologia {
    background: #f1e6f7;
    color: #6c3f85;
}

.fisiopatologia {
    background: #fff0c9;
    color: #806310;
}

.hematologia {
    background: #f9e1e6;
    color: #8a3d4c;
}

.digitalitzacio {
    background: #e3f4f5;
    color: #2f6f72;
}

.sostenibilitat {
    background: #eef2d9;
    color: #66702b;
}

.itinerari {
    background: #ece6f7;
    color: #5e4a86;
}

.mo {
    background: #f0ece9;
    color: #665952;
}

.tutoria {
    background: #fff3c9;
    color: #806810;
}

.examen {
    background: #fbe2de;
    color: #94463d;
}

.sortida {
    background: #e1edf8;
    color: #3e668e;
}

.altre {
    background: #dce3e8;
    color: #3e5666;
    border-left: 5px solid #718797;
}


/* BOTÓN NUEVO */

.boton-nuevo {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: #2f6f9f;
    color: white;
    font-size: 34px;
    cursor: pointer;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.22);
}


/* MODAL */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.oculto {
    display: none;
}

.modal-contenido {
    background: white;
    width: 100%;
    max-width: 480px;
    border-radius: 16px;
    padding: 24px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);

    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.modal-contenido h2 {
    margin-bottom: 20px;
    color: #333;
}

.cerrar-modal {
    position: absolute;
    top: 12px;
    right: 15px;
    border: none;
    background: transparent;
    font-size: 30px;
    cursor: pointer;
    color: #666;
}

.modal-contenido label {
    display: block;
    font-weight: bold;
    margin-top: 14px;
    margin-bottom: 6px;
    color: #444;
}

.modal-contenido input,
.modal-contenido select,
.modal-contenido textarea {
    width: 100%;
    border: 1px solid #ccd2d8;
    border-radius: 9px;
    padding: 10px 12px;
    font-size: 15px;
    background: white;
}

.modal-contenido textarea {
    resize: vertical;
}

.acciones-modal {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
}

.boton-borrar,
.boton-guardar {
    border: none;
    padding: 11px 18px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: bold;
}

.boton-borrar {
    background: #e6e6e6;
    color: #b42318;
}

.boton-guardar {
    background: #2f6f9f;
    color: white;
}

/* =====================================================
   ESTILO DE EVENTOS - ASPECTO TIPO PDF
===================================================== */

.campo-otro {
    margin-top: 10px;
}

.nota-visible {
    display: block;
    margin-top: 7px;
    font-size: 12px;
    font-weight: normal;
    color: inherit;
    opacity: 0.85;
    line-height: 1.25;
}


/* CABECERA AZUL SUAVE COMO EL PDF */

.cabecera-hora,
.cabecera-dia {
    background: #dce8f7;
    color: #244d7c;
}


/* CASILLA DONDE VAN LOS EVENTOS */

.celda-eventos {
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;

    gap: 8px;

    padding: 10px;

    min-height: 140px;

    background: #ffffff;
}


/* TARJETA DE CADA ASIGNATURA / EVENTO */

.evento-bloque {
    position: relative;

    flex: 1 1 0;

    width: 100%;

    min-height: 52px;

    padding: 14px 10px;

    border-radius: 12px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;

    cursor: pointer;

    border: 1px solid rgba(255, 255, 255, 0.65);

    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease;
}


.evento-bloque:hover {
    transform: scale(1.015);

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08);
}


.titulo-evento {
    width: 100%;

    text-align: center;

    line-height: 1.25;

    font-weight: bold;
}


/* EVENTO PERSONALIZADO */

.altre {
    background: #b8c4d1;
    color: #1f2937;

    border-left: 5px solid #65788a;
}


/* RECORDATORIO */

.icono-recordatorio {
    position: absolute;
    right: 7px;
    bottom: 7px;

    width: 24px;
    height: 24px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.85);

    font-size: 13px;

    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.con-recordatorio {
    box-shadow:
        inset 0 0 0 2px rgba(230, 160, 30, 0.85);
}

.etiqueta-color {
    margin-top: 16px !important;
}

.selector-colores {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.selector-colores {
    display: flex;
    gap: 14px;
    margin-top: 8px;
}

.color-selector {
    cursor: pointer;
}

.color-selector input {
    display: none;
}

.color-selector span {
    display: block;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid transparent;
}

.color-selector input:checked+span {
    border-color: #263746;
    box-shadow:
        0 0 0 3px white inset,
        0 0 0 1px #263746;
}

.color-coral span {
    background: #ef6a5b;
}

.color-fucsia span {
    background: #c84ca8;
}

.color-azul span {
    background: #4267c7;
}

.color-verde span {
    background: #57a64a;
}

.color-mostaza span {
    background: #d89d25;
}

.color-coral {
    background: #ef6a5b;
}

.color-fucsia {
    background: #c84ca8;
}

.color-azul {
    background: #4267c7;
}

.color-verde {
    background: #57a64a;
}

.color-mostaza {
    background: #d89d25;
}


/* COLORES DE EVENTOS ALTRE */

.altre-coral {
    background: #ef6a5b;
    color: white;
}

.altre-fucsia {
    background: #c84ca8;
    color: white;
}

.altre-azul {
    background: #4267c7;
    color: white;
}

.altre-verde {
    background: #57a64a;
    color: white;
}

.altre-mostaza {
    background: #d89d25;
    color: white;
}

/* =====================================================
   VISTA MENSUAL
===================================================== */

.tabla-calendario.tabla-mes {
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    min-width: 980px;
}

.cabecera-mes {
    min-height: 54px;
    padding: 12px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #dce8f7;
    color: #244d7c;
    font-weight: bold;
    border-right: 1px solid #d6dbe0;
    border-bottom: 1px solid #d6dbe0;
}

.celda-mes {
    min-height: 145px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 7px;
    text-align: left;
    background: #ffffff;
    border-right: 1px solid #d6dbe0;
    border-bottom: 1px solid #d6dbe0;
    cursor: pointer;
}

.tabla-mes > *:nth-child(7n) {
    border-right: none;
}

.numero-dia {
    align-self: flex-end;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: #4b5563;
    font-weight: bold;
    font-size: 13px;
}

.dia-fuera-mes {
    background: #f7f8fa;
}

.dia-fuera-mes .numero-dia,
.dia-fuera-mes .lista-eventos-mes {
    opacity: 0.48;
}

.dia-hoy .numero-dia {
    background: #2f6f9f;
    color: white;
}

.lista-eventos-mes {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.evento-mes {
    position: relative;
    min-height: 31px;
    padding: 6px 27px 6px 7px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    text-align: left;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.65);
    overflow: hidden;
}

.hora-evento-mes {
    font-size: 10px;
    line-height: 1.1;
    opacity: 0.78;
    font-weight: normal;
}

.titulo-evento-mes {
    width: 100%;
    font-size: 11px;
    line-height: 1.15;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.evento-mes .icono-recordatorio {
    right: 4px;
    bottom: 4px;
    width: 18px;
    height: 18px;
    font-size: 10px;
}

/* TABLET */

@media (max-width: 900px) {

    body {
        padding: 10px;
    }

    .calendario {
        padding: 16px;
        border-radius: 12px;
    }

    .cabecera h1 {
        font-size: 22px;
    }

    .navegacion h2 {
        font-size: 19px;
    }

}


/* MÓVIL */

@media (max-width: 600px) {

    body {
        padding: 0;
        background: white;
    }

    .calendario {
        border-radius: 0;
        box-shadow: none;
        padding: 12px;
    }

    .cabecera {
        align-items: flex-start;
    }

    .cabecera h1 {
        font-size: 20px;
    }

    .cabecera p {
        font-size: 13px;
    }

    .boton-hoy {
        padding: 8px 12px;
        font-size: 13px;
    }

    .navegacion {
        grid-template-columns: 42px 1fr 42px;
    }

    .navegacion h2 {
        font-size: 16px;
    }

    .boton-nav {
        width: 40px;
        height: 38px;
    }

    .selector-vista {
        margin-bottom: 14px;
    }

    .tabla-calendario {
        grid-template-columns: 72px repeat(5, 165px);
        min-width: 897px;
    }

    .celda {
        min-height: 92px;
        padding: 10px;
        font-size: 13px;
    }

    .cabecera-dia {
        font-size: 13px;
    }

    .hora {
        font-size: 12px;
    }

    .boton-nuevo {
        width: 54px;
        height: 54px;
        right: 18px;
        bottom: 18px;
    }

    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-contenido {
        max-width: none;
        border-radius: 18px 18px 0 0;
        padding: 22px 18px 28px;

        max-height: 90vh;
        overflow-y: auto;
    }

    .celda-eventos {
        min-height: 110px;
        padding: 6px;
        gap: 6px;
    }

    .evento-bloque {
        min-height: 46px;
        padding: 10px 7px;
        border-radius: 9px;
        position: relative;
    }

    .tabla-calendario.tabla-mes {
        grid-template-columns: repeat(7, 130px);
        min-width: 910px;
    }

    .cabecera-mes {
        min-height: 48px;
        padding: 8px 5px;
        font-size: 12px;
    }

    .celda-mes {
        min-height: 120px;
        padding: 6px;
    }

    .evento-mes {
        min-height: 29px;
        padding: 5px 24px 5px 6px;
    }

}
