/* =============================================================================
 * style-responsive.css
 * -----------------------------------------------------------------------------
 * Mobile / small-screen overlay for the guest site.
 *
 * Loaded AFTER style.css and style-{ConcoursCode}.css, so it can override any
 * fixed widths and float-based layout rules without touching the originals.
 *
 * Strategy:
 *   - Activate only for viewports up to 800px (tablets in portrait & phones).
 *   - Free the fixed 946px wrapper, drop the float layout, stack the sidebar
 *     above the content, linearize the XFormularTable forms.
 *   - Fix touch targets: 44px minimum for buttons, 16px font on inputs
 *     to prevent iOS auto-zoom on focus.
 * ============================================================================= */

/* ----------------------------------------------------------------------------
 * Small helpers active at ALL viewport sizes (safe regardless of width).
 * They make images fluid and prevent horizontal overflow when an old page
 * has an oversized inline element.
 * ---------------------------------------------------------------------------- */
img {
    max-width: 100%;
    height: auto;
}

html, body {
    overflow-x: hidden; /* belt & suspenders against rogue wide elements */
}

/* Breathing room at the bottom of the page so the last button / paragraph
 * doesn't touch the wrapper edge. Applies to all viewports. */
#wrapper {
    padding-bottom: 30px;
}
#content {
    padding-bottom: 10px;
}

/* ----------------------------------------------------------------------------
 * Title band below the banner (session name + year).
 * Was previously inside the sidebar; now lives in the header for all viewports.
 * Explicitly full-width and box-sizing border-box so it never gets clipped
 * by any inherited width rule.
 * ---------------------------------------------------------------------------- */
#banner-title {
    display: block;
    width: 100%;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 0.5px;
    box-sizing: border-box;
    margin: 0;
    background: #ececec;             /* subtle gray, distinct from the white banner above */
    border-bottom: 1px solid #d0d0d0;
    padding: 10px 20px;
    text-align: center;
    color: #555555;
    line-height: 1.4em;
}
#banner-title .banner-year {
    color: #b40e1c;
    letter-spacing: 3px;
}

/* Burger toggle and backdrop: hidden on desktop, only revealed inside the
 * mobile @media block below. */
.burger-toggle {
    display: none;
}
.menu-backdrop {
    display: none;
}

/* Drawer-only language switcher: hidden on desktop, revealed inside @media. */
#sidebar-langs {
    display: none;
}

/* ----------------------------------------------------------------------------
 * Belt-and-suspenders: explicit desktop rules with !important.
 * These guarantee correct rendering even if a stale cached copy of an earlier
 * version of this file (without the global "display: none" rules) is somehow
 * still being served. Harmless on a fresh load.
 * ---------------------------------------------------------------------------- */
@media (min-width: 801px) {
    .burger-toggle  { display: none !important; }
    #sidebar-langs  { display: none !important; }
    .menu-backdrop  { display: none !important; }
    #banner-title   { text-align: center !important; }
}

/* ----------------------------------------------------------------------------
 * Generic info card (participation page: voyage, hotel, etc.).
 * One card per record. Works the same on desktop and mobile.
 * ---------------------------------------------------------------------------- */
.info-card {
    background: #ffffff;
    border: 1px solid #d6d6d6;
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 12px;
    line-height: 1.5em;
}
.info-card-name {
    font-weight: bold;
    font-size: 16px;
    color: #b40e1c;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}
.info-card-row {
    font-size: 14px;
    line-height: 1.7em;
}
.info-card-label {
    font-weight: bold;
    display: inline-block;
    min-width: 130px;
    color: #555555;
}
.info-card-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #d6d6d6;
    font-size: 14px;
    line-height: 1.6em;
    color: #555555;
}
.info-card-section a {
    color: #b40e1c;
}
.info-card-section-title {
    font-weight: bold;
    color: #555555;
    margin-bottom: 6px;
}
.info-card-pec {
    margin-bottom: 6px;
}
.info-card-pec-when {
    font-weight: bold;
    color: #444444;
}
.info-card-pec-where {
    color: #555555;
    padding-left: 4px;
}
.info-card-remark {
    margin-top: 8px;
    font-size: 13px;
    color: #777777;
}

/* ----------------------------------------------------------------------------
 * Generic language picker: a flex-wrapping list of <label><input checkbox> + text.
 * Used in two flavors:
 *   - .info-card-langs-list : read-only (account_data) - muted color, default cursor
 *   - .lang-grid            : editable form (account_update_request) - clickable
 * ---------------------------------------------------------------------------- */
