/*
============================================================
ULIZO — Styles mobile-first, liste compacte type forum
Inspiré de MiniNews + forums (Stack Overflow, Discourse)
============================================================
*/

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8a;
    --primary-dark: #152a45;
    --secondary: #6b7280;
    --success: #0f766e;
    --warning: #b8860b;
    --danger: #b91c1c;
    --gold: #c9a227;
    --gold-light: #f5ecd3;
    --background: #f0f2f5;
    --surface: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #dde3ea;
    --radius: 8px;
    --radius-lg: 10px;
    --shadow: 0 1px 3px rgba(30, 58, 95, 0.06);
    --transition: 0.2s ease;
    --touch-min: 44px;
    --page-pad: 0.75rem;
    --content-max: 720px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    background: var(--background);
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 { color: var(--primary-dark); font-weight: 700; line-height: 1.3; }

/* --- Layout principal (mobile d'abord) --- */
.ul-main {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: var(--page-pad);
    padding-bottom: calc(var(--page-pad) + 4rem);
}

@media (min-width: 768px) {
    :root { --page-pad: 1.25rem; }
    body { font-size: 1rem; }
}

/* --- Navbar compacte --- */
.ul-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow);
}

.ul-navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 0.35rem 0;
}

.ul-brand {
    color: #fff !important;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    line-height: 1.1;
    padding: 0.25rem 0;
}

.ul-brand i { font-size: 1.25rem; color: var(--gold); flex-shrink: 0; }

.ul-brand-text { display: flex; flex-direction: column; }

.ul-brand span { font-size: 1.1rem; }

.ul-brand small {
    display: none;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--gold-light);
    opacity: 0.9;
}

@media (min-width: 576px) {
    .ul-brand small { display: block; }
    .ul-brand span { font-size: 1.2rem; }
}

