/* Styles personnalisés pour l'interface moderne */

/* Variables CSS */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --border-radius: 0.375rem;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Layout général */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f8f9fa;
}

.navbar-brand {
    font-weight: 600;
}

/* Cards améliorées */
.card {
    border: none;
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
    transition: box-shadow 0.2s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    font-weight: 500;
}

/* Tables améliorées */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    border-top: none;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Badges personnalisés */
.badge {
    font-weight: 500;
    padding: 0.4em 0.6em;
}

/* Badges pour types de compte */
.bg-compte-epargne {
    background-color: #198754 !important;
    color: #ffffff !important;
}

.bg-compte-livret {
    background-color: #0d6efd !important;
    color: #ffffff !important;
}

.bg-compte-courant {
    background-color: #6c757d !important;
    color: #ffffff !important;
}

/* Progress bars */
.progress {
    background-color: #e9ecef;
    border-radius: var(--border-radius);
}

.progress-bar {
    background-color: var(--primary-color);
    border-radius: var(--border-radius);
}

/* Boutons */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
}

.btn-sm {
    font-size: 0.825rem;
}

/* Alertes */
.alert {
    border: none;
    border-radius: var(--border-radius);
}

/* Navigation active */
.nav-link.active {
    font-weight: 600;
}

/* Icônes */
.bi {
    vertical-align: -0.125em;
}

/* Responsive */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Loading states */
.spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Montants */
.montant-positif {
    color: var(--success-color);
    font-weight: 600;
}

.montant-negatif {
    color: var(--danger-color);
    font-weight: 600;
}

.montant-zero {
    color: #6c757d;
}

/* États des cartes statistiques */
.card.bg-primary .bi,
.card.bg-success .bi,
.card.bg-info .bi,
.card.bg-warning .bi,
.card.bg-danger .bi {
    font-size: 2rem;
    opacity: 0.7;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Autocomplete search suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1050;
    margin-top: 2px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.15);
    background-color: #fff;
    display: none; /* Masqué par défaut */
    border-radius: 0.25rem;
}

/* Afficher quand la classe .show est ajoutée */
.search-suggestions.show {
    display: block !important;
}

.search-suggestions .dropdown-item {
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease-in-out;
}

.search-suggestions .dropdown-item:hover,
.search-suggestions .dropdown-item.active {
    background-color: var(--bs-primary, #0d6efd);
    color: white;
}

.search-suggestions .dropdown-item strong {
    font-weight: 600;
}

/* ==========================================================================
   Z-index Hierarchy - Centralisée
   ========================================================================== */

:root {
    --z-navbar: 1030;
    --z-sticky-filters: 1020;
    --z-drawer-overlay: 1040;
    --z-drawer: 1050;
    --z-scroll-top: 999;
    --z-mini-sidebar: 900;
}

.navbar-top,
.navbar {
    z-index: var(--z-navbar);
}

#filters-card {
    position: sticky;
    top: 0;
    transition: box-shadow 0.2s ease;
}

#filters-card.sticky {
    z-index: var(--z-sticky-filters);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Inputs Colorés - Voir src/styles/ui-extras-override.css (chargé en dernier)
   ========================================================================== */

/* ==========================================================================
   Scroll To Top Button
   ========================================================================== */

.scroll-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-scroll-top);
}

.scroll-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transform: translateY(-5px);
}

.scroll-to-top-btn:active {
    transform: translateY(0);
}

.scroll-to-top-btn:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ==========================================================================
   Mini Sidebar
   ========================================================================== */

.mini-sidebar {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: var(--z-mini-sidebar);
}

.mini-sidebar.visible {
    opacity: 1;
    visibility: visible;
}

.mini-nav-link {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    background: white;
    border: 2px solid #e0e0e0;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mini-nav-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.mini-nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.mini-nav-link:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .scroll-to-top-btn {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }

    .mini-sidebar {
        display: none; /* Caché sur mobile */
    }

    /* Inputs sur mobile - spacing augmenté */
    input[type="number"],
    input[type="text"],
    input[type="date"],
    select.form-select {
        font-size: 16px; /* Prévient zoom auto sur iOS */
        padding: 12px 16px;
    }
}