*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: sans-serif;
    background-color: #f0f2f5;
    color: #333;
}

/* ─── TOP BAR 1: Location + Auth ─────────────────────────────── */
.topbar-main {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: #1e3a8a;
    color: #fff;
    padding: 0 24px;
    height: 52px;
    flex-shrink: 0;
}

.topbar-main .brand {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    margin-right: 8px;
}

.topbar-main .location-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.topbar-main .location-area input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    width: 220px;
}

.topbar-main .location-area input::placeholder {
    color: #7a8a9e;
}

.topbar-main .location-area #locate-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.topbar-main .location-area #locate-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.topbar-main .location-area #radius-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
}

/* dropdown options render on a white menu, so give them dark text */
.topbar-main .location-area #radius-select option {
    color: #222;
}

.topbar-main .auth-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-main .auth-section .username {
    color: #a8c8f0;
    font-size: 13px;
    margin-right: 4px;
}

.topbar-main .auth-section a,
.topbar-main .auth-section button {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.15s;
}

.topbar-main .auth-section a:hover,
.topbar-main .auth-section button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ─── TOP BAR 2: Categories ───────────────────────────────────── */
.topbar-categories {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #cfe2ff;
    border-bottom: 1px solid #a9c9f5;
    padding: 0 24px;
    height: 44px;
    overflow-x: auto;
    flex-shrink: 0;
}

.topbar-categories::-webkit-scrollbar {
    height: 3px;
}

.topbar-categories::-webkit-scrollbar-thumb {
    background: #c0c8d8;
    border-radius: 2px;
}

.cat-bubble {
    display: inline-block;
    padding: 5px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--cat-color, #607d8b);
    background: var(--cat-color, #607d8b);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: all 0.15s;
    flex-shrink: 0;
    opacity: 0.5;            /* unselected = dimmed */
}

.cat-bubble:hover:not(.active) {
    opacity: 0.8;
}

.cat-bubble.active {
    opacity: 1;             /* selected = full colour */
    font-weight: 600;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

/* The focused main (whose subcategories are shown) gets a dark ring. */
.cat-bubble.focused {
    outline: 2px solid #1a2940;
    outline-offset: 1px;
}

/* ─── TOP BAR 3: Subcategories ────────────────────────────────── */
.topbar-subcategories {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #e3eefb;          /* a touch lighter than the main bar */
    border-bottom: 1px solid #c3d9f5;
    padding: 0 24px;
    height: 42px;
    overflow-x: auto;
    flex-shrink: 0;
}

.topbar-subcategories::-webkit-scrollbar { height: 3px; }
.topbar-subcategories::-webkit-scrollbar-thumb { background: #c0c8d8; border-radius: 2px; }

.sub-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-bubble {
    font-size: 12px;
    padding: 4px 14px;
}

/* ─── GEO FEEDBACK LABEL ──────────────────────────────────────── */
.geo-feedback {
    background-color: #eaf2ff;
    border-bottom: 1px solid #cfe2ff;
    color: #1e3a8a;
    font-size: 13px;
    padding: 7px 24px;
}

/* ─── CALENDAR AREA ───────────────────────────────────────────── */
.calendar-wrapper {
    padding: 16px 24px;
    height: calc(100vh - 52px - 44px);
}

#calendar {
    height: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 16px;
}

/* ─── OTHER PAGES (login, signup, forms, event detail) ────────── */
.page-container {
    max-width: 520px;
    margin: 40px auto;
    padding: 32px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.page-container h1 {
    color: #1a2940;
    margin-bottom: 20px;
    font-size: 22px;
}

.page-container p,
.page-container li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.page-container a {
    color: #005a9c;
}

/* keep logout as a plain link in auth section */
.link-button {
    background: none;
    border: none;
    color: #005a9c;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
}

/* ─── AUTH FORMS (login / signup / password reset) ────────────── */
.auth-form p {
    margin-bottom: 14px;
}

.auth-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #445;
    margin-bottom: 4px;
}

.auth-form input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #c0c8d8;
    border-radius: 6px;
    font-size: 14px;
}

.auth-form input:focus {
    outline: none;
    border-color: #1e3a8a;
    box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.15);
}

/* Django renders field help text and errors in these */
.auth-form .helptext {
    display: block;
    font-size: 11px;
    color: #889;
    font-weight: 400;
    margin-top: 4px;
}

.auth-form ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 0 0 6px 0;
    color: #c92006;
    font-size: 12px;
}

.primary-button {
    width: 100%;
    background: #1e3a8a;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 11px;
    font-size: 15px;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.15s;
}

.primary-button:hover {
    background: #162d6e;
}

.auth-alt {
    margin-top: 14px;
    font-size: 13px;
    text-align: center;
}

