@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700&family=Open+Sans:wght@300;400;600&display=swap');

/* ═══════════════════════════════════════════
   DESIGN SYSTEM — RETROUVAILLE.NET
   ═══════════════════════════════════════════ */

:root {
    /* Palette complète */
    --primary:    #1A6BB5;
    --primary-dk: #0d4a82;
    --secondary:  #D83F87;   /* Rose humain */
    --accent:     #C9942A;   /* Or souvenir */
    --success:    #1E8449;   /* Vert retrouvailles */
    --warning:    #D35400;   /* Orange prudence */
    --danger:     #C0392B;   /* Rouge signalement */
    --neutral-lt: #F2F3F4;
    --neutral-dk: #1C2833;
    --white:      #FFFFFF;

    /* Bootstrap overrides */
    --bs-primary:       var(--primary);
    --bs-primary-rgb:   26, 107, 181;
    --bs-success:       var(--success);
    --bs-danger:        var(--danger);
    --bs-warning:       var(--warning);
    --primary-hex:      1A6BB5;
    --primary-rgb:      26, 107, 181;
    --primary-color:    var(--primary);
    --primary-dark:     var(--primary-dk);
    --accent-color:     var(--accent);
    --secondary-color:  #6c757d;
    --bg-light:         var(--neutral-lt);
    --text-dark:        var(--neutral-dk);

    /* Layout */
    --sidebar-w:   240px;
    --sidebar-sm:  64px;
    --header-h:    60px;
    --tabbar-h:    64px;
    --radius-sm:   8px;
    --radius-md:   14px;
    --radius-lg:   24px;
    --shadow-sm:   0 1px 4px rgba(0,0,0,.08);
    --shadow-md:   0 4px 16px rgba(0,0,0,.12);
    --shadow-lg:   0 12px 32px rgba(0,0,0,.16);
}

/* ── Reset & base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    color: var(--neutral-dk);
    background: var(--neutral-lt);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-h);
}

/* ── Bootstrap colour overrides ──────────── */
.text-primary   { color: var(--primary)   !important; }
.text-secondary-brand { color: var(--secondary) !important; }
.text-accent    { color: var(--accent)    !important; }
.text-success   { color: var(--success)   !important; }
.text-warning-brand { color: var(--warning) !important; }
.text-danger    { color: var(--danger)    !important; }
.bg-primary     { background: var(--primary)    !important; }
.bg-success     { background: var(--success)    !important; }
.bg-danger      { background: var(--danger)     !important; }
.bg-warning     { background: var(--warning)    !important; }
.bg-accent      { background: var(--accent)     !important; }
.bg-secondary-brand { background: var(--secondary) !important; }
.border-primary { border-color: var(--primary) !important; }

/* ══════════════ TYPOGRAPHY ══════════════ */
h1, h2 { font-family: 'Montserrat', sans-serif; font-weight: 700; }
h3, h4 { font-family: 'Montserrat', sans-serif; font-weight: 600; }
.caption, .meta, .form-text, small { font-size: .8125rem; color: #666; }

/* ══════════════ LAYOUT — SIDEBAR ══════════════ */
#app-layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--header-h));
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid #e9ecef;
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 900;
    transition: width .25s;
    display: flex;
    flex-direction: column;
}
#sidebar .sidebar-brand {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: .5px;
}
#sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: .7rem 1.25rem;
    color: var(--neutral-dk);
    text-decoration: none;
    font-size: .875rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 2px .5rem 2px 0;
    transition: background .15s, color .15s;
}
#sidebar nav a:hover  { background: rgba(26,107,181,.07); color: var(--primary); }
#sidebar nav a.active { background: rgba(26,107,181,.12); color: var(--primary); font-weight: 600; }
#sidebar nav a .nav-icon { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }
#sidebar nav a .nav-label { white-space: nowrap; overflow: hidden; }
#sidebar nav .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    padding: 1px 5px;
    border-radius: 20px;
    font-weight: 700;
}
#sidebar .sidebar-footer { margin-top: auto; padding: 1rem; border-top: 1px solid #e9ecef; }

/* Main content area */
.pt-header { padding-top: 0; }

#main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 1.5rem;
    min-height: calc(100vh - var(--header-h));
    transition: margin-left .25s;
}
@media (max-width: 991px) {
    #sidebar { width: var(--sidebar-sm); }
    #sidebar nav a .nav-label,
    #sidebar nav .nav-badge,
    #sidebar .sidebar-brand span { display: none; }
    #sidebar nav a { justify-content: center; padding: .7rem; }
    #main-content { margin-left: var(--sidebar-sm); }
}
@media (max-width: 767px) {
    #sidebar { display: none; }
    #main-content { margin-left: 0; margin-bottom: var(--tabbar-h); }
}

/* ══════════════ HEADER ══════════════ */
#top-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: linear-gradient(100deg, #0d3d6e 0%, #1A6BB5 55%, #1e7fd4 100%);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    box-shadow: 0 2px 20px rgba(0,0,0,.25);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
/* shimmer animé sous le header */
#top-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #C9942A, var(--secondary), #C9942A, transparent);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