.ul-navbar .nav-link {
    color: rgba(255,255,255,0.92) !important;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 6px;
    padding: 0.5rem 0.65rem !important;
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ul-navbar .nav-link:hover { background: rgba(255,255,255,0.1); color: #fff !important; }

.ul-nav-user {
    color: var(--gold-light) !important;
    font-weight: 600;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ul-navbar .navbar-toggler {
    border-color: rgba(255,255,255,0.35);
    padding: 0.35rem 0.5rem;
}

.ul-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Recherche : pleine largeur sous le menu sur mobile */
.ul-search-form {
    width: 100%;
    margin: 0.5rem 0 !important;
}

.ul-search-form input {
    border-radius: 8px;
    border: none;
    font-size: 0.9rem;
    min-height: 38px;
}

@media (min-width: 992px) {
    .ul-search-form { width: auto; margin: 0 0.75rem 0 0 !important; }
    .ul-search-form input { min-width: 180px; }
}

/* --- Boutons --- */
.ul-btn-primary,
.ul-btn-gold,
.ul-btn-outline,
.ul-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    min-height: 38px;
    border: none;
    transition: background var(--transition), color var(--transition);
}

.ul-btn-primary { background: var(--primary); color: #fff; }
.ul-btn-primary:hover { background: var(--primary-dark); color: #fff; }

.ul-btn-gold { background: var(--gold); color: var(--primary-dark); }
.ul-btn-gold:hover { background: #b8921f; color: var(--primary-dark); }

.ul-btn-outline {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--primary);
}

.ul-btn-outline:hover { background: #eef2f7; color: var(--primary-dark); }

.ul-btn-danger { background: var(--danger); color: #fff; font-size: 0.8rem; padding: 0.35rem 0.65rem; min-height: 32px; }

.btn-sm.ul-btn-primary,
.btn-sm.ul-btn-outline,
.btn-sm.ul-btn-gold { min-height: 32px; padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* --- Bandeau accueil compact --- */
.ul-hero-compact {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--gold);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
    box-shadow: var(--shadow);
}

.ul-hero-compact h1 {
    font-size: 1.15rem;
    margin-bottom: 0.35rem;
}

.ul-hero-compact p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
}

.ul-hero-compact .btn { font-size: 0.85rem; }

@media (min-width: 768px) {
    .ul-hero-compact { padding: 1rem 1.25rem; }
    .ul-hero-compact h1 { font-size: 1.35rem; }
}

/* --- Stats inline (plus de grosses cartes) --- */
.ul-stats-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 1rem;
    padding-bottom: 0.15rem;
}

.ul-stats-bar::-webkit-scrollbar { display: none; }

.ul-stat-pill {
    flex: 0 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

.ul-stat-pill strong {
    color: var(--primary);
    font-size: 0.95rem;
    margin-right: 0.2rem;
}

/* --- Liste forum (fil de discussion) --- */
.ul-thread-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ul-thread {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.65rem 0.75rem;
    box-shadow: var(--shadow);
    transition: border-color var(--transition), background var(--transition);
}

.ul-thread:hover {
    border-color: #c5d0dc;
    background: #fafbfc;
}

.ul-thread.is-resolved { border-left: 3px solid var(--success); }

.ul-thread-stats {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: center;
}

.ul-stat-box {
    width: 100%;
    text-align: center;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 0.3rem 0.25rem;
    line-height: 1.15;
}

.ul-stat-box strong {
    display: block;
    font-size: 0.95rem;
    color: var(--primary-dark);
}

.ul-stat-box small {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ul-stat-box.has-answers { background: #dbeafe; }
.ul-stat-box.has-answers strong { color: #1d4ed8; }

.ul-stat-box.is-accepted { background: #d1fae5; }
.ul-stat-box.is-accepted strong { color: var(--success); }

.ul-stat-box.muted { background: #f9fafb; }

.ul-thread-body { min-width: 0; }

.ul-thread-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
}

.ul-thread-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    line-height: 1.35;
}

.ul-thread-title a { color: var(--primary-dark); }
.ul-thread-title a:hover { color: var(--primary-light); }

.ul-thread-excerpt {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ul-thread-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ul-meta-sep { margin: 0 0.2rem; }

/* Mobile : stats en ligne au-dessus du titre */
@media (max-width: 479px) {
    .ul-thread {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .ul-thread-stats {
        flex-direction: row;
        justify-content: flex-start;
    }

    .ul-stat-box {
        width: auto;
        min-width: 52px;
        padding: 0.25rem 0.5rem;
    }
}

/* --- Section titres --- */
.ul-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--border);
}

.ul-section-head h2 {
    font-size: 0.95rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--secondary);
    font-weight: 700;
}

.ul-section-head a { font-size: 0.8rem; }

/* --- Badges --- */
.ul-badge {
    display: inline-block;
    padding: 0.15em 0.5em;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 4px;
    line-height: 1.4;
}

.ul-badge-teacher { background: var(--gold-light); color: #7a5c00; }
.ul-badge-admin { background: #fce7f3; color: #9d174d; }
.ul-badge-moderator { background: #ede9fe; color: #5b21b6; }
.ul-badge-student { background: #dbeafe; color: #1e40af; }
.ul-badge-user { background: #f3f4f6; color: var(--secondary); }
.ul-badge-success { background: #d1fae5; color: var(--success); }
.ul-badge-open { background: #fef3c7; color: #92400e; }
.ul-badge-solution { background: var(--gold-light); color: #7a5c00; border: 1px solid var(--gold); }
.ul-badge-tag { background: #eef2ff; color: var(--primary); }

/* --- Page question (détail) --- */
.ul-question-post {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.ul-question-post h1 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.ul-question-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.ul-question-content {
    font-size: 0.9rem;
    line-height: 1.6;
}

.ul-question-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
    .ul-question-post h1 { font-size: 1.35rem; }
}

/* --- Réponses compactes --- */
.ul-answers-section h2 {
    font-size: 0.95rem;
    margin-bottom: 0.65rem;
    color: var(--secondary);
}

.ul-answer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.ul-answer.best {
    border-color: var(--gold);
    background: linear-gradient(to right, rgba(245,236,211,0.5), var(--surface));
}

.ul-answer.teacher-answer { border-left: 3px solid var(--gold); }

.ul-answer-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.ul-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.ul-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.ul-answer-author { font-size: 0.85rem; font-weight: 600; }
.ul-answer-date { font-size: 0.72rem; color: var(--text-muted); }

.ul-answer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.65rem;
}

.ul-reply-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem;
    margin-top: 0.75rem;
}

.ul-reply-box h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }

/* --- Filtres repliables sur mobile --- */
.ul-filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.ul-filters-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    background: var(--surface);
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-dark);
    min-height: var(--touch-min);
}

.ul-filters-body {
    padding: 0 0.85rem 0.85rem;
    border-top: 1px solid var(--border);
}

.ul-filters-body .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.ul-filters-body .form-control,
.ul-filters-body .form-select {
    font-size: 0.875rem;
    min-height: 38px;
}

@media (min-width: 768px) {
    .ul-filters-toggle { display: none; }
    .ul-filters-body { display: block !important; padding: 0.85rem; border-top: none; }
}

@media (max-width: 767px) {
    .ul-filters-body:not(.show) { display: none; }
    .ul-filters-body.show { display: block; padding: 0 0.85rem 0.85rem; border-top: 1px solid var(--border); }
}

/* --- Formulaires --- */
.ul-form-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: var(--content-max);
    margin: 0 auto;
}

.ul-form-card.wide { max-width: 800px; }

.form-label { font-weight: 600; font-size: 0.875rem; color: var(--primary-dark); }

.char-counter { font-size: 0.75rem; color: var(--text-muted); text-align: right; }
.char-counter.warning { color: var(--warning); }
.char-counter.danger { color: var(--danger); }

/* --- Alertes --- */
.ul-alert {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius);
    margin-bottom: 0.65rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: opacity 0.3s;
}

.ul-alert-success { background: #d1fae5; color: var(--success); border: 1px solid #a7f3d0; }
.ul-alert-error { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.ul-alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.ul-alert-fade { opacity: 0; }

/* --- Footer compact --- */
.ul-footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.85);
    padding: 1.25rem 0 1rem;
    margin-top: auto;
    font-size: 0.85rem;
}

.ul-footer a { color: var(--gold-light); }
.ul-footer-brand { color: #fff; font-size: 1rem; }

@media (max-width: 767px) {
    .ul-footer .row > div { margin-bottom: 0.75rem; }
    .ul-footer .row > div:last-child { margin-bottom: 0; }
}

/* --- FAB mobile : poser une question --- */
.ul-fab {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1020;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--primary-dark);
    border: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    transition: transform var(--transition);
}

.ul-fab:hover { transform: scale(1.05); color: var(--primary-dark); }

@media (min-width: 768px) {
    .ul-fab { display: none; }
}

/* --- Retour haut --- */
.ul-back-top {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 1010;
    font-size: 1rem;
}

.ul-back-top.visible { opacity: 1; visibility: visible; }

@media (max-width: 767px) {
    .ul-back-top { bottom: calc(var(--mobile-nav-h, 3.75rem) + env(safe-area-inset-bottom, 0px) + 0.65rem); }
}

/* --- Profil --- */
.ul-profile-header {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.ul-profile-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold);
    margin-bottom: 0.65rem;
}

/* --- Table admin --- */
.ul-table-wrap {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    border: 1px solid var(--border);
    font-size: 0.85rem;
}

.ul-table-wrap th {
    background: #eef2f7;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* --- Animations légères --- */
[data-animate] {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

[data-animate].visible { opacity: 1; transform: translateY(0); }

/* --- Utilitaires --- */
.ul-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ul-page-head h1 { font-size: 1.1rem; margin: 0; }

.ul-result-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.ul-empty {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Cartes légères (formulaires, encarts isolés) */
.ul-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow);
}

/* ============================================================
   Pages connexion / inscription — layout split-screen
   ============================================================ */
.ul-auth-body {
    min-height: 100vh;
    background: var(--background);
}

.ul-auth-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.ul-auth-brand {
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 55%, #0f1f33 100%);
    color: #fff;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.ul-auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(201, 162, 39, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.ul-auth-brand > * { position: relative; z-index: 1; }

.ul-auth-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    color: #fff !important;
    text-decoration: none;
    margin-bottom: 1.5rem;
}

.ul-auth-brand-link i {
    font-size: 2.25rem;
    color: var(--gold);
}

.ul-auth-brand-link strong {
    display: block;
    font-size: 1.5rem;
    letter-spacing: 0.02em;
}

.ul-auth-brand-link span {
    display: block;
    font-size: 0.85rem;
    opacity: 0.85;
    font-weight: 400;
}

.ul-auth-tagline {
    font-size: 0.95rem;
    line-height: 1.65;
    opacity: 0.92;
    max-width: 28rem;
    margin-bottom: 1.5rem;
}

.ul-auth-tagline em {
    color: var(--gold);
    font-style: normal;
    font-weight: 600;
}

.ul-auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ul-auth-features li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
    opacity: 0.9;
}

.ul-auth-features i {
    color: var(--gold);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ul-auth-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem 2.5rem;
}

.ul-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.5rem;
    box-shadow: 0 8px 32px rgba(30, 58, 95, 0.1);
}

.ul-auth-card h1 {
    font-size: 1.45rem;
    margin: 0 0 0.25rem;
    color: var(--primary-dark);
}

.ul-auth-sub {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.ul-auth-form .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 0.3rem;
}

.ul-auth-form .form-control,
.ul-auth-form .input-group-text {
    border-color: var(--border);
    font-size: 0.9rem;
}

.ul-auth-form .input-group-text {
    background: #f8fafc;
    color: var(--primary);
}

.ul-auth-form .input-group:focus-within .input-group-text {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.ul-auth-form .btn.ul-btn-primary {
    padding: 0.55rem 1rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.ul-auth-switch {
    text-align: center;
    font-size: 0.875rem;
    margin: 1.25rem 0 0;
    color: var(--text-muted);
}

.ul-auth-switch a {
    font-weight: 600;
}

.ul-auth-demo {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.75rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
}

.ul-auth-demo code {
    font-size: 0.72rem;
    background: #f1f5f9;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

@media (min-width: 992px) {
    .ul-auth-shell {
        flex-direction: row;
    }

    .ul-auth-brand {
        width: 44%;
        max-width: 520px;
        min-height: 100vh;
        padding: 3rem 2.5rem;
    }

    .ul-auth-panel {
        flex: 1;
        padding: 2rem;
    }

    .ul-auth-card {
        padding: 2rem 2.25rem;
    }
}

/* Select2 — harmonisation avec le thème ULIZO */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 31px;
    font-size: 0.875rem;
    border-color: var(--border) !important;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--primary-light) !important;
    box-shadow: 0 0 0 0.2rem rgba(45, 90, 138, 0.15);
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--border);
    font-size: 0.875rem;
}

.select2-results__group {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============================================================
   PWA + navigation mobile — mobile-first
   ============================================================ */

/* Safe area : encoches iPhone / barre gestuelle Android */
:root {
    --mobile-nav-h: 3.75rem;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Espace réservé en bas pour la barre de navigation mobile */
body.ul-has-mobile-nav .ul-main {
    padding-bottom: calc(var(--page-pad) + var(--mobile-nav-h) + var(--safe-bottom) + 1rem);
}

@media (min-width: 768px) {
    body.ul-has-mobile-nav .ul-main {
        padding-bottom: calc(var(--page-pad) + 4rem);
    }
}

/* --- Barre de navigation inférieure (style app native) --- */
.ul-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(30, 58, 95, 0.08);
    padding-bottom: var(--safe-bottom);
    min-height: calc(var(--mobile-nav-h) + var(--safe-bottom));
}

.ul-mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.4rem 0.25rem;
    min-height: var(--touch-min);
    color: var(--text-muted) !important;
    font-size: 0.65rem;
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition), background var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.ul-mobile-nav-item i {
    font-size: 1.25rem;
    line-height: 1;
}

.ul-mobile-nav-item.is-active {
    color: var(--primary) !important;
}

.ul-mobile-nav-item.is-active i {
    color: var(--primary-light);
}

.ul-mobile-nav-item--accent i {
    font-size: 1.45rem;
    color: var(--gold);
}

.ul-mobile-nav-item--accent.is-active i {
    color: var(--primary);
}

.ul-mobile-nav-item:active {
    background: #f3f4f6;
}

/* --- Bannière installation PWA --- */
.ul-pwa-install {
    position: fixed;
    bottom: calc(var(--mobile-nav-h) + var(--safe-bottom) + 0.5rem);
    left: 0.75rem;
    right: 0.75rem;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--primary-dark);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.ul-pwa-install[hidden] {
    display: none !important;
}

.ul-pwa-install-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.8rem;
}

.ul-pwa-install-text strong {
    font-size: 0.9rem;
    color: var(--gold-light);
}

.ul-pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.ul-pwa-install .ul-btn-outline {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
    min-width: 36px;
    padding: 0.25rem 0.5rem;
    font-size: 1.1rem;
    line-height: 1;
}

@media (min-width: 768px) {
    .ul-pwa-install {
        bottom: 1rem;
        left: auto;
        right: 1rem;
        max-width: 340px;
    }
}

/* --- Bandeau hors-ligne --- */
.ul-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--warning);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
    padding-top: calc(0.45rem + env(safe-area-inset-top, 0px));
    box-shadow: var(--shadow);
}

.ul-offline-banner[hidden] {
    display: none !important;
}

/* --- Mode standalone (app installée) : navbar plus compacte --- */
@media (display-mode: standalone) {
    .ul-header {
        padding-top: env(safe-area-inset-top, 0px);
    }

    .ul-navbar .navbar-toggler {
        /* Sur mobile installé, la bottom nav remplace une partie du menu */
    }
}

/* --- Ajustements mobile : fil de discussion plus compact --- */
@media (max-width: 479px) {
    .ul-thread {
        grid-template-columns: 48px 1fr;
        gap: 0.5rem;
        padding: 0.55rem 0.65rem;
    }

    .ul-thread-title {
        font-size: 0.9rem;
    }

    .ul-thread-excerpt {
        display: none;
    }

    .ul-page-head h1 {
        font-size: 1rem;
    }

    .ul-form-card,
    .ul-auth-card {
        padding: 1.25rem 1rem;
    }

    .ul-table-wrap {
        font-size: 0.78rem;
    }
}

/* Footer : masquer colonnes secondaires sur mobile (bottom nav = navigation principale) */
@media (max-width: 767px) {
    .ul-footer {
        padding-bottom: calc(1rem + var(--safe-bottom));
        font-size: 0.8rem;
    }

    .ul-footer .row > div:nth-child(n+2) {
        display: none;
    }
}
