/* ---------- Brand Guidelines ---------- */
:root {
    --chasse-teal: #2dc19f;
    --chasse-beige: #f0d3b1;
    --chasse-brown: #b28158;
    --chasse-teal-dark: #1f8f76;

    --font-title: 'Poppins', sans-serif;
    --bs-body-font-family: Calibri, Carlito, 'Segoe UI', sans-serif;

    /* Button colors (default: on a light background) */
    --btn-main: var(--chasse-teal-dark);
    --btn-on: var(--chasse-beige);
}

body {
    background-color: var(--chasse-teal);
}

/* ---------- Navbar ---------- */
.navbar.navbar-chasse {
    background-color: var(--chasse-teal-dark);
    color: var(--chasse-beige);
    --bs-navbar-color: var(--chasse-beige);
    --bs-navbar-brand-color: var(--chasse-beige);
    --bs-navbar-toggler-border-color: rgb(240 211 177 / 0.5);

    /* On the navbar, buttons invert their colors */
    --btn-main: var(--chasse-beige);
    --btn-on: var(--chasse-teal-dark);
}

.navbar-brand {
    font-family: var(--font-title), serif;
    font-weight: 500;
}

.navbar-chasse .dropdown-menu {
    --bs-dropdown-bg: var(--chasse-beige);
    --bs-dropdown-border-color: var(--chasse-beige);
    --bs-dropdown-link-color: var(--chasse-teal-dark);
    --bs-dropdown-link-hover-color: var(--chasse-beige);
    --bs-dropdown-link-hover-bg: var(--chasse-teal-dark);
    --bs-dropdown-link-active-color: var(--chasse-beige);
    --bs-dropdown-link-active-bg: var(--chasse-teal-dark);
    --bs-dropdown-divider-bg: var(--chasse-brown);
}

/* ---------- Buttons ---------- */
.btn-chasse,
.btn-chasse-outline {
    --bs-btn-font-family: var(--font-title);
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: 0.6rem;

    --bs-btn-color: var(--btn-on);
    --bs-btn-bg: var(--btn-main);
    --bs-btn-border-color: var(--btn-main);
    --bs-btn-hover-color: var(--btn-on);
    --bs-btn-hover-bg: color-mix(in srgb, var(--btn-main) 85%, black);
    --bs-btn-hover-border-color: var(--bs-btn-hover-bg);
    --bs-btn-active-color: var(--btn-on);
    --bs-btn-active-bg: color-mix(in srgb, var(--btn-main) 75%, black);
    --bs-btn-active-border-color: var(--bs-btn-active-bg);
}

/* The outline variant only changes what differs */
.btn-chasse-outline {
    --bs-btn-color: var(--btn-main);
    --bs-btn-bg: color-mix(in srgb, var(--btn-on) 75%, black);
    --bs-btn-border-color: var(--chasse-beige);
    --bs-btn-hover-color: var(--chasse-teal-dark);
    --bs-btn-hover-bg:  color-mix(in srgb, var(--btn-on) 85%, black);
    --bs-btn-hover-border-color: var(--chasse-beige);
    --bs-btn-active-color: var(--chasse-teal-dark);
    --bs-btn-active-bg: var(--chasse-beige);
    --bs-btn-active-border-color: var(--chasse-beige);
}

/* ---------- Home Page ---------- */
.hero-card {
    width: 100%;
    max-width: 800px;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: var(--chasse-beige);
    border-radius: 1.5rem;
}

.hero-title {
    font-family: var(--font-title), serif;
    font-weight: 500;
    font-size: clamp(2.25rem, 6vw, 3.75rem);
    line-height: 1.2;
    color: var(--chasse-teal-dark);
}

.hero-title span {
    color: var(--chasse-brown);
}

.hero-text {
    color: #6b4a2f;
}
/* ---------- Cards and Forms ---------- */
.card {
    background-color: var(--chasse-teal-dark);
    color: var(--chasse-beige);
    border-radius: 3%;
    border-color: var(--chasse-brown) !important;
    --btn-main: var(--chasse-beige);
    --btn-on: var(--chasse-teal-dark);
}