#top-header .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: .8px;
    flex-shrink: 0;
    white-space: nowrap;
    transition: opacity .2s;
}
#top-header .brand:hover { opacity: .85; }
#top-header .brand img {
    height: 34px;
    filter: drop-shadow(0 1px 4px rgba(0,0,0,.3));
    transition: transform .3s;
}
#top-header .brand:hover img { transform: rotate(-5deg) scale(1.05); }
#top-header .brand .brand-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #C9942A;
    display: inline-block;
    margin-left: 2px;
    box-shadow: 0 0 6px #C9942A;
}

#header-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}
#header-search input {
    width: 100%;
    border: 1.5px solid rgba(255,255,255,.18);
    border-radius: 50px;
    padding: .45rem 1.1rem .45rem 2.6rem;
    background: rgba(255,255,255,.12);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: .875rem;
    outline: none;
    transition: all .25s;
}
#header-search input::placeholder { color: rgba(255,255,255,.55); }
#header-search input:focus {
    background: rgba(255,255,255,.22);
    border-color: rgba(201,148,42,.6);
    box-shadow: 0 0 0 3px rgba(201,148,42,.15);
}
#header-search .search-icon {
    position: absolute;
    left: .9rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,.6);
    font-size: .8rem;
    pointer-events: none;
    transition: color .25s;
}
#header-search input:focus ~ .search-icon,
#header-search:focus-within .search-icon { color: #C9942A; }

@media (max-width: 575px) {
    #header-search { display: none; }
    #top-header .brand .brand-name { display: none; }
    #top-header { padding: 0 1rem; gap: .6rem; }
}
@media (max-width: 767px) { #header-search { max-width: 180px; } }

#header-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
#header-actions .hdr-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.15);
    background: rgba(255,255,255,.1);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all .2s;
    backdrop-filter: blur(4px);
}
#header-actions .hdr-btn:hover {
    background: rgba(255,255,255,.22);
    border-color: rgba(255,255,255,.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
#header-actions .hdr-btn .badge-dot {
    position: absolute;
    top: 5px; right: 5px;
    width: 8px; height: 8px;
    background: var(--secondary);
    border-radius: 50%;
    border: 2px solid #0d3d6e;
    box-shadow: 0 0 6px var(--secondary);
}
#user-menu img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(201,148,42,.7);
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 0 0 0 rgba(201,148,42,.4);
}
#user-menu img:hover {
    border-color: #C9942A;
    box-shadow: 0 0 0 3px rgba(201,148,42,.25);
    transform: scale(1.05);
}

/* ══════════════ MOBILE TAB BAR ══════════════ */
#tab-bar {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--tabbar-h);
    background: var(--white);
    border-top: 1px solid #e9ecef;
    z-index: 900;
    justify-content: space-around;
    align-items: center;
}
@media (max-width: 767px) { #tab-bar { display: flex; } }
.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #999;
    text-decoration: none;
    font-size: .65rem;
    padding: .4rem .2rem;
    transition: color .15s;
    position: relative;
}
.tab-item.active, .tab-item:hover { color: var(--primary); }
.tab-item .tab-icon { font-size: 1.2rem; }
.tab-item .tab-badge {
    position: absolute;
    top: 4px; right: calc(50% - 16px);
    background: var(--danger);
    color: #fff;
    font-size: .55rem;
    min-width: 14px; height: 14px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
    font-weight: 700;
}

