/* MyChess Events Directory — global and single-event maps */

.mced-map-directory,
.mced-single-event-map,
.mced-map-directory * ,
.mced-single-event-map * {
    box-sizing: border-box;
}

.mced-map-directory {
    margin-left: calc(50% - 50vw);
    width: 100vw;
}

.mced-map-stage {
    background: #d9edf2;
    height: var(--mced-map-height, clamp(560px, 72vh, 880px));
    min-height: 560px;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.mced-map-canvas {
    height: 100%;
    min-height: 100%;
    width: 100%;
}

.mced-map-toolbar {
    background: #000000 !important;
    border: 1px solid rgba(255, 255, 255, .10) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .28) !important;
    left: 0;
    right: 0;
    margin: 0 auto !important;
    max-width: 1280px;
    overflow: visible !important;
    padding: 14px 16px !important;
    position: absolute !important;
    top: 16px;
    transform: none;
    width: calc(100% - 250px);
    z-index: 40 !important;
}

.mced-map-toolbar .mced-filter-toolbar__main {
    gap: 12px;
}

.mced-map-toolbar .mced-filter-toolbar__left {
    flex-wrap: nowrap;
    min-width: 0;
}

.mced-map-toolbar .mced-filter-toolbar__label {
    flex: 0 0 auto;
}

.mced-map-toolbar button,
.mced-map-toolbar input,
.mced-map-toolbar select {
    font-family: inherit !important;
}

.mced-map-toolbar .mced-format-pill {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: rgba(255, 255, 255, .09) !important;
    border: 1px solid rgba(255, 255, 255, .18) !important;
    box-shadow: none !important;
    color: #ffffff !important;
    line-height: 1 !important;
    margin: 0 !important;
    min-width: auto !important;
    text-transform: none !important;
}

.mced-map-toolbar .mced-format-pill:hover,
.mced-map-toolbar .mced-format-pill:focus-visible {
    background: rgba(255, 255, 255, .15) !important;
    border-color: rgba(255, 255, 255, .34) !important;
}

.mced-map-toolbar .mced-format-pill:not(.is-active) {
    opacity: .42;
}

.mced-map-toolbar .mced-format-pill.is-active {
    opacity: 1;
}

.mced-map-toolbar .mced-filter-date-group {
    flex: 0 0 auto;
}

.mced-map-toolbar .mced-filter-date-field {
    background: rgba(255, 255, 255, .09) !important;
    border-color: rgba(255, 255, 255, .18) !important;
}

.mced-map-toolbar .mced-filter-date-field.is-open {
    background: rgba(255, 255, 255, .15) !important;
    border-color: rgba(255, 255, 255, .38) !important;
}

.mced-map-toolbar .mced-date-trigger {
    width: 112px;
}

.mced-map-toolbar .mced-filter-toolbar__right {
    flex-wrap: nowrap;
    gap: 12px;
}

.mced-map-toolbar .mced-filter-toolbar__count {
    font-size: 13px;
    white-space: nowrap;
}