.form-control {
    border-radius: 0.6rem;
    border-color: var(--chasse-brown);
    background-color: var(--chasse-beige);
    color: var(--chasse-teal-dark);
}

.form-select {
    border-radius: 0.6rem;
    border-color: var(--chasse-brown);
    background-color: var(--chasse-beige);
    color: var(--chasse-teal-dark);
}

.form-control::file-selector-button {
    background-color: var(--chasse-teal);
    color: var(--chasse-beige);
    border-color: var(--chasse-brown);
    font-family: var(--font-title), serif;
}

.form-control:hover:not(:disabled):not([readonly])::file-selector-button {
    background-color: color-mix(in srgb, var(--chasse-teal) 85%, black);
}

.card a {
    color: var(--chasse-teal-dark);
    text-decoration-color: var(--chasse-brown);
}

.card a:hover {
    color: var(--chasse-brown);
}

/* ---------- Hunt List ---------- */

.page-title {
    font-family: var(--font-title), serif;
    font-weight: 500;
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--chasse-beige);
}

.page-title span {
    color: var(--chasse-brown);
}

.hunt-card .card-img-top {
    width: 100%;
    height: 220px;
    object-fit: contain;
    object-position: center;
    background-color: rgba(240, 211, 177, 0.08);
    padding: 0.5rem;
    border-bottom: 1px solid var(--chasse-brown);
}

.hunt-card .card-title {
    font-family: var(--font-title), serif;
    font-weight: 500;
}

.hunt-divider {
    border-color: var(--chasse-brown);
    opacity: 1;
    margin: 0.5rem 0 1rem;
}

.hunt-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 12rem;
    border: 2px dashed var(--chasse-beige);
    border-radius: 3%;
    color: var(--chasse-beige);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.hunt-add:hover,
.hunt-add:focus-visible {
    background-color: var(--chasse-beige);
    color: var(--chasse-teal-dark);
}

.hunt-add-icon {
    font-family: var(--font-title), serif;
    font-size: 3rem;
    line-height: 1;
}

.hunt-add-label {
    font-family: var(--font-title), serif;
    font-weight: 500;
}

/* ---------- Hunt Form ---------- */

/* Same color inversion as the navbar and the cards, for buttons placed directly on the teal page */
.on-dark {
    --btn-main: var(--chasse-beige);
    --btn-on: var(--chasse-teal-dark);
}

/* .card uses a percentage radius, which looks stretched on wide cards */
.card-form {
    border-radius: 1rem;
}

.page-title-sm {
    font-size: 1.75rem;
}

.field-label {
    display: block;
    margin-bottom: 0.25rem;
    font-family: var(--font-title), serif;
    font-size: 0.78rem;
}

.card-form .form-control::placeholder {
    color: color-mix(in srgb, var(--chasse-brown) 75%, var(--chasse-beige));
    opacity: 1;
}

.card-form .form-check-input:checked {
    background-color: var(--chasse-teal);
    border-color: var(--chasse-beige);
}

.riddle-heading {
    margin: 0;
    font-family: var(--font-title), serif;
    font-weight: 500;
    font-size: 1.15rem;
}

.riddle-type {
    width: auto;
    min-width: 9rem;
}

/* Dashed "+" zones reuse .hunt-add; these rules let it work on <button> and <label> too */
button.hunt-add,
label.hunt-add {
    background-color: transparent;
    font: inherit;
}

.hunt-add-wide {
    min-height: 5.5rem;
    border-radius: 1rem;
}

.hunt-add-wide .hunt-add-icon {
    font-size: 2rem;
}

.hunt-add-sm {
    width: 100%;
    min-height: 2.5rem;
    border-width: 1px;
    border-radius: 0.6rem;
}

.hunt-add-sm .hunt-add-icon {
    font-size: 1.25rem;
}

/* Image upload zones (cover image, riddle image) */
.dropzone {
    position: relative;
    overflow: hidden;
    min-height: 7rem;
    margin: 0;
    border-radius: 0.6rem;
    cursor: pointer;
}

.dropzone-sm {
    min-height: 4.5rem;
}

.dropzone .hunt-add-icon {
    font-size: 1.75rem;
}

.dropzone.has-image .hunt-add-icon {
    display: none;
}

