@page {
    size: A4 landscape;
    margin: 20mm;
}

* {
    box-sizing: border-box
}

body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    color: #172044;
    background: #f8f8f8
}

.page {
    page-break-after: always;
    /* min-height: 277mm; */
    position: relative
}

.page:last-child {
    page-break-after: auto
}

h1 {
    font-size: 25px;
    margin: 0 0 3px;
    text-align: center
}

.subtitle {
    text-align: center;
    font-size: 12px;
    color: #555;
    margin-bottom: 7px
}

.legend {
    display: flex;
    justify-content: center;
    gap: 18px;
    font-size: 11px;
    margin: 5px 0 8px
}

.dot {
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px
}

.dot.blue {
    background: #cfe3fd
}

.dot.yellow {
    background: #fff2b3
}

.dot.pink {
    background: #e6d2ff
}

.dot.green {
    background: #e1fce7
}

.matches {
    display: flex;
    flex-direction: column;
    gap: 2px
}

.match {
    display: grid;
    grid-template-columns: 55px 55px 1.35fr 1.15fr 30px;
    align-items: center;
    border-radius: 6px;
    padding: 3px 6px;
    min-height: 34px;
    border: 1px solid #ddd
}

.match.injury-marked {
    grid-template-columns: 55px 55px 1.35fr 1.15fr 22px 30px;
}

.match.aran {
    background: #fff8cf
}

.match.biel {
    background: #d6e7fc
}

.match.silvia {
    background: #e6d2ff
}

.match.pol {
    background: #f1fff5
}

.date {
    text-align: center;
    font-size: 10px;
    line-height: 1.05
}

.date span {
    font-size: 12px
}

.date-change,
.time-change {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.date-change del,
.time-change del {
    color: #777;
    font-size: 9px;
    font-weight: normal;
    line-height: 1;
}

.date-change .current-date span {
    font-size: 12px;
}

.date-change .current-date,
.time-change > span {
    color: #c62828;
    font-weight: bold;
}

.time {
    font-size: 14px;
    font-weight: bold;
    text-align: center
}

.teams {
    display: grid;
    grid-template-columns: 1fr 72px 1fr;
    align-items: center;
    gap: 3px
}

.team {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: normal
}

.team.featured span {
    font-weight: bold
}

.team:first-child {
    justify-content: flex-end;
    text-align: right
}

.team:first-child img {
    order: 2
}

.team:first-child span {
    order: 1
}

.team:last-child {
    justify-content: flex-start
}

.team img {
    width: 27px;
    height: 27px;
    object-fit: contain;
    flex: 0 0 27px
}

.vs {
    text-align: center;
    font-weight: bold;
    color: #777;
    /* border-bottom: 1px solid #888; */
    min-height: 16px;
    /* line-height: 14px; */
    margin: 0 10px
}

.match.suspended,
.event.suspended {
    border-left: 4px solid #b7791f;
    background: #fff4dc;
}

.match.suspended .vs,
.vs.suspended {
    color: #8a5a00;
    background: #ffe7a8;
    border-radius: 10px;
    font-size: 9px;
    letter-spacing: 0.02em;
    text-transform: none;
    padding: 2px 6px;
    line-height: 1.4;
}

.match.won {
    border-left: 4px solid #24834a
}

.match.won .vs {
    color: #176536;
    background: #d9f0df;
    border-radius: 10px;
}

.match.draw {
    border-left: 4px solid #b78316
}

.match.draw .vs {
    color: #805b0b;
    background: #fff0c2;
    border-radius: 10px;
}

.match.lost {
    border-left: 4px solid #bd4141
}

.match.lost .vs {
    color: #963232;
    background: #f8dede;
    border-radius: 10px;
}

.place {
    font-size: 9.5px;
    line-height: 1.15;
    color: #333
}

.place b {
    font-size: 10px
}

.map-link {
    color: inherit;
    text-decoration: none;
}

.place:hover .map-link,
.map-link:focus-visible {
    color: #24a89f;
}

.map-dialog {
    width: min(900px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 32px));
    max-width: none;
    max-height: none;
    padding: 0;
    border: 1px solid #cbd3d4;
    border-radius: 8px;
    overflow: hidden;
}

.map-dialog::backdrop {
    background: rgb(16 28 32 / 55%);
}

.map-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    background: #f6f8f7;
    border-bottom: 1px solid #dce2e0;
}

