/* =====================================================
   JMB Travels Management System — Thème d'administration
   Design plat inspiré de Flatkit : épuré, aéré, typographie soignée
   ===================================================== */

:root {
    --jmb-brand: #5f2712;          /* brun du logo */
    --jmb-brand-dark: #43190a;
    --jmb-brand-light: #8d4a25;
    --jmb-gold: #f2a71b;           /* or du logo */
    --jmb-gold-soft: rgba(242, 167, 27, .12);
    --jmb-sidebar-bg: #251008;
    --jmb-sidebar-width: 240px;
    --jmb-topbar-height: 58px;
    --jmb-body-bg: #f4f6f8;
    --jmb-text: #37474f;
    --jmb-text-muted: #78909c;
    --jmb-heading: #263238;
    --jmb-border: #e8ecef;
}

html { font-size: 14px; }

body {
    background: var(--jmb-body-bg);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: .9286rem; /* 13px */
    color: var(--jmb-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--jmb-heading);
    font-weight: 600;
    letter-spacing: -.01em;
}
h5 { font-size: 1.07rem; }

a { color: var(--jmb-brand-light); }
a:hover { color: var(--jmb-brand); }

.app-wrapper { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.app-sidebar {
    width: var(--jmb-sidebar-width);
    background: var(--jmb-sidebar-bg);
    color: rgba(255, 255, 255, .65);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    transition: margin-left .25s ease;
}
.app-sidebar.collapsed { margin-left: calc(-1 * var(--jmb-sidebar-width)); }

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    padding: 1.4rem 1rem 1.1rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: .01em;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.sidebar-brand i { font-size: 2.4rem; color: var(--jmb-gold); }
.sidebar-brand strong { color: var(--jmb-gold); font-weight: 700; }
.brand-logo {
    width: 104px;
    height: 104px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 5px 14px rgba(0, 0, 0, .45));
    /* Le logo reste strictement statique : aucune animation ni transition */
    animation: none !important;
    transition: none !important;
}
.login-brand-logo, .receipt-logo, .report-logo {
    animation: none !important;
    transition: none !important;
}

.sidebar-heading {
    padding: 1.1rem 1.25rem .45rem;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: rgba(255, 255, 255, .35);
}

.sidebar-nav { flex: 1; padding-bottom: .75rem; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 5px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: .1rem .6rem;
    padding: .56rem .65rem;
    color: rgba(255, 255, 255, .65);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    border-radius: .5rem;
    transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 1rem; width: 1.3rem; text-align: center; opacity: .85; }
.sidebar-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-link.active {
    background: var(--jmb-gold-soft);
    color: var(--jmb-gold);
}
.sidebar-link.active i { opacity: 1; }

.sidebar-footer {
    padding: .8rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
    color: rgba(255, 255, 255, .35);
    font-size: .75rem;
}

