@import url('https://fonts.googleapis.com/css2?family=Langar&display=swap');

/* ── Site Header ─────────────────────────────────────────────────────────── */
.site-header {
    /* bleed past body's padding to reach page edges */
    margin: -1.25rem -1rem 1.25rem;
    padding: 0.65rem 1rem;
    background: #004d38;
    border-bottom: 3px solid #ffdf00;
}

.header-inner {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo {
    font-family: 'Langar', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffdf00;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

.header-search {
    flex: 1;
    min-width: 0;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

#search-input {
    width: 100%;
    padding: 0.4rem 0.7rem;
    border: none;
    border-radius: 6px;
    font-size: 0.92rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    outline: none;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

#search-input:focus {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 2px #ffdf00;
}

.search-location-hint {
    /* Hidden on desktop — shown in mobile row 1 via media query below */
    display: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.78rem;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

.hint--hidden {
    display: none !important;
}

.location-pin-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0 0.1rem;
    flex-shrink: 0;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.location-pin-btn:hover {
    opacity: 1;
}


/* ── Mobile header: 2-row layout ─────────────────────────────────────────── */
@media (max-width: 600px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    /* Row 1: logo | hint (fills middle) | pin | hamburger */
    .header-logo {
        flex-shrink: 0;
    }

    .search-location-hint {
        display: block;
        flex: 1;
        align-self: center;
        min-width: 0;
        text-align: right;
    }

    /* Row 2: search bar spans full width */
    .header-search {
        order: 10;
        flex: 0 0 100%;
    }

}

@media (max-width: 400px) {
    .header-logo {
        font-size: 1.4rem;
    }
    #search-input,
    #sort-select {
        font-size: 0.82rem;
    }
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Calibri', sans-serif;
    margin: 0;
    padding: 1.25rem 1rem;
    background: #00563F;
    color: #222;
}

h1 {
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 1.25rem;
    color: #1a3d1a;
    letter-spacing: 0.02em;
}

.empty {
    text-align: center;
    color: #666;
    margin-top: 2rem;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 680px;
    margin: 0 auto;
}

.event-card {
    background: #fff;
    border-radius: 10px;
    padding: 0.85rem 1.1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #ffdf00;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 7rem;
    gap: 0;
    position: relative;
    /* link reset */
    color: inherit;
    text-decoration: none;
}

a.event-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    background: #f5faf5;
    cursor: pointer;
}

a.event-card:active {
    background: #eaf3ea;
}

/* ── Top row: name (left) + source (right) ── */
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.event-name {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.1;
    color: #00563F;
}


.card-fetched-block {
    flex-shrink: 0;
    text-align: right;
    line-height: 1.1;
}

.event-fetched,
.event-source {
    color: #888;
    font-size: 0.68rem;
    font-style: italic;
}

/* ── Bottom row: datetime (left) + venue/location (right) ── */
.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.5rem;
}

.event-datetime {
    font-size: 1.05rem;
    font-weight: 700;
    color: #00563F;
    line-height: 1.3;
    flex-shrink: 0;
    text-align: right;
}

.event-location {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.1;
}

.event-venue {
    font-weight: 600;
}

.event-place {
    color: #777;
}

/* ── Header menu ─────────────────────────────────────────────────────────── */
.header-menu {
    position: relative;
    flex-shrink: 0;
}

.menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.menu-btn span {
    display: block;
    height: 2px;
    width: 100%;
    background: #ffdf00;
    border-radius: 2px;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    background: #004d38;
    border: 1px solid rgba(255, 223, 0, 0.3);
    border-radius: 8px;
    min-width: 160px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 100;
    overflow: hidden;
}

.menu-dropdown.is-open {
    display: block;
}

.menu-item {
    display: block;
    padding: 0.75rem 1.1rem;
    color: #fff;
    text-decoration: none;
    font-size: 0.92rem;
}

.menu-item:hover {
    background: rgba(255, 223, 0, 0.12);
    color: #ffdf00;
}