.map-dialog-header h2 {
    margin: 0;
    font-size: 16px;
}

.map-dialog-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #263633;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.map-dialog-close:hover {
    background: #e5eae8;
}

.map-dialog iframe {
    display: block;
    width: 100%;
    height: calc(100% - 53px);
    border: 0;
}

@media print {
    .map-dialog {
        display: none;
    }
}

.j {
    font-size: 10px;
    text-align: center;
    font-weight: bold;
    color: #777
}

.injury-indicator {
    color: #b42318;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    text-align: center;
}

.event {
    display: grid;
    grid-template-columns: 55px 1fr;
    gap: 8px;
    align-items: center;
    border: 1px dashed #aaa;
    border-radius: 5px;
    padding: 4px 7px;
    margin: 2px 0;
    background: #f7f7f7
}

.event.cau-record {
    grid-template-columns: 55px 55px minmax(0, 1fr) 55px 55px;
}

.cau-record .cau-description {
    text-align: center;
}

.cau-record .vs.suspended {
    display: inline-block;
    margin: 0 6px;
    vertical-align: middle;
}

.event b {
    font-size: 10.5px
}

.event small {
    display: block;
    font-size: 8.5px;
    color: #666;
    margin-top: 1px
}

.section-title {
    font-size: 13px;
    margin: 7px 0 4px;
    border-bottom: 2px solid #222;
    padding-bottom: 2px
}

.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

.note {
    font-size: 8px;
    color: #666;
    margin-top: 5px
}

.footer {
    position: static;
    margin: 0 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    font-size: 9px;
    color: #777;
    padding: 12px 0 8px
}

.footer a {
    color: inherit
}

.footer span:last-child {
    text-align: right
}

@media print {
    .page {
        min-height: auto
    }
}

.event {
    min-height: 30px
}

.event.holiday {
    background: #d7f3cb
}

.event.holiday b {
    font-weight: 700
}

.event.holiday small {
    font-size: 8.5px
}

.calendar-page {
    display: none;
}

.calendar-page.active {
    display: block;
    margin: 20px 20px;
    background: #f8f8f8;
}


/* TABS */

.tabs {
    display: flex;
    gap: 8px;
    margin: 0 20px 0 0;
}

.tab {
    border: none;
    background: #eee;
    padding: 10px 18px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font: inherit;
}

.tab:hover {
    background: #ddd;
}

.tab.active {
    background: #333;
    color: white;
    font-weight: bold;
}

.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 20px;
    margin: 20px;
}

.tabs {
    display: flex;
    gap: 8px;
}

.holiday-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
}

.holiday-toggle input {
    cursor: pointer;
}

/* Quan els festius estan amagats */
.hide-holidays .holiday {
    display: none !important;
}

.calendar-header {
    position: sticky;
    top: 0;
    z-index: 1000;

    background: white;

    padding: 10px 0;

    border-bottom: 1px solid #ddd;
}

.federacio-links {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 12px 0 18px;
    flex-wrap: wrap;
}

.federacio-links a {
    text-decoration: none;
    background: white;
    color: #333;
    border: 1px solid #ddd;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s;
}

.federacio-links a:hover {
    background: #eee;
    border-color: #bbb;
}

.league-progress {
    flex: 1;
    min-width: 180px;
}

.progress-line {
    height: 4px;
    background: #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    background: var(--league-color);
    height: 100%;
    width: 0%;
    /* background: #555; */
    border-radius: 10px;
    transition: width 0.4s ease;
}

.progress-label {
    text-align: center;
    font-size: 11px;
    color: #777;
    margin-top: 4px;
}

.calendar-toggles {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-toggle {
    border: 1px solid #ddd;
    background: #f5f5f5;
    color: #555;
    padding: 7px 11px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font: inherit;
    font-size: 13px;
    transition: all 0.2s ease;
}

.calendar-toggle:hover {
    background: #e9e9e9;
}

.calendar-toggle.active {
    background: white;
    border-color: #aaa;
    color: #222;
}

.calendar-toggle:not(.active) {
    opacity: 0.55;
}

.toggle-icon {
    font-size: 16px;
    line-height: 1;
}

.hide-cau .cau {
    display: none !important;
}

.show-next-matches .matches > :not(.next-match) {
    display: none !important;
}

.pending-count {
    background: #ddd;
    color: #555;
    border-radius: 10px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: bold;
}

.pending-count:hover {
    font-weight: lighter;
}