.dropzone:focus-within {
    outline: 2px solid var(--chasse-beige);
    outline-offset: 2px;
}

.dropzone-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* QCM answers: the numbered circle is also the "correct answer" checkbox */
.choice-mark {
    position: relative;
    flex: none;
    margin: 0;
    cursor: pointer;
}

.choice-mark span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid var(--chasse-beige);
    border-radius: 50%;
    font-size: 0.8rem;
    transition: background-color 0.15s, color 0.15s;
}

.choice-mark input:checked + span {
    background-color: var(--chasse-beige);
    color: var(--chasse-teal-dark);
}

.choice-mark input:focus-visible + span {
    outline: 2px solid var(--chasse-beige);
    outline-offset: 2px;
}

.choice-remove {
    flex: none;
    padding: 0 0.25rem;
    border: 0;
    background: none;
    color: var(--chasse-beige);
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.6;
}

.choice-remove:hover,
.choice-remove:focus-visible {
    opacity: 1;
}

/* GPS riddle map (Leaflet) */
.riddle-map-wrap {
    position: relative;
    margin-bottom: 0.5rem;
}

.riddle-map {
    height: 14rem;
    z-index: 0; /* keeps Leaflet's internal z-indexes below the navbar and modals */
    border: 1px solid var(--chasse-brown);
    border-radius: 0.6rem;
}

.riddle-map-hint {
    position: absolute;
    left: 0.5rem;
    bottom: 0.5rem;
    z-index: 1000;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    background-color: var(--chasse-teal-dark);
    color: var(--chasse-beige);
    font-size: 0.75rem;
    pointer-events: none;
}

.riddle-pin {
    background: none;
    border: 0;
}

/* "Add a riddle" modal */
.modal-chasse .modal-content {
    border: 0;
    border-radius: 1.5rem;
    background-color: var(--chasse-beige);
    color: #6b4a2f;
}

.modal-chasse .modal-title {
    font-family: var(--font-title), serif;
    font-weight: 500;
    font-size: 1.75rem;
    color: var(--chasse-teal-dark);
}

.modal-chasse .modal-title span {
    color: var(--chasse-brown);
}

.modal-chasse .modal-subtitle {
    margin-bottom: 0.75rem;
    font-family: var(--font-title), serif;
    color: var(--chasse-teal-dark);
}

.modal-chasse .btn-close {
    --bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%231f8f76'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
    padding: 0.7rem;
    border: 1px solid var(--chasse-brown);
    border-radius: 0.6rem;
    background-size: 0.75rem;
    opacity: 1;
}

.type-option {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--chasse-brown);
    border-radius: 0.8rem;
    background-color: transparent;
    color: #6b4a2f;
    text-align: left;
    transition: background-color 0.15s, color 0.15s;
}

.type-option strong {
    display: block;
    font-family: var(--font-title), serif;
    font-weight: 500;
    font-size: 0.95rem;
}

.type-option small {
    display: block;
}

.type-option:hover {
    background-color: color-mix(in srgb, var(--chasse-beige) 85%, var(--chasse-brown));
}

.type-option.active {
    border-color: var(--chasse-teal-dark);
    background-color: var(--chasse-teal-dark);
    color: var(--chasse-beige);
}

/* "New location" popup of the riddle map */
.riddle-map .leaflet-popup-content {
    margin: 0.75rem;
    color: #6b4a2f;
}

.location-popup {
    display: grid;
    gap: 0.5rem;
    min-width: 13rem;
}

.location-popup strong {
    font-family: var(--font-title), serif;
    font-weight: 500;
    color: var(--chasse-teal-dark);
}

.location-popup .btn {
    --btn-main: var(--chasse-teal-dark);
    --btn-on: var(--chasse-beige);
}

.location-popup-error {
    min-height: 1em;
    font-size: 0.75rem;
    color: #b02a37;
}

/* ---------- Teams ---------- */

.team-back {
    font-family: var(--font-title), serif;
    font-size: 0.9rem;
    color: var(--chasse-beige);
    text-decoration: none;
}

.team-back:hover {
    color: var(--chasse-teal-dark);
}