/* ── Location modal ──────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem 1.75rem;
    width: min(400px, calc(100vw - 2rem));
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-box h3 {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
    color: #004d38;
}

.city-input-wrapper {
    position: relative;
}

.modal-box #city-input {
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #222;
    outline: none;
    box-sizing: border-box;
}

.modal-box #city-input:focus {
    border-color: #004d38;
    box-shadow: 0 0 0 2px rgba(0, 77, 56, 0.2);
}

#city-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
}

#city-suggestions[hidden] {
    display: none;
}

.city-suggestion-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: #222;
    cursor: pointer;
}

.city-suggestion-item:hover,
.city-suggestion-item.is-active {
    background: #f0f7f4;
    color: #004d38;
}

.modal-buttons {
    display: flex;
    gap: 0.6rem;
}

.modal-buttons button {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    border: none;
}

#city-search-btn {
    background: #004d38;
    color: #ffdf00;
    font-weight: 700;
}

#city-search-btn:hover {
    background: #006649;
}

#gps-btn {
    background: transparent;
    color: #004d38;
    border: 1px solid #004d38 !important;
}

#gps-btn:hover {
    background: rgba(0, 77, 56, 0.07);
}

#modal-status {
    margin: 0;
    font-size: 0.82rem;
    color: #c0392b;
    min-height: 1.1em;
}

.modal-close {
    position: absolute;
    top: 0.65rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1rem;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.4rem;
}

.modal-close:hover {
    color: #333;
}

/* ── Load more button ────────────────────────────────────────────────────── */
#load-more-container {
    max-width: 680px;
    margin: 1rem auto 2rem;
    text-align: center;
}

.load-more-btn {
    background: transparent;
    color: #ffdf00;
    border: 2px solid #ffdf00;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-size: 0.92rem;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.02em;
}

.load-more-btn:hover {
    background: #ffdf00;
    color: #00563F;
}

/* ── Flag button + popup (desktop only) ──────────────────────────────────── */
@media (min-width: 601px) {
    .flag-btn {
        position: absolute;
        top: 6px;
        right: 8px;
        background: #004d38;
        color: #ffdf00;
        border: none;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
        font-weight: 700;
        line-height: 18px;
        text-align: center;
        cursor: pointer;
        opacity: 0;
        transition: opacity 0.15s;
        padding: 0;
        z-index: 10;
    }

    .event-card:hover .flag-btn {
        opacity: 0.7;
    }

    .flag-btn:hover {
        opacity: 1 !important;
    }

    .flag-popup {
        /* position/top/right set by JS via getBoundingClientRect */
        background: #fff;
        border: 1px solid #d0d0d0;
        border-radius: 8px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
        padding: 0.75rem 1rem;
        min-width: 220px;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .flag-popup-title {
        font-size: 0.78rem;
        font-weight: 700;
        color: #333;
        margin-bottom: 0.25rem;
    }

    .flag-popup-label {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        font-size: 0.78rem;
        color: #444;
        cursor: pointer;
    }

    .flag-popup-label input[type="checkbox"] {
        accent-color: #004d38;
        cursor: pointer;
    }

    .flag-submit-btn {
        margin-top: 0.4rem;
        background: #004d38;
        color: #ffdf00;
        border: none;
        border-radius: 5px;
        padding: 0.35rem 0.8rem;
        font-size: 0.78rem;
        font-family: inherit;
        font-weight: 700;
        cursor: pointer;
        align-self: flex-end;
    }

    .flag-submit-btn:hover {
        background: #006649;
    }

    .flag-submit-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    .flag-thanks {
        font-size: 0.8rem;
        color: #004d38;
        font-weight: 600;
        padding: 0.25rem 0;
    }

    .flag-correction-input {
        width: 100%;
        box-sizing: border-box;
        border: 1px solid #ccc;
        border-radius: 4px;
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
        font-family: inherit;
        margin-top: 0.15rem;
        margin-bottom: 0.2rem;
        color: #333;
    }

    .flag-correction-input:focus {
        outline: none;
        border-color: #004d38;
    }
}

/* ── Floating "Submit a flyer!" button ───────────────────────────────────── */
.flyer-btn {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 28px;
    border-radius: 999px;
    background: #004d38;
    color: #ffdf00;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    transition: background 0.15s;
}

.flyer-btn:hover {
    background: #006b50;
}

.flyer-btn__icon {
    width: 22px;
    height: 22px;
    stroke: #ffdf00;
    fill: none;
    flex-shrink: 0;
}

/* ── Mobile card font overrides (must be at end to win the cascade) ───────── */
@media (max-width: 600px) {
    .event-name {
        font-size: 0.88rem;
    }

    .event-datetime {
        font-size: 0.68rem;
    }

    .event-location {
        font-size: 0.72rem;
    }

    .event-fetched,
    .event-source {
        font-size: 0.6rem;
    }
}