.info-card-langs {
    display: block;
}
.info-card-langs .info-card-label {
    display: block;
    margin-bottom: 4px;
}
.info-card-langs-list,
.lang-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    padding: 2px 0 0 0;
}
.info-card-langs-list label,
.lang-grid label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}
.info-card-langs-list label {
    color: #555555;
    cursor: default;
}
.lang-grid label {
    cursor: pointer;
}
.info-card-langs-list input[type=checkbox],
.lang-grid input[type=checkbox] {
    margin: 0;
}

/* ----------------------------------------------------------------------------
 * Messages: redesigned with a colored left accent and a CSS-only pastille icon.
 * Replaces the old PNG-image background style (.message_* in style.css).
 *
 * One block-level row with flex layout: [pastille] [text].
 * ---------------------------------------------------------------------------- */
.message_error,
.message_warning,
.message_confirm,
.message_info,
.message_normal {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 10px 0;
    padding: 12px 14px;
    background: #f4f4f4 none;            /* shorthand resets background-image */
    border: 1px solid #d6d6d6;
    border-left: 4px solid #999999;
    border-radius: 4px;
    color: #333333;
    font-size: 14px;
    font-weight: normal;
    text-align: left;
    line-height: 1.5em;
}
.message_error::before,
.message_warning::before,
.message_confirm::before,
.message_info::before,
.message_normal::before {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border-radius: 50%;
    color: #ffffff;
    font-weight: bold;
    font-size: 14px;
    line-height: 1;
}
.message_error {
    background: #fdecea none;
    border-color: #f5c6c0;
    border-left-color: #d93025;
    color: #5e1414;
}
.message_error::before { content: "\2715"; background: #d93025; } /* ✕ */
.message_error a { color: #b40e1c; }

.message_warning {
    background: #fff4e5 none;
    border-color: #f5dca6;
    border-left-color: #e8a019;
    color: #6b4500;
}
.message_warning::before { content: "!"; background: #e8a019; }

.message_confirm {
    background: #e6f4ea none;
    border-color: #b7e0c2;
    border-left-color: #1e8e3e;
    color: #1d4f25;
}
.message_confirm::before { content: "\2713"; background: #1e8e3e; } /* ✓ */

.message_info {
    background: #e8f0fe none;
    border-color: #b8cffb;
    border-left-color: #1967d2;
    color: #102e5e;
}
.message_info::before { content: "i"; background: #1967d2; font-style: italic; font-family: Georgia, serif; }

.message_normal {
    background: #f4f4f4 none;
    border-color: #d6d6d6;
    border-left-color: #888888;
    color: #333333;
}
.message_normal::before { content: "\2022"; background: #888888; } /* • */

/* ----------------------------------------------------------------------------
 * Taster picture upload (taster-picture.inc.php).
 * Pretty checklist + a real CTA button replacing the native file picker.
 * ---------------------------------------------------------------------------- */
.tp-intro {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #333333;
}
.tp-checklist {
    list-style: none;
    padding: 0;
    margin: 8px 0 16px 0;
}
.tp-checklist li {
    position: relative;
    padding: 6px 0 6px 32px;
    line-height: 1.5em;
    color: #444444;
    font-size: 14px;
}
.tp-checklist li::before {
    content: "\2713"; /* checkmark */
    position: absolute;
    left: 0;
    top: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1e8e3e;
    color: #ffffff;
    font-size: 13px;
    font-weight: bold;
    line-height: 1;
}
.tp-note {
    margin: 8px 0 18px 0;
    font-size: 14px;
    color: #666666;
    font-style: italic;
}

/* Hide the native file input - the styled <label> triggers it via [for=]. */
.tp-file-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.tp-choose-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #b40e1c;
    color: #ffffff;
    border: 1px solid #b40e1c;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    text-align: center;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.tp-choose-btn:hover,
/* :focus-within applies when the hidden file input has focus
 * (tab navigation), so the button shows a focus state. */
.tp-choose-btn:focus-within {
    background: #8a0c16;
    border-color: #8a0c16;
}
.tp-choose-icon {
    font-size: 18px;
    line-height: 1;
}

/* ----------------------------------------------------------------------------
 * Document list (participation page > Documents section).
 * One clickable row per document.
 * ---------------------------------------------------------------------------- */
.doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: #ffffff;
    border: 1px solid #d6d6d6;
    border-radius: 4px;
    text-decoration: none;
    color: #444444;
    transition: background 0.15s ease;
}
.doc-item:hover,
.doc-item:focus {
    background: #f4f4f4;
    text-decoration: none;
}
.doc-item-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.doc-item-icon img {
    vertical-align: middle;
}
.doc-item-body {
    flex: 1 1 auto;
    min-width: 0; /* allow filename to wrap if very long */
}
.doc-item-type {
    font-weight: bold;
    color: #555555;
    font-size: 14px;
}
.doc-item-name {
    color: #b40e1c;
    font-size: 14px;
    word-break: break-word;
}
.doc-item-date {
    color: #888888;
    font-size: 12px;
}

/* ============================================================================
 * BREAKPOINT: viewports up to 800px
 * ============================================================================ */
@media (max-width: 800px) {

    /* -- Body / wrapper ----------------------------------------------------- */
    body {
        font-size: 100%; /* original 73% is too small once we no longer fake-zoom */
    }

    #wrapper {
        width: auto;
        max-width: 100%;
        margin: 0;
        border: none;
        /* Kill the vertical grey sidebar strip (img/sidebar.gif repeat-y) */
        background: #eeeeee none;
    }

    /* -- Banner (logos at the top) ----------------------------------------- */
    #banner {
        height: auto;
        padding: 10px 8px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
    }
    #banner-medal {
        float: none;
        height: 60px;
        max-height: 15vw;
        margin: 0;
    }
    #banner-cmb-text {
        float: none;
        height: 40px;
        max-height: 12vw;
        margin: 0;
    }

    /* -- Language bar: hidden on mobile (moved into the drawer below) ----- */
    #banner-language {
        display: none;
    }

    /* -- Language switcher inside the drawer ------------------------------ */
    /* Compact row of small pill buttons. font-size: 0 on the container
     * collapses the " | " text separators rendered between the <a> tags
     * (we re-enable the font-size on each <a>). */
    #sidebar-langs {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        padding: 10px 10px;
        margin: 0 0 8px 0;
        background: #c4c8cb;
        border-bottom: 1px solid #ffffff;
        font-size: 0;
        line-height: 1.2em;
    }
    #sidebar-langs a {
        display: inline-block;
        padding: 3px 8px;
        min-width: 28px;
        font-size: 12px;
        line-height: 1.4em;
        text-align: center;
        text-decoration: none;
        font-weight: bold;
        color: #b40e1c;
        background: #ffffff;
        border: 1px solid #b40e1c;
        border-radius: 3px;
    }
    #sidebar-langs a:hover,
    #sidebar-langs a:focus {
        background: #b40e1c;
        color: #ffffff;
    }

    /* -- Title band: centered, slightly more compact ---------------------- */
    #banner-title {
        text-align: center;
        padding: 6px 8px;
    }
    #banner-title .banner-session {
        font-size: 13px;
        margin-right: 8px;
    }
    #banner-title .banner-year {
        font-size: 13px;
        letter-spacing: 2px;
    }

    /* -- Burger toggle button --------------------------------------------- */
    .burger-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #ffffff;
        border: 1px solid #b40e1c;
        color: #b40e1c;
        width: 44px;
        height: 44px;
        font-size: 22px;
        line-height: 1;
        padding: 0;
        cursor: pointer;
        border-radius: 4px;
        flex-shrink: 0;
        -webkit-appearance: none;
    }
    .burger-toggle:hover,
    .burger-toggle:focus {
        background: #b40e1c;
        color: #ffffff;
        outline: none;
    }
    /* Push the CMB-text logo to the far right so the banner reads
     * [burger] [medal] ............... [cmb-text]                       */
    #banner-cmb-text {
        margin-left: auto;
    }

    /* -- Sidebar as a slide-in drawer (off-canvas) ------------------------ */
    /* The selector is intentionally over-specified (body > #sidebar) so it
     * always wins over the base "#sidebar { float:left; width:150px }" rule
     * in style.css, even on browsers that have aggressively cached the file. */
    body #sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #d1d4d7;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.25);
        float: none !important;
        margin: 0;
        padding: 16px 0 24px 0;
        font-size: 100%;
        line-height: 1.5em;
        border: none;
    }
    body.menu-open #sidebar {
        transform: translateX(0);
    }
    #navcontainer {
        width: 100%;
        margin: 0;
        padding: 0;
    }
    #navcontainer ul,
    #navlist {
        padding: 0;
        margin: 0;
        list-style: none;
    }
    #navcontainer a {
        width: 100%;
        box-sizing: border-box;
        padding: 12px 18px;        /* big touch targets */
        font-size: 16px;
        border-bottom: 1px solid #ffffff;
    }
    #sidebar h2,
    #sidebar p {
        padding: 8px 18px;
        margin: 0;
    }

    /* -- Backdrop shown behind the open drawer ---------------------------- */
    .menu-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }
    body.menu-open .menu-backdrop {
        opacity: 1;
        visibility: visible;
    }

    /* Prevent page scroll while the menu is open */
    body.menu-open {
        overflow: hidden;
    }

    /* -- Content area ------------------------------------------------------ */
    #content {
        float: none;
        width: auto;
        margin: 10px;
        padding: 0;
        min-height: 0;
        line-height: 1.5em;
    }
    #content p {
        margin: 10px 0;
        font-size: 100%;
    }

    /* -- Footer ------------------------------------------------------------ */
    #footer {
        clear: both;
        width: auto;
        margin: 10px;
        padding: 0;
        text-align: center;
    }

    /* -- Headings ---------------------------------------------------------- */
    h1,
    .info-block h1 {
        font-size: 20px;
        line-height: 1.2;
        letter-spacing: 0;
        padding: 8px 0;
        word-wrap: break-word;
    }
    h2 {
        font-size: 16px;
        letter-spacing: 1px;
        margin: 4px 0;
    }
    h3 {
        font-size: 15px;
        letter-spacing: 1px;
        margin: 8px 0;
    }

    /* -- Forms: linearize the <table class="XFormularTable"> -------------- */
    table.XFormularTable,
    table.XFormularTable tbody,
    table.XFormularTable tr,
    table.XFormularTable th,
    table.XFormularTable td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        height: auto !important; /* override .XFormularTable tr { height:15px } from style.css */
        min-height: 0;
    }
    table.XFormularTable tr {
        margin-bottom: 8px;
        padding: 0;
    }
    table.XFormularTable th {
        padding: 8px 0 4px 0;
        text-align: left;
        vertical-align: top;
        font-weight: bold;
    }
    table.XFormularTable td {
        padding: 0 0 6px 0;
        vertical-align: top;
    }
    table.XFormularTable th label {
        display: block;
        min-width: 0;
        width: 100%;
        padding: 0;
    }
    /* The .lang-grid sits inside a linearized XFormularTable cell.
     * Force it to take the full available width so its flex children wrap. */
    table.XFormularTable td .lang-grid {
        width: 100%;
    }

    /* -- Form fields: full width and big enough to be tap-friendly -------- */
    input[type=text],
    input[type=email],
    input[type=password],
    input[type=tel],
    input[type=number],
    input[type=date],
    input[type=search],
    input[type=url],
    input[type=file],
    select,
    textarea {
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 16px; /* prevents iOS Safari from zooming on focus */
        padding: 8px;
        margin: 2px 0;
    }
    textarea {
        min-height: 80px;
    }
    /* Radios / checkboxes stay inline */
    input[type=radio],
    input[type=checkbox] {
        width: auto !important;
        transform: scale(1.2);
        margin: 4px 6px 4px 0;
    }

    /* -- Buttons ---------------------------------------------------------- */
    .buttons,
    div.buttons {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 10px 0;
        overflow: visible;
    }
    .buttons button,
    .buttons button[type],
    .a_button,
    .a_buttonbloc {
        float: none !important;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
        margin: 0 !important;
        min-height: 44px;
        padding: 10px 14px;
        font-size: 16px;
        text-align: center;
    }
    /* The Cropper.js control buttons row in taster-picture: keep them inline */
    #tp_step2 .buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    #tp_step2 .buttons button {
        width: auto !important;
        flex: 1 1 45%;
    }

    /* -- Blocks ----------------------------------------------------------- */
    .reg_bloc,
    .reg_regfile {
        margin: 10px 0;
        padding: 12px;
        top: 0;
    }

    /* -- Messages --------------------------------------------------------- */
    .message_error,
    .message_warning,
    .message_confirm,
    .message_info,
    .message_normal {
        margin: 8px 0;
        padding: 10px;
        font-size: 14px;
    }

    /* -- Tables (non-XFormularTable) -------------------------------------- */
    table.PaimentTable {
        width: 100% !important;
        font-size: 14px;
    }
    /* Generic data tables: allow horizontal scroll if too wide */
    table {
        max-width: 100%;
    }

    /* -- Info cards (participation page): tighter on phones --------------- */
    .info-card {
        padding: 12px 14px;
    }
    .info-card-label {
        min-width: 100px;
    }

    /* -- Doc items: smaller padding on phones ----------------------------- */
    .doc-item {
        padding: 8px;
    }

    /* -- Taster picture choose button: full-width and bigger tap target -- */
    .tp-choose-btn {
        display: flex;
        width: 100%;
        justify-content: center;
        padding: 14px 16px;
        box-sizing: border-box;
    }
    .tp-checklist li {
        padding-left: 30px;
    }
}

/* ============================================================================
 * BREAKPOINT: viewports up to 480px (small phones, extra tight)
 * ============================================================================ */
@media (max-width: 480px) {
    #banner {
        padding: 6px 4px;
    }
    #banner-medal  { height: 50px; }
    #banner-cmb-text { height: 32px; }

    h1,
    .info-block h1 {
        font-size: 18px;
    }

    #content {
        margin: 8px;
    }
    .reg_bloc {
        padding: 10px;
    }
}