.team-meta,
.team-description {
    color: var(--chasse-beige);
}

.team-description {
    max-width: 60ch;
}

/* One line of the members or hunts list of a team */
.team-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--chasse-brown) 60%, transparent);
}

.team-row:last-child {
    border-bottom: 0;
}

.team-row .form-select {
    width: auto;
}

.team-role {
    background-color: var(--chasse-beige);
    color: var(--chasse-teal-dark);
    font-family: var(--font-title), serif;
    font-weight: 500;
}

/* ---------- Team discussion ---------- */

.chat-card {
    overflow: hidden;
}

.chat-thread {
    height: min(60vh, 34rem);
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.chat-thread:focus-visible {
    outline: 2px solid var(--chasse-beige);
    outline-offset: -4px;
}

/* Day separator: "Aujourd'hui", "Hier" or the date */
.chat-day {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
    font-family: var(--font-title), serif;
    font-size: 0.75rem;
    color: color-mix(in srgb, var(--chasse-beige) 80%, transparent);
}

.chat-day::before,
.chat-day::after {
    content: '';
    flex: 1;
    border-top: 1px solid color-mix(in srgb, var(--chasse-brown) 60%, transparent);
}

.chat-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 0.9rem;
}

.chat-message.is-grouped {
    margin-top: 0.25rem;
}

.chat-message.is-mine {
    align-items: flex-end;
}

.chat-author {
    margin: 0 0.5rem 0.2rem;
    font-family: var(--font-title), serif;
    font-size: 0.78rem;
    color: var(--chasse-beige);
}

.chat-bubble-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    max-width: min(75%, 36rem);
}

.chat-message.is-mine .chat-bubble-row {
    flex-direction: row-reverse;
}

/* Other members: outlined bubble on the dark card. Own messages: beige bubble, like the role badges */
.chat-bubble {
    min-width: 0;
    padding: 0.5rem 0.85rem 0.35rem;
    border: 1px solid var(--chasse-brown);
    border-radius: 1rem 1rem 1rem 0.3rem;
    background-color: color-mix(in srgb, var(--chasse-teal) 30%, var(--chasse-teal-dark));
    color: var(--chasse-beige);
}

.chat-message.is-mine .chat-bubble {
    border-color: var(--chasse-beige);
    border-radius: 1rem 1rem 0.3rem 1rem;
    background-color: var(--chasse-beige);
    color: var(--chasse-teal-dark);
}

.chat-text {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.chat-time {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.7rem;
    text-align: right;
    opacity: 0.75;
}

/* Delete button: discreet, shown on hover or keyboard focus of the message */
.chat-delete {
    display: inline-flex;
    padding: 0.3rem;
    border: 0;
    border-radius: 0.4rem;
    background: none;
    color: var(--chasse-beige);
    opacity: 0;
    transition: opacity 0.15s;
}

.chat-message:hover .chat-delete,
.chat-delete:focus-visible {
    opacity: 0.7;
}

.chat-delete:hover,
.chat-delete:focus-visible {
    opacity: 1;
    outline: 1px solid var(--chasse-beige);
}

@media (hover: none) {
    .chat-delete {
        opacity: 0.6;
    }
}

/* Empty thread: same look as the dashed "+" zones */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 100%;
    color: var(--chasse-beige);
    text-align: center;
}

.chat-empty .hunt-add-icon {
    line-height: 1;
    opacity: 0.8;
}

.chat-composer {
    padding: 1rem 1.5rem 1.1rem;
    border-top: 1px solid var(--chasse-brown);
}

.chat-input {
    min-height: 2.75rem;
    max-height: 10rem;
    resize: vertical;
    border-radius: 0.6rem;
}

.chat-input::placeholder {
    color: color-mix(in srgb, var(--chasse-brown) 75%, var(--chasse-beige));
    opacity: 1;
}

.chat-send {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
}

.chat-hint {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: color-mix(in srgb, var(--chasse-beige) 75%, transparent);
}

@media (max-width: 575.98px) {
    .chat-thread {
        padding: 1rem;
    }

    .chat-composer {
        padding: 0.85rem 1rem 1rem;
    }

    .chat-bubble-row {
        max-width: 88%;
    }
}