/* ---------- Zone principale ---------- */
.app-main {
    flex: 1;
    margin-left: var(--jmb-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .25s ease;
}
.app-sidebar.collapsed + .app-main { margin-left: 0; }

.app-topbar {
    height: var(--jmb-topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--jmb-border);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.sidebar-toggle { color: var(--jmb-heading); font-size: 1.3rem; padding: 0 .4rem; text-decoration: none; }
.topbar-title { font-weight: 600; font-size: 1rem; margin-left: .4rem; color: var(--jmb-heading); }

/* ---------- Barre de recherche globale ---------- */
.topbar-search { position: relative; flex: 1 1 auto; max-width: 440px; }
.topbar-search .search-icon {
    position: absolute;
    left: .8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--jmb-text-muted);
    pointer-events: none;
    font-size: .9rem;
}
.topbar-search .form-control {
    padding-left: 2.3rem;
    background: #f4f6f8;
    border-color: transparent;
    border-radius: 2rem;
    transition: all .2s ease;
}
.topbar-search .form-control:focus {
    background: #fff;
    border-color: var(--jmb-gold);
    box-shadow: 0 0 0 .2rem rgba(242, 167, 27, .18);
}
.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--jmb-border);
    border-radius: .65rem;
    overflow: hidden;
    z-index: 1050;
    animation: fadeInUp .18s ease both;
}
.search-results.show { display: block; }
.search-section {
    padding: .5rem .9rem .25rem;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--jmb-text-muted);
    background: #fafbfc;
}
.search-item {
    display: block;
    padding: .5rem .9rem;
    text-decoration: none;
    color: var(--jmb-text);
    transition: background .12s;
}
.search-item:hover { background: #faf7f2; color: var(--jmb-brand); }
.search-empty { padding: .9rem; text-align: center; color: var(--jmb-text-muted); font-size: .85rem; }
.search-all {
    display: block;
    padding: .55rem .9rem;
    text-align: center;
    font-size: .82rem;
    font-weight: 600;
    color: var(--jmb-brand);
    text-decoration: none;
    border-top: 1px solid #f0f3f5;
    background: #fafbfc;
}
.search-all:hover { background: var(--jmb-gold-soft); }

/* ---------- Cloche de rappels ---------- */
.topbar-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--jmb-border);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--jmb-text);
    transition: all .15s ease;
    padding: 0;
}
.topbar-icon-btn:hover { background: #faf7f2; border-color: var(--jmb-gold); color: var(--jmb-brand); }
.topbar-icon-btn.has-notif { color: var(--jmb-brand); border-color: rgba(242, 167, 27, .5); }
.topbar-icon-btn.has-notif i { animation: bellRing 2.4s ease-in-out infinite; transform-origin: top center; }
@keyframes bellRing {
    0%, 60%, 100% { transform: rotate(0); }
    62% { transform: rotate(13deg); }
    66% { transform: rotate(-11deg); }
    70% { transform: rotate(8deg); }
    74% { transform: rotate(-5deg); }
    78% { transform: rotate(2deg); }
    82% { transform: rotate(0); }
}
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #e53935;
    color: #fff;
    font-size: .66rem;
    font-weight: 700;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: softPulse 1.8s ease-in-out infinite;
}
.notif-menu { width: 340px; padding: 0; overflow: hidden; }
.notif-header {
    padding: .7rem 1rem;
    font-weight: 600;
    font-size: .875rem;
    border-bottom: 1px solid #f0f3f5;
    background: #fafbfc;
    color: var(--jmb-heading);
}
.notif-header i { color: var(--jmb-gold); }
.notif-empty { padding: 1.4rem 1rem; text-align: center; color: var(--jmb-text-muted); font-size: .85rem; }
.notif-list { max-height: 330px; overflow-y: auto; }
.notif-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem 1rem;
    text-decoration: none;
    color: var(--jmb-text);
    border-bottom: 1px solid #f6f8f9;
    transition: background .12s;
    font-size: .84rem;
}
.notif-item:hover { background: #faf7f2; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.notif-footer { padding: .5rem 1rem; background: #fafbfc; text-align: center; }

.user-chip {
    display: flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid var(--jmb-border);
    border-radius: 2rem;
    padding: .2rem .7rem .2rem .2rem;
    background: #fff;
    font-size: .85rem;
    font-weight: 500;
    color: var(--jmb-text);
}
.user-chip:hover { border-color: #d5dce1; background: #fafbfc; }
.avatar {
    width: 30px;
    height: 30px;
    background: var(--jmb-brand);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .8rem;
}

.app-content { flex: 1; padding: 1.5rem 1.75rem; }
.app-footer {
    padding: .8rem 1.75rem;
    border-top: 1px solid var(--jmb-border);
    color: var(--jmb-text-muted);
    font-size: .8rem;
    background: #fff;
}

/* ---------- Cartes ---------- */
.card {
    border: 1px solid var(--jmb-border);
    border-radius: .65rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid #f0f3f5;
    font-weight: 600;
    font-size: .9rem;
    color: var(--jmb-heading);
    padding: .85rem 1.25rem;
}
.card-header i { color: var(--jmb-brand-light); }
.card-footer { background: #fafbfc; border-top: 1px solid #f0f3f5; }

/* ---------- Cartes statistiques ---------- */
.stat-card { height: 100%; transition: transform .15s ease, box-shadow .15s ease; }
a .stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, .08); }
.stat-card .icon {
    width: 44px;
    height: 44px;
    border-radius: .7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.stat-card .value { font-size: 1.4rem; font-weight: 700; color: var(--jmb-heading); line-height: 1.2; }
.stat-card .label { color: var(--jmb-text-muted); font-size: .78rem; font-weight: 500; }

/* ---------- Tableaux ---------- */
.table { color: var(--jmb-text); }
.table > :not(caption) > * > * { padding: .68rem .85rem; }
.table thead th {
    background: #fafbfc;
    color: var(--jmb-text-muted);
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--jmb-border);
    white-space: nowrap;
}
.table td { font-size: .875rem; border-color: #f0f3f5; }
.table-hover tbody tr:hover { background: #faf7f2; }
.table .badge { font-size: .72rem; }

/* ---------- Boutons ---------- */
.btn { font-size: .85rem; font-weight: 500; border-radius: .45rem; }
.btn-sm { font-size: .78rem; border-radius: .4rem; }

.btn-primary {
    background: var(--jmb-brand);
    border-color: var(--jmb-brand);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--jmb-brand-dark) !important;
    border-color: var(--jmb-brand-dark) !important;
}
.btn-outline-primary {
    color: var(--jmb-brand);
    border-color: var(--jmb-brand-light);
}
.btn-outline-primary:hover, .btn-outline-primary:active {
    background: var(--jmb-brand) !important;
    border-color: var(--jmb-brand) !important;
    color: #fff;
}
.btn-outline-secondary { color: #607d8b; border-color: #cfd8dc; }
.btn-outline-secondary:hover { background: #eceff1; color: #455a64; border-color: #cfd8dc; }

/* ---------- Formulaires ---------- */
.form-label {
    font-size: .8rem;
    font-weight: 500;
    color: #546e7a;
    margin-bottom: .3rem;
}
.form-control, .form-select {
    font-size: .875rem;
    border-color: #d9e0e5;
    border-radius: .45rem;
    color: var(--jmb-text);
}
.form-control:focus, .form-select:focus {
    border-color: var(--jmb-gold);
    box-shadow: 0 0 0 .2rem rgba(242, 167, 27, .18);
}
.input-group-text { background: #fafbfc; border-color: #d9e0e5; color: var(--jmb-text-muted); }
.form-check-input:checked { background-color: var(--jmb-brand); border-color: var(--jmb-brand); }
.form-check-input:focus { border-color: var(--jmb-gold); box-shadow: 0 0 0 .2rem rgba(242, 167, 27, .18); }

/* ---------- Pagination ---------- */
.page-link { color: var(--jmb-brand); font-size: .82rem; }
.page-item.active .page-link { background: var(--jmb-brand); border-color: var(--jmb-brand); }
.page-link:focus { box-shadow: 0 0 0 .2rem rgba(95, 39, 18, .15); }

/* ---------- Divers ---------- */
.alert { border-radius: .55rem; font-size: .875rem; }
.progress { height: 8px; border-radius: 1rem; background: #eef1f4; }
.required::after { content: " *"; color: #e53935; }
.badge { font-weight: 500; letter-spacing: .01em; }
.dropdown-menu { font-size: .875rem; border-color: var(--jmb-border); border-radius: .55rem; }
.text-muted { color: var(--jmb-text-muted) !important; }
hr { border-color: var(--jmb-border); opacity: 1; }

@media (max-width: 991.98px) {
    .app-sidebar { margin-left: calc(-1 * var(--jmb-sidebar-width)); }
    .app-sidebar.show-mobile { margin-left: 0; box-shadow: 0 0 30px rgba(0, 0, 0, .35); }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 1rem; }
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
@keyframes softPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.09); }
}
@keyframes growX {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Entrée en fondu du contenu de chaque page */
.app-content > * { animation: fadeInUp .5s ease both; }
.app-content > *:nth-child(2) { animation-delay: .08s; }
.app-content > *:nth-child(3) { animation-delay: .16s; }
.app-content > *:nth-child(4) { animation-delay: .24s; }
.app-content > *:nth-child(5) { animation-delay: .32s; }

/* Cartes statistiques : apparition en cascade + icône qui pulse en continu */
.row > [class*="col"]:nth-child(1) .stat-card { animation: fadeInUp .5s ease .05s both; }
.row > [class*="col"]:nth-child(2) .stat-card { animation: fadeInUp .5s ease .12s both; }
.row > [class*="col"]:nth-child(3) .stat-card { animation: fadeInUp .5s ease .19s both; }
.row > [class*="col"]:nth-child(4) .stat-card { animation: fadeInUp .5s ease .26s both; }
.row > [class*="col"]:nth-child(5) .stat-card { animation: fadeInUp .5s ease .33s both; }
.row > [class*="col"]:nth-child(6) .stat-card { animation: fadeInUp .5s ease .40s both; }
.stat-card .icon { animation: softPulse 3.2s ease-in-out infinite; }
.stat-card:hover .icon { animation-duration: 1.1s; }

/* Survols animés */
.card { transition: box-shadow .2s ease, transform .2s ease; }
.btn { transition: all .18s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(16, 24, 40, .12); }
.btn:active { transform: translateY(0); }
.sidebar-link i { transition: transform .2s ease; }
.sidebar-link:hover i { transform: translateX(3px) scale(1.12); }
.table-hover tbody tr { transition: background .15s ease; }
.user-chip { transition: border-color .15s ease, background .15s ease; }
.page-link { transition: all .15s ease; }

/* Barres de progression : remplissage animé */
.progress-bar {
    transform-origin: left;
    animation: growX 1.2s cubic-bezier(.25, .8, .25, 1) both;
}

/* Badges de statut : léger effet brillant continu */
.badge.text-bg-warning, .badge.text-bg-danger {
    background-image: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%);
    background-size: 200% 100%;
    animation: shimmer 3.5s linear infinite;
}

/* Respect des préférences d'accessibilité */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ---------- Page de connexion ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    /* Dégradé de secours si la vidéo ne charge pas */
    background: linear-gradient(135deg, var(--jmb-brand-dark) 0%, var(--jmb-brand) 55%, var(--jmb-gold) 160%);
}
.login-video {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: 0;
}
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: linear-gradient(135deg, rgba(37, 16, 8, .78) 0%, rgba(95, 39, 18, .55) 60%, rgba(242, 167, 27, .25) 130%);
}
.login-card {
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: .9rem;
    animation: fadeInUp .55s ease both;
    position: relative;
    z-index: 2;
    /* Effet verre : légèrement transparent, la vidéo reste visible derrière */
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.login-card .form-control,
.login-card .input-group-text {
    background: rgba(255, 255, 255, .82);
}
.login-logo { font-size: 2.5rem; color: var(--jmb-brand); }
.login-brand-logo { width: 160px; height: 160px; object-fit: contain; }
