:root {
    --pc-orange: #ec3c00;
    --pc-dark: #24201d;
    --pc-header-height: 97px;
    --pc-footer-height: 32px;
}

body {
    min-height: 100vh;
    background-color: #f8f9fa;
    background-image: url("../images/PlaniClassesFons.jpg");
    background-position: 50% 0;
    background-size: cover;
    background-attachment: fixed;
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.fixed-header {
    position: fixed;
    top: 0;
    z-index: 1030;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(36, 32, 29, 0.06);
}

.capcalera {
    min-height: var(--pc-header-height);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    /* Alineem el logo a l'esquerra i centrem verticalment com a PlaniSoftware */
    padding-left: 0;
    padding-top: 0;
    padding-bottom: 0;
    padding-right: 0;
}

.capcalera > :first-child {
    justify-self: start;
    min-width: 0;
}

.capcalera .titol-pagina {
    justify-self: center;
}

.capcalera .menu-usuari {
    justify-self: end;
    min-width: 0;
}

.logo-principal {
    height: 80px;
    width: auto;
    border: 0;
}

.centre-actual {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-centre {
    max-height: 4.375rem;
    max-width: 12rem;
    width: auto;
    height: auto;
    object-fit: contain;
}

.titol-pagina {
    margin: 0;
    color: #6c757d;
    font-size: 1.45rem;
    font-weight: 500;
    font-weight: 500;
    text-align: center;
}

.menu-usuari {
    text-align: right;
    font-size: 1rem;
    padding-right: 10px;
}

.enllacos-usuari {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.enllacos-usuari a,
.enllacos-usuari button {
    color: #0d6efd;
}

.container_cos {
    min-height: 100vh;
    padding-top: calc(var(--pc-header-offset, var(--pc-header-height)) + 4px);
    padding-bottom: calc(var(--pc-footer-height) + 16px);
}

@media (min-width: 768px) {
    html:has(.main-llista),
    body:has(.main-llista) {
        height: 100%;
        overflow: hidden;
    }

    .main-llista {
        height: 100vh;
        min-height: 0;
        overflow: hidden;
        padding-top: calc(var(--pc-header-offset, var(--pc-header-height)) + 4px);
        padding-bottom: calc(var(--pc-footer-height) + 4px);
    }

    .contingut-llista {
        height: 100%;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .contingut-llista > * {
        flex-shrink: 0;
    }

    .contingut-llista > .llista-scroll,
    .contingut-llista > .tab-content {
        flex: 1 1 auto;
        min-height: 0;
    }

    .llista-scroll {
        overflow-y: auto;
    }

    .contingut-llista .tab-content {
        overflow: hidden;
    }

    .contingut-llista .tab-content > .tab-pane.active {
        height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .contingut-llista .tab-content > .tab-pane.active.tab-pane-llista {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .contingut-llista .tab-content > .tab-pane-llista > * {
        flex-shrink: 0;
    }

    .contingut-llista .tab-content > .tab-pane.active.tab-pane-llista > .llista-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    .contingut-llista .llista-scroll table {
        border-collapse: separate;
        border-spacing: 0;
    }

    .contingut-llista .llista-scroll thead th,
    .contingut-llista .tab-content > .tab-pane.active thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: #fff;
        background-clip: padding-box;
        box-shadow: inset 0 -1px 0 #dee2e6;
    }
}

.capcalera-pagina {
    background: rgba(255, 255, 255, 0.94);
    border-left: 5px solid var(--pc-orange);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 3px 14px rgba(36, 32, 29, 0.07);
}

.breadcrumb {
    background-color: rgba(255, 255, 255, 0.94);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
}

.nav-tabs {
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 0;
    border-radius: 0.5rem 0.5rem 0 0;
    padding: 0.5rem 0.5rem 0;
}

.nav-tabs .nav-link {
    color: var(--pc-dark);
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    background-color: #f8f9fa;
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--pc-dark);
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
}

.graella-horaria {
    min-width: 920px;
    table-layout: fixed;
}

.graella-horaria .franja-hora {
    width: 110px;
    background: #f8f9fa;
    font-size: 0.82rem;
    white-space: nowrap;
}

.graella-horaria th,
.graella-horaria td {
    vertical-align: top;
}

.graella-horaria tbody tr.fila-separador-simple > th,
.graella-horaria tbody tr.fila-separador-simple > td {
    border-top: 1px solid var(--bs-border-color) !important;
}

.graella-horaria tbody tr.fila-separador-doble > th,
.graella-horaria tbody tr.fila-separador-doble > td {
    border-top: 4px double var(--bs-border-color) !important;
}

.graella-horaria .cell-sessio {
    background: #fff7f2;
    border-left: 3px solid var(--pc-orange) !important;
    font-size: 0.86rem;
}

.graella-horaria .cell-lliure {
    background: #fff;
}

.graella-horaria .cell-buida,
.graella-horaria .cell-ocupada {
    background: #f1f3f5;
}

.graella-horaria .cell-continuacio {
    background: #f8f9fa;
    color: #6c757d;
    font-style: italic;
}

/* Els botons outline passen a tenir fons sòlid per millorar la legibilitat. */
.btn-outline-primary,
.btn-outline-secondary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #0d6efd;
    --bs-btn-border-color: #0d6efd;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #0b5ed7;
    --bs-btn-hover-border-color: #0a58ca;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #0a58ca;
    --bs-btn-active-border-color: #0a53be;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #0d6efd;
    --bs-btn-disabled-border-color: #0d6efd;
}

.btn-outline-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: #dc3545;
    --bs-btn-border-color: #dc3545;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #bb2d3b;
    --bs-btn-hover-border-color: #b02a37;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #b02a37;
    --bs-btn-active-border-color: #a52834;
}

.btn-outline-warning {
    --bs-btn-color: #000;
    --bs-btn-bg: #ffc107;
    --bs-btn-border-color: #ffc107;
    --bs-btn-hover-color: #000;
    --bs-btn-hover-bg: #ffca2c;
    --bs-btn-hover-border-color: #ffc720;
    --bs-btn-active-color: #000;
    --bs-btn-active-bg: #ffcd39;
    --bs-btn-active-border-color: #ffc720;
}

.fixed-footer {
    position: fixed;
    bottom: 0;
    z-index: 1020;
    width: 100%;
    height: var(--pc-footer-height);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.75rem;
    padding: 0 1rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
    color: #6c757d;
    font-size: 0.82rem;
}

.footer-enllacos {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-self: start;
}

.footer-any-academic {
    justify-self: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.footer-copyright {
    justify-self: end;
    color: inherit;
    white-space: nowrap;
}

.footer-copyright:hover {
    color: inherit;
}

.card {
    box-shadow: 0 3px 14px rgba(36, 32, 29, 0.07);
}

.filtres-horari {
    flex: 0 0 auto;
}

.informe-scroll {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem 0.75rem;
}

.informe-fix {
    flex-shrink: 0;
}

.informe-taula-scroll {
    border: 1px solid #dee2e6;
    border-radius: 0.35rem;
    overflow-x: auto;
}

.informe-taula-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    background-clip: padding-box;
    box-shadow: inset 0 -1px 0 #dee2e6;
}

@media (min-width: 768px) {
    .informe-scroll {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .informe-taula-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    .informe-diagnostic {
        flex-shrink: 0;
        max-height: 30vh;
        overflow-y: auto;
        margin-bottom: 0.75rem;
    }
}

.llista-scroll > .filtres-horari {
    margin-bottom: 0 !important;
    border: 0;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 3;
}

.filtres-horari .input-group-text {
    font-weight: 600;
}

.llista-scroll .graella-horaria thead th {
    top: var(--pc-filtres-alcada, 0px);
    background: #f8f9fa;
}

.targeta-entrada {
    max-width: 620px;
}

.icona-gran {
    color: var(--pc-orange);
    font-size: 2.6rem;
}

.hero-plani {
    background: rgba(255, 255, 255, 0.94);
    border-left: 5px solid var(--pc-orange);
}

.hero-plani h2 span {
    color: var(--pc-orange);
}

.taula-persones td,
.taula-persones th {
    vertical-align: middle;
}

.form-label {
    font-weight: 600;
}

.help-block {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    color: #dc3545;
    font-size: 0.875em;
}

@media (max-width: 991.98px) {
    .capcalera {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.5rem;
    }

    .titol-pagina {
        text-align: center;
    }
}

@media (max-width: 767.98px) {
    .logo-centre {
        max-height: 3rem;
        max-width: 8rem;
    }

    .menu-usuari {
        font-size: 1rem;
    }

    .enllacos-usuari {
        gap: 0.5rem;
    }
}

.missatges-superiors .alert .missatge-multiple {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    margin-right: calc(var(--bs-alert-padding-x, 1rem) - 3rem);
}

.missatges-superiors .alert .missatge-multiple > :first-child {
    justify-self: start;
}

.missatges-superiors .alert .missatge-multiple .btn-link {
    border: 0;
    white-space: nowrap;
    grid-column: 2;
    justify-self: center;
}

.missatges-superiors .alert .detalls-llista ul {
    margin-top: 0.5rem;
    max-height: 17.5vh;
    overflow-y: auto;
    text-align: left;
}

.panell-ajuda {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(36, 32, 29, 0.08);
    border-left: 4px solid var(--pc-orange);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 3px 14px rgba(36, 32, 29, 0.07);
}

.capcalera-horari {
    padding: 0.45rem 0.75rem;
    background: #fff;
}

@media (max-width: 767.98px) {
    .fixed-footer {
        column-gap: 0.35rem;
        padding: 0 0.5rem;
        font-size: 0.72rem;
    }

    .footer-enllacos {
        gap: 0.4rem;
    }

    .footer-any-academic {
        font-size: 0.7rem;
    }
}

.capcalera-horari .versio-any,
.capcalera-horari h2,
.capcalera-horari .badge {
    flex-shrink: 0;
}

.versio-notes {
    flex: 1 1 auto;
    min-width: 0;
}

.accions-versio {
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .accions-versio {
        flex-wrap: nowrap;
    }
}

.enllac-surt {
    border: 0;
    background: transparent;
    padding: 0;
    color: #0d6efd;
    font: inherit;
    line-height: inherit;
    cursor: pointer;
}

.enllac-surt:hover {
    text-decoration: underline;
}

/* Contacta'ns amb el mateix format que a PlaniFeines */
.enllac-contacte {
    color: #0d6efd !important;
    text-decoration: none;
}

.enllac-contacte:hover {
    text-decoration: underline;
}

.sessio-grid[data-sessio-url] {
    cursor: pointer;
    border-radius: 0.25rem;
}

.sessio-grid[data-sessio-url]:hover,
.sessio-grid[data-sessio-url]:focus-visible {
    background: #fff;
    outline: 2px solid rgba(13, 110, 253, 0.35);
    outline-offset: 2px;
}

.sessio-grid[data-mou-url] {
    cursor: grab;
}

.sessio-grid.sessio-arrossegada {
    cursor: grabbing;
    opacity: 0.45;
}

.sessio-grid.sessio-amb-errors {
    border-left: 3px solid var(--bs-danger);
    padding-left: 0.35rem;
    background: rgba(220, 53, 69, 0.06);
}

.graella-horaria td.cell-drop-actiu {
    background: #e7f1ff;
    outline: 3px dashed rgba(13, 110, 253, 0.55);
    outline-offset: -3px;
}

.graella-horaria td.cell-drop-actiu.cell-drop-copia {
    background: #e8f7ee;
    outline-color: rgba(25, 135, 84, 0.55);
}

.graella-horaria td[data-create-url] {
    cursor: pointer;
}

.graella-horaria td[data-create-url]:hover,
.graella-horaria td[data-create-url]:focus-visible {
    background: #f1f3f5;
    outline: 2px dashed rgba(13, 110, 253, 0.35);
    outline-offset: -2px;
}

.graella-horaria td.cell-sessio[data-create-url]:hover {
    background: #fff7f2;
    outline: none;
}

.graella-horaria td.cell-sessio[data-create-url]:focus-visible {
    background: #fff7f2;
}

.form-grid .form-label {
    margin-bottom: 0.25rem;
}

.form-grid .mb-2 {
    margin-bottom: 0.25rem !important;
}

.fila-destacada {
    background: #fff3cd !important;
    transition: background 0.3s ease;
}

.fila-destacada > td,
.fila-destacada > th {
    background-color: #fff3cd !important;
}