/* ─── WIDER CONTAINER (event form + detail) ───────────────────── */
.page-wide {
    max-width: 720px;
}

/* ─── EVENT FORM ──────────────────────────────────────────────── */
.event-form fieldset {
    border: 1px solid #dde3ee;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 18px;
}

.event-form legend {
    font-weight: 700;
    color: #1e3a8a;
    padding: 0 8px;
    font-size: 15px;
}

.optional-tag {
    font-weight: 400;
    font-size: 11px;
    color: #889;
    background: #f0f2f5;
    border-radius: 10px;
    padding: 2px 8px;
    margin-left: 6px;
}

.form-field {
    margin-bottom: 12px;
}

.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #445;
    margin-bottom: 4px;
}

.form-field input:not([type="checkbox"]),
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #c0c8d8;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #1e3a8a;
    box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.15);
}

.form-field .helptext {
    display: block;
    font-size: 11px;
    color: #889;
    margin-top: 3px;
}

.field-errors {
    color: #c92006;
    font-size: 12px;
    margin-top: 4px;
}

/* lay several fields side by side */
.field-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.field-row .form-field {
    flex: 1;
    min-width: 120px;
}

.checkbox-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

/* ─── EVENT DETAIL ────────────────────────────────────────────── */
.event-cover {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 18px;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.event-header h1 {
    margin: 0;
}

.owner-actions {
    display: flex;
    gap: 12px;
    white-space: nowrap;
    font-size: 14px;
}

.danger-link {
    color: #c92006;
}

.key-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 16px 0;
    font-size: 14px;
    color: #334;
}

.age-badge {
    background: #c92006;
    color: #fff;
    border-radius: 6px;
    padding: 1px 8px;
    font-weight: 700;
    font-size: 13px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.chip {
    background: #eaf2ff;
    color: #1e3a8a;
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 13px;
}

.chip-audience {
    background: #f0e9ff;
    color: #5b2a86;
}

.pictograms {
    display: flex;
    gap: 14px;
    font-size: 26px;
    margin-bottom: 16px;
}

.picto {
    cursor: help;
}

.event-description {
    line-height: 1.6;
    margin-bottom: 18px;
    white-space: pre-wrap;
}

.good-to-know {
    background: #f7f9fc;
    border: 1px solid #e3e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 14px;
}

.good-to-know p {
    margin: 4px 0;
}

.button-link {
    display: inline-block;
    width: auto;
    text-decoration: none;
    padding: 11px 22px;
}

/* Keep primary-button links white even inside .page-container, which otherwise
   colors generic links blue (made dark-blue buttons' text invisible). */
.page-container a.primary-button {
    color: #fff;
}

.back-link {
    margin-top: 20px;
    font-size: 14px;
}

/* ─── LIKE BUTTON ─────────────────────────────────────────────── */
.like-area {
    margin: 12px 0;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #fff;
    border: 1.5px solid #dde3ee;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s;
}

.like-btn:hover {
    border-color: #c92006;
}

.like-btn.liked {
    background: #fff0ef;
    border-color: #c92006;
    color: #c92006;
    font-weight: 600;
}

.like-btn .heart {
    font-size: 16px;
    line-height: 1;
}

/* ─── PROFILE ─────────────────────────────────────────────────── */
.profile-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-header h1 {
    margin: 0;
}

.muted {
    color: #889;
    font-size: 13px;
}

.profile-private {
    background: #f7f9fc;
    border: 1px solid #e3e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 16px 0;
    font-size: 14px;
}

.profile-private p {
    margin: 4px 0;
}

.profile-private .button-link {
    margin-top: 10px;
}

.profile-events {
    list-style: none;
    padding: 0;
}

.profile-events li {
    padding: 10px 0;
    border-bottom: 1px solid #eef1f6;
}

.profile-events li a {
    color: #1e3a8a;
    font-weight: 600;
    text-decoration: none;
    margin-right: 8px;
}

/* ─── ROLLING 2-WEEK VIEW: force equal-height rows ──────────────── */
/* Target only the two week-level <tr> rows (direct children of the sync
   table's <tbody>), NOT the nested event rows inside each day cell.
   CSS !important beats FullCalendar's inline style="height:Xpx" so the
   lock holds through every re-render. Value comes from --rolling-row-h,
   set by JS after measuring natural heights. When the variable is unset it
   resolves to auto (row sizes naturally), which is the measure phase. */
.fc-rollingTwoWeeks-view .fc-scrollgrid-sync-table > tbody > tr {
    height: var(--rolling-row-h) !important;
}

.fc-dayGridMonth-view .fc-scrollgrid-sync-table > tbody > tr {
    height: var(--month-row-h) !important;
}