.mced-map-toolbar .mced-map-reset {
    background: var(--mced-gold, #c99a4b) !important;
    border: 0 !important;
    color: #111111 !important;
    min-width: 68px;
    text-transform: none !important;
}

.mced-map-toolbar .mced-map-reset:hover,
.mced-map-toolbar .mced-map-reset:focus-visible {
    background: #d8aa60 !important;
    color: #111111 !important;
}

.mced-map-status,
.mced-map-empty {
    align-items: center;
    background: rgba(0, 0, 0, .82);
    border-radius: 12px;
    color: #ffffff;
    display: flex;
    font-size: 14px;
    font-weight: 750;
    gap: 10px;
    left: 50%;
    max-width: calc(100% - 32px);
    padding: 12px 16px;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 35;
}

.mced-map-status[hidden],
.mced-map-empty[hidden] {
    display: none !important;
}

.mced-map-spinner {
    animation: mced-map-spin .8s linear infinite;
    border: 2px solid rgba(255, 255, 255, .32);
    border-radius: 50%;
    border-top-color: #ffffff;
    height: 18px;
    width: 18px;
}

@keyframes mced-map-spin {
    to { transform: rotate(360deg); }
}

.mced-map-notice {
    background: #fff8e8;
    border: 1px solid #e7c781;
    border-radius: 10px;
    color: #563b0f;
    margin: 18px 0;
    padding: 14px 16px;
}

.mced-map-notice a {
    color: #7a4f00;
    font-weight: 800;
}

/* Google InfoWindow content */
.mced-map-info {
    color: #202532;
    font-family: inherit;
    max-width: 300px;
    min-width: 245px;
    padding: 2px 2px 4px;
}

.mced-map-info__image-link {
    display: block;
    margin: 0 0 9px;
}

.mced-map-info__image {
    aspect-ratio: 16 / 8.5;
    border-radius: 8px;
    display: block;
    object-fit: cover;
    width: 100%;
}

.mced-map-info__title {
    color: #101522;
    font-size: 16px;
    font-weight: 850;
    line-height: 1.25;
    margin: 0 0 7px;
}

.mced-map-info__title a {
    color: inherit !important;
    text-decoration: none !important;
}

.mced-map-info__meta {
    color: #60697a;
    font-size: 12.5px;
    line-height: 1.42;
    margin-top: 4px;
}

.mced-map-info__formats {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 9px;
}

.mced-map-info__badge {
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 850;
    line-height: 1;
    padding: 5px 8px;
    text-transform: uppercase;
}

.mced-map-info__badge--classical { color: #a56800; background: #fff4d6; }
.mced-map-info__badge--rapid { color: #4545d2; background: #eff0ff; }
.mced-map-info__badge--blitz { color: #d82938; background: #fff0f2; }

.mced-map-info__button {
    align-items: center;
    background: #c99a4b;
    border-radius: 8px;
    color: #111111 !important;
    display: inline-flex;
    font-size: 12px;
    font-weight: 850;
    justify-content: center;
    margin-top: 10px;
    min-height: 34px;
    padding: 7px 11px;
    text-decoration: none !important;
}

.mced-map-cluster-list {
    max-height: 310px;
    min-width: 270px;
    overflow-y: auto;
    padding-right: 4px;
}

.mced-map-cluster-list__title {
    color: #111827;
    font-size: 15px;
    font-weight: 850;
    margin-bottom: 7px;
}

.mced-map-cluster-list__item {
    border-top: 1px solid #eceef2;
    display: block;
    padding: 8px 2px;
}

.mced-map-cluster-list__item:first-of-type {
    border-top: 0;
}

.mced-map-cluster-list__item a {
    color: #19213a !important;
    font-size: 12.5px;
    font-weight: 780;
    line-height: 1.3;
    text-decoration: none !important;
}

.mced-map-cluster-list__date {
    color: #747d8c;
    font-size: 11px;
    margin-top: 2px;
}

/* Single tournament map */
.mced-single-event-map {
    border: 1px solid #e3e5e8;
    border-radius: 14px;
    height: var(--mced-single-map-height, 500px);
    margin: 24px 0;
    min-height: 320px;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.mced-single-event-map .mced-map-canvas {
    height: 100%;
    min-height: 100%;
}

/* Calendar stays above the Google Maps canvas and controls. */
.mced-map-directory .mced-calendar {
    z-index: 10020;
}

@media (max-width: 1180px) {
    .mced-map-toolbar {
        width: calc(100% - 64px);
    }

    .mced-map-toolbar .mced-filter-toolbar__label {
        display: none;
    }
}

@media (max-width: 980px) {
    .mced-map-stage {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .mced-map-toolbar {
        border-radius: 0 !important;
        left: auto;
        right: auto;
        margin: 0 !important;
        max-width: none;
        order: 0;
        position: relative !important;
        top: auto;
        transform: none;
        width: 100%;
    }

    .mced-map-toolbar .mced-filter-toolbar__main {
        align-items: stretch;
        flex-direction: column;
    }

    .mced-map-toolbar .mced-filter-toolbar__left,
    .mced-map-toolbar .mced-filter-toolbar__right {
        justify-content: center;
        width: 100%;
    }

    .mced-map-toolbar .mced-filter-toolbar__left {
        flex-wrap: wrap;
    }

    .mced-map-directory .mced-map-canvas {
        flex: 0 0 auto;
        height: var(--mced-map-height, 680px);
        min-height: 520px;
        order: 1;
    }
}

@media (max-width: 767px) {
    .mced-map-directory {
        margin-left: calc(50% - 50vw);
    }

    .mced-map-toolbar {
        padding: 12px !important;
    }

    .mced-map-toolbar .mced-filter-toolbar__left {
        display: grid;
        gap: 8px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mced-map-toolbar .mced-format-pill {
        justify-content: center;
        min-width: 0 !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .mced-map-toolbar .mced-filter-date-group {
        grid-column: 1 / -1;
        margin-left: 0;
        width: 100%;
    }

    .mced-map-toolbar .mced-filter-date-field {
        flex: 1 1 50%;
        min-width: 0;
    }

    .mced-map-toolbar .mced-date-trigger {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    .mced-map-toolbar .mced-filter-toolbar__right {
        justify-content: space-between;
    }

    .mced-map-toolbar .mced-filter-toolbar__count {
        margin-right: auto;
    }

    .mced-map-directory .mced-map-canvas {
        height: min(70vh, 680px);
        min-height: 500px;
    }

    .mced-single-event-map {
        height: 360px;
        margin: 18px 0;
    }
}

@media (max-width: 460px) {
    .mced-map-toolbar .mced-filter-toolbar__left {
        grid-template-columns: 1fr;
    }

    .mced-map-toolbar .mced-format-pill {
        width: 100%;
    }

    .mced-map-toolbar .mced-filter-date-group {
        flex-direction: column;
    }

    .mced-map-toolbar .mced-filter-date-field {
        width: 100%;
    }

    .mced-map-toolbar .mced-filter-toolbar__right {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .mced-map-toolbar .mced-filter-toolbar__count {
        grid-column: 1 / -1;
        text-align: center;
    }
}

/* Version 0.13.5 — centered toolbar with Astra-safe sticky offset. */
.mced-map-toolbar .mced-format-pill {
    border-radius: 999px !important;
    min-height: 42px !important;
    padding: 9px 15px !important;
}

.mced-format-pill--other .mced-format-pill__dot {
    background: #9a7b55;
}

.mced-map-info__badge--other {
    background: #f5f0e9;
    color: #765b38;
}

/* CSS sticky is unreliable inside several Astra/Elementor/Google Maps wrappers.
   Desktop therefore uses a JS-controlled fixed state while the map is visible. */
@media (min-width: 981px) {
    .mced-map-stage {
        overflow: visible;
    }

    .mced-map-directory .mced-map-canvas {
        height: 100%;
        min-height: 100%;
        overflow: hidden;
    }

    .mced-map-toolbar {
        left: 0 !important;
        right: 0 !important;
        margin: 0 auto !important;
        position: absolute !important;
        top: 16px !important;
        transform: none !important;
        width: min(1280px, calc(100% - 250px));
    }

    .mced-map-toolbar.is-affixed {
        left: var(--mced-map-affixed-left, 50vw) !important;
        right: auto !important;
        margin: 0 !important;
        max-width: none !important;
        position: fixed !important;
        top: max(var(--mced-map-sticky-top, 96px), 96px) !important;
        transform: translateX(-50%) !important;
        width: var(--mced-map-affixed-width, min(1280px, calc(100vw - 250px))) !important;
        z-index: 10010 !important;
    }


    /* Logged-in WordPress adds a 32px admin bar above the sticky Astra menu.
       Keep a hard minimum even before Astra finishes adding its sticky classes. */
    body.admin-bar .mced-map-toolbar.is-affixed {
        top: max(var(--mced-map-sticky-top, 128px), 128px) !important;
    }
}

/* Tablet/mobile remains in document flow and uses native sticky positioning. */
@media (max-width: 980px) {
    .mced-map-stage {
        overflow: visible;
    }

    .mced-map-toolbar {
        left: auto !important;
        right: auto !important;
        margin: 0 !important;
        position: sticky !important;
        top: max(var(--mced-map-sticky-top, 96px), 96px) !important;
        transform: none !important;
        width: 100% !important;
        z-index: 10010 !important;
    }
}

@media (max-width: 767px) {
    .mced-map-toolbar .mced-filter-toolbar__left {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mced-map-toolbar .mced-format-pill {
        width: 100%;
    }
}

@media (max-width: 460px) {
    .mced-map-toolbar .mced-filter-toolbar__left {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

