:root {
    --brand: #ff7a45;
    --brand-dark: #d9531f;
    --ink: #1f2430;
    --muted: #6b7280;
    --bg: #fafafa;
    --card: #ffffff;
    --border: #e5e7eb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header { background: var(--card); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; flex: 0 0 auto; }
.header-inner nav { display: flex; gap: 16px; align-items: center; }

.button-link, button, .btn {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}
.button-link:hover, button:hover, .btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.link-button { background: none; border: none; color: var(--brand-dark); padding: 0; cursor: pointer; text-decoration: underline; }

main.container { padding: 32px 20px 64px; min-height: 60vh; }

h1 { font-size: 1.8rem; margin-bottom: 4px; }
.subtitle { color: var(--muted); margin-top: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.filters select, .filters input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; }
.city-links { margin: -12px 0 20px; color: var(--muted); font-size: 0.9rem; }
.city-links a { display: inline-block; margin-left: 6px; margin-bottom: 8px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--ink); }
.city-links a.active, .city-links a:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 24px; }
.badge { display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 999px; background: #fef3ec; color: var(--brand-dark); margin-right: 6px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 480px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem;
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.errors { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.errors ul { margin: 0; padding-left: 18px; }

table.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
table.admin-table th, table.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.9rem; }
table.admin-table th { background: #f9fafb; }

.inline-form { display: inline; }
.page-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.site-footer { border-top: 1px solid var(--border); background: var(--card); color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; padding: 32px 20px 16px; }
.footer-col p { margin: 0 0 8px; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.footer-brand img { width: 28px; height: 28px; }
.footer-heading { font-weight: 600; color: var(--ink); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; margin-bottom: 10px !important; }
.footer-bottom { border-top: 1px solid var(--border); padding: 12px 20px; font-size: 0.8rem; }
.footer-bottom p { margin: 0; }

/* /contact page */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 24px; max-width: 640px; }
.contact-card { max-width: none; text-align: center; }
.contact-card h3 { margin: 4px 0 8px; }
.contact-card p { margin: 0 0 6px; }
.contact-icon { font-size: 1.8rem; margin: 0; }
.empty-state { text-align: center; color: var(--muted); padding: 48px 0; }

/* Organizer line under event titles */
.card .organizer { margin: -4px 0 8px; color: var(--muted); }

/* Map picker (forms) and map view (event page) */
.help { color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
.map-toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.map-toolbar input { flex: 1; width: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; }
.map-toolbar .btn { padding: 8px 14px; white-space: nowrap; }
.map-picker { height: 320px; border: 1px solid var(--border); border-radius: 8px; background: #eef2f5; }
.map-view { height: 260px; border: 1px solid var(--border); border-radius: 8px; margin: 12px 0 6px; background: #eef2f5; }
.map-status { font-size: 0.82rem; color: var(--muted); margin-top: 6px; min-height: 1.2em; }
.map-status.error { color: #b91c1c; }
.map-links { font-size: 0.9rem; margin: 0 0 16px; }
.leaflet-container { font: inherit; }
@media (max-width: 600px) { .form-row { flex-direction: column; gap: 0; } .map-picker { height: 260px; } }

/* Admin notices (scraper status, pending migrations) */
.notice { background: #f0f9ff; border: 1px solid #bae6fd; color: #075985; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.notice.notice-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.notice code, .errors code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px; }


/* Header: let the nav wrap under the brand on phones instead of squashing it */
@media (max-width: 600px) {
    .header-inner { flex-wrap: wrap; gap: 8px 12px; padding: 12px 16px; }
    .header-inner nav { gap: 12px; font-size: 0.9rem; flex-wrap: wrap; }
    .header-inner .button-link { padding: 8px 12px; white-space: nowrap; }
}

/* "Date not decided yet" switch on event forms */
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.checkbox-label input { width: auto; margin: 0; }
#date-fields.is-disabled { opacity: 0.45; }
.muted { color: var(--muted); }

/* Contact form */
.contact-form-card { max-width: 640px; margin-top: 24px; }
.contact-form-card h2 { margin-top: 0; font-size: 1.3rem; }
.form-group textarea { font-family: inherit; line-height: 1.5; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.notice-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.errors a { color: #7f1d1d; font-weight: 600; }

/* Event count on the Browse-by-country shortcuts */
.city-links .count { display: inline-block; min-width: 1.4em; padding: 0 5px; margin-left: 2px; border-radius: 999px; background: #f3f4f6; color: var(--muted); font-size: 0.75rem; text-align: center; }
.city-links a.active .count, .city-links a:hover .count { background: rgba(255,255,255,0.25); color: #fff; }

/* ---------- Event cards (image-led) ---------- */
h1, h2, h3, .brand, .event-title { font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.event-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.event-card {
    display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 16px;
    overflow: hidden; color: var(--ink); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease;
}
.event-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(31, 36, 48, 0.10); }
.event-card-media { position: relative; aspect-ratio: 16 / 10; background: var(--cat-tint, #ffeadf); overflow: hidden; }
.event-card-media img, .gallery-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.event-card-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.8rem; opacity: 0.85; }
.date-badge {
    position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; align-items: center; min-width: 50px;
    padding: 5px 8px 6px; background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); line-height: 1.05;
}
.date-badge small { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); }
.date-badge b { font-size: 1.3rem; color: var(--ink); font-family: "Nunito", sans-serif; }
.date-badge-tba b { font-size: 0.95rem; padding-top: 2px; }
.distance-badge { position: absolute; top: 10px; right: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(31,36,48,0.78); color: #fff; font-size: 0.75rem; font-weight: 600; }
.event-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.event-card-body h3 { margin: 0; font-size: 1.08rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-chip { align-self: flex-start; display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--cat-tint, #ffeadf); color: var(--cat, var(--brand-dark)); font-size: 0.74rem; font-weight: 700; }
.event-facts { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.82rem; }
.event-facts span { padding: 2px 8px; border-radius: 6px; background: #f3f4f6; color: var(--ink); }
.is-free { color: #15803d !important; font-weight: 700; }
.event-facts .is-free { background: #dcfce7; }
.event-place { font-size: 0.85rem; color: var(--muted); }
.event-by { font-size: 0.82rem; color: var(--muted); margin-top: auto; }

/* ---------- Event page ---------- */
.back-link { display: inline-block; margin-bottom: 14px; }
.event-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.gallery { margin-bottom: 18px; }
.gallery-main { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: var(--cat-tint, #ffeadf); }
.gallery-main .event-card-icon { font-size: 4rem; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.gallery-thumb { flex: 0 0 auto; width: 84px; height: 60px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #eee; }
.gallery-thumb:hover { background: #eee; }
.gallery-thumb.is-active { border-color: var(--brand); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.event-title { font-size: 2rem; line-height: 1.2; margin: 8px 0 4px; }
.event-main .event-by { font-size: 0.95rem; margin: 0 0 8px; }
.event-section { margin-top: 26px; }
.event-section h2 { font-size: 1.2rem; margin: 0 0 10px; }
.event-section p { margin-top: 0; }
.event-facts-panel { position: sticky; top: 20px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: 0 6px 20px rgba(31, 36, 48, 0.06); }
.event-facts-panel dl { margin: 0 0 16px; }
.event-facts-panel dl > div { padding: 10px 0; border-bottom: 1px solid var(--border); }
.event-facts-panel dl > div:first-child { padding-top: 0; }
.event-facts-panel dt { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 2px; }
.event-facts-panel dd { margin: 0; font-weight: 600; }
.btn-block { display: block; width: 100%; text-align: center; padding: 13px 18px; font-size: 1.02rem; font-weight: 700; border-radius: 12px; }
.panel-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; font-size: 0.92rem; }
.source-note { margin-top: 28px; padding: 12px 14px; border-radius: 10px; background: #f9fafb; color: var(--muted); font-size: 0.85rem; }
.similar { margin-top: 48px; }
.similar h2 { font-size: 1.3rem; margin-bottom: 0; }
.mobile-register { display: none; }

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.video-card { display: block; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card); color: var(--ink); }
.video-card:hover { text-decoration: none; box-shadow: 0 6px 16px rgba(31,36,48,0.10); }
.video-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1f2430, #3b4252); }
.video-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,0.92); color: #e11d48; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; padding-left: 4px; box-shadow: 0 4px 14px rgba(0,0,0,0.3); }
.video-label { display: block; padding: 9px 12px; font-size: 0.88rem; font-weight: 600; }

@media (max-width: 860px) {
    .event-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .event-layout > *, .event-main > * { min-width: 0; }
    .event-facts-panel { position: static; order: -1; }
    .event-main { display: contents; }
    .gallery { order: -3; margin-bottom: 0; }
    .event-main > .cat-chip, .event-title, .event-main > .event-by { order: -2; }
    .event-main > .cat-chip { justify-self: start; }
    .event-title { font-size: 1.6rem; margin: 0; }
    .event-main > .event-by { margin: -12px 0 0; }
    .event-section { margin-top: 0; }
    .mobile-register { display: block; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,0.96); border-top: 1px solid var(--border); z-index: 1000; }
    body:has(.mobile-register) .site-footer { padding-bottom: 72px; }
}

/* ---------- Photos & videos on event forms ---------- */
.media-fields { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px 4px; margin: 0 0 16px; }
.media-fields legend { font-weight: 700; padding: 0 6px; }
.media-tiles, .media-previews { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.media-previews { margin: 10px 0 0; }
.media-tile { width: 132px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; font-size: 0.8rem; }
.media-tile img { display: block; width: 100%; height: 86px; object-fit: cover; background: #f3f4f6; }
.media-tile-option { display: flex !important; align-items: center; gap: 6px; padding: 4px 8px; margin: 0 !important; font-weight: 500 !important; font-size: 0.8rem !important; cursor: pointer; }
.media-tile-option input { width: auto !important; margin: 0; }
.media-remove { color: #b91c1c; }
.media-tile-note { display: block; padding: 4px 8px; color: var(--muted); font-size: 0.75rem; line-height: 1.3; }
.media-tile.is-hidden-plan img { opacity: 0.4; }
.media-preview { width: 84px; height: 64px; border-radius: 8px; overflow: hidden; background: #f3f4f6; border: 2px solid transparent; }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-preview.is-over { border-color: #ef4444; opacity: 0.5; }
.media-warning { margin: 8px 0 0; color: #b91c1c; font-size: 0.85rem; }
.media-link summary { cursor: pointer; color: var(--brand-dark); font-size: 0.9rem; margin-bottom: 8px; }
.video-input { margin-bottom: 8px; }
.premium-lock { padding: 12px 14px; border-radius: 10px; background: #fff8eb; border: 1px dashed #f5c06b; font-size: 0.9rem; }
.premium-lock p { margin: 0 0 8px; }
.plan-pill { display: inline-block; padding: 1px 9px; border-radius: 999px; background: #f3f4f6; color: var(--muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle; }
.plan-premium { background: linear-gradient(135deg, #fbbf24, #f97316); color: #fff; }
.plan-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 14px; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); font-size: 0.9rem; }
.plan-banner-premium { background: #fffbeb; border-color: #fde68a; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.plan-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.plan-form select, .plan-form input { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; }

/* ---------- Organizer team ---------- */
.signed-in-as { margin: 0 0 6px; color: var(--muted); font-size: 0.88rem; }
.team-table td { vertical-align: top; }
.team-table select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; }
.team-actions { white-space: nowrap; }
.team-actions form + form { margin-left: 10px; }
.role-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #f3f4f6; font-size: 0.8rem; font-weight: 600; }
.role-owner { background: #ffeadf; color: var(--brand-dark); }
.role-help { margin: 12px 0 20px; color: var(--muted); font-size: 0.88rem; }
.role-help p { margin: 2px 0; }
.team-invite { max-width: 640px; }
.team-invite h2 { margin-top: 0; font-size: 1.2rem; }
.invite-link-card { max-width: 640px; margin-bottom: 20px; border-color: #a7f3d0; background: #f0fdf4; }
.invite-link-card h3 { margin: 0 0 4px; }
.copy-row { display: flex; gap: 8px; margin: 8px 0 12px; }
.copy-row input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem; background: #fff; }
@media (max-width: 600px) { .team-table th:nth-child(3), .team-table td:nth-child(3) { display: none; } .team-actions { white-space: normal; } }
@media (max-width: 600px) {
    table.admin-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .map-toolbar { flex-wrap: wrap; }
    .map-toolbar input { flex: 1 1 100%; }
}

/* ---------- Homepage: choose a country first ---------- */
.country-picker { margin: 24px 0 8px; padding: 24px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
.country-picker h2 { margin: 0 0 4px; font-size: 1.35rem; }
.picker-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 4px; }
.locate-status { min-height: 1.2em; margin: 4px 0 10px; color: var(--muted); font-size: 0.9rem; }
.country-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 8px 0 20px; }
.country-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
.country-tile:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 6px 16px rgba(31,36,48,0.08); }
.country-flag { font-size: 1.6rem; line-height: 1; }
.country-name { font-weight: 700; margin-top: 4px; }
.country-count { font-size: 0.82rem; color: var(--muted); }
.other-country { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.other-country label { font-weight: 600; font-size: 0.9rem; }
.other-country select { padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; min-width: 220px; }
.where-bar { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: 20px 0 -8px; font-size: 1.02rem; }
.where-bar a { font-size: 0.9rem; }
.filters + .locate-status { margin-top: -14px; }
@media (max-width: 600px) { .country-tiles { grid-template-columns: 1fr 1fr; } .country-picker { padding: 18px; } }

@media (max-width: 600px) { .brand { font-size: 1.1rem; gap: 8px; } .brand img { width: 34px; height: 34px; } }