/* ══════════════ CARDS ══════════════ */
.card {
    border: none;
    border-radius: var(--radius-md);
    transition: transform .2s, box-shadow .2s;
    overflow: hidden;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-profile { position: relative; }
.card-profile .match-pct {
    position: absolute;
    top: .75rem; right: .75rem;
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    color: #fff;
}
.match-high   { background: var(--success); }
.match-mid    { background: var(--warning); }
.match-low    { background: #999; }

/* ══════════════ BUTTONS ══════════════ */
.btn { border-radius: 30px; font-weight: 600; transition: all .18s; }
.btn-sm  { padding: .3rem .9rem;  font-size: .8rem; }
.btn-md  { padding: .5rem 1.2rem; font-size: .875rem; }  /* default */
.btn-lg  { padding: .75rem 2rem;  font-size: 1rem; }

.btn-primary   { background: var(--primary);   border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-dk); border-color: var(--primary-dk); }
.btn-secondary-brand { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.btn-secondary-brand:hover { opacity: .88; color: #fff; }
.btn-accent    { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-success   { background: var(--success); border-color: var(--success); }
.btn-danger    { background: var(--danger);  border-color: var(--danger); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Ghost */
.btn-ghost {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: .25rem .5rem;
}
.btn-ghost:hover { background: rgba(26,107,181,.08); }

/* Touch target minimum */
.btn, a.btn { min-height: 38px; }
@media (max-width: 767px) { .btn, a.btn { min-height: 48px; } }

/* ══════════════ FORMS ══════════════ */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid #dee2e6;
    font-size: .9rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,107,181,.15);
}
.form-label { font-weight: 600; font-size: .875rem; margin-bottom: .35rem; }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }
.invalid-feedback { color: var(--danger); font-size: .8rem; }
.valid-feedback   { color: var(--success); font-size: .8rem; }

/* ══════════════ BADGES ══════════════ */
.badge-verified { background: var(--primary);  color: #fff; }
.badge-tel      { background: var(--success);  color: #fff; }
.badge-premium  { background: var(--accent);   color: #fff; }
.badge-nouveau  { background: var(--secondary);color: #fff; }

/* ══════════════ SKELETON LOADING ══════════════ */
.skeleton {
    background: linear-gradient(90deg, #e2e5e7 25%, #eef0f2 50%, #e2e5e7 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 6px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ══════════════ TOASTS ══════════════ */
#toast-container {
    position: fixed;
    bottom: calc(var(--tabbar-h) + .75rem);
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: 320px;
}
@media (min-width: 768px) {
    #toast-container { top: calc(var(--header-h) + .75rem); bottom: auto; }
}
.toast-msg {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: .75rem 1rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: .75rem;
    animation: slideIn .25s ease;
    font-size: .875rem;
}
.toast-msg.success { border-left: 4px solid var(--success); }
.toast-msg.error   { border-left: 4px solid var(--danger); }
.toast-msg.info    { border-left: 4px solid var(--primary); }
.toast-msg.warning { border-left: 4px solid var(--warning); }
@keyframes slideIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:none} }

/* ══════════════ EMPTY STATES ══════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}
.empty-state .empty-icon {
    font-size: 3.5rem;
    opacity: .3;
    margin-bottom: 1rem;
}
.empty-state h5 { font-weight: 700; margin-bottom: .5rem; }
.empty-state p  { color: #888; max-width: 360px; }

/* ══════════════ HERO SECTION ══════════════ */
.hero-section {
    background:
        linear-gradient(135deg, rgba(26,107,181,.82) 0%, rgba(13,74,130,.88) 100%),
        url('../images/retrouvaille1.png') center center / cover no-repeat;
    color: #fff;
    padding: 90px 0;
    border-bottom-left-radius: 50px;
    border-bottom-right-radius: 50px;
}
@media (max-width: 768px) {
    .hero-section { padding: 60px 0; border-radius: 0 0 24px 24px; }
}

/* ══════════════ SEARCH BAR ══════════════ */
.search-bar {
    background: var(--white);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-top: -40px;
}

/* ══════════════ FEATURE ICON ══════════════ */
.feature-icon {
    width: 60px; height: 60px;
    background: rgba(26,107,181,.1);
    color: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

/* ══════════════ NAVBAR (fallback sans sidebar) ══════════════ */
.navbar { background: var(--primary) !important; }
.navbar-brand .brand-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 1.1rem;
}
.navbar-brand .brand-logo { height: 34px; }

/* ══════════════ AUTH PAGES ══════════════ */
.auth-logo { height: 50px; width: auto; margin: 0 auto 8px; display: block; }
.brand-logo-full { height: 26px; width: auto; object-fit: contain; }

/* ══════════════ PROGRESS / COMPLÉTUDE ══════════════ */
.progress { border-radius: 20px; }
.progress-bar { border-radius: 20px; transition: width .5s ease; }

/* ══════════════ LITE MODE ══════════════ */
body.lite-mode img:not([src*='ui-avatars']):not([src*='.svg']):not([src*='logo']) {
    display: none !important;
}
body.lite-mode .skeleton, body.lite-mode .hero-section { animation: none !important; }
body.lite-mode .card { box-shadow: none !important; border: 1px solid #ddd !important; }
body.lite-mode .search-bar { box-shadow: none; border: 1px solid #ddd; }

/* ══════════════ ACCESSIBILITÉ ══════════════ */
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
[aria-hidden="true"] { pointer-events: none; }

/* ══════════════ COMMON TAGS ══════════════ */
.common-tag {
    font-size: .7rem;
    background: rgba(26,107,181,.1);
    color: var(--primary);
    border-radius: 10px;
    padding: 2px 8px;
    display: inline-block;
}
.sort-pill {
    font-size: .75rem;
    cursor: pointer;
    border-radius: 16px;
    padding: 3px 10px;
    border: 1px solid #dee2e6;
    background: #fff;
}
.sort-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Hamburger mobile — visible seulement ≤767px */
@media (max-width: 767px) {
    #mob-menu-btn { display: flex !important; align-items: center; justify-content: center; }
    /* drawer et overlay sont gérés par JS — pas de display:none ici */
}
@media (min-width: 768px) {
    #mob-nav-drawer,
    #mob-nav-overlay,
    #mob-menu-btn { display: none !important; }
}

/* Footer — décalage sidebar (même logique que #main-content) */
body.sidebar-active footer {
    margin-left: var(--sidebar-w);
    transition: margin-left .25s;
}
@media (max-width: 991px) {
    body.sidebar-active footer { margin-left: var(--sidebar-sm); }
}
@media (max-width: 767px) {
    body.sidebar-active footer { margin-left: 0; margin-bottom: var(--tabbar-h); }
}
