/* IFY PAY - Thème banque (vert) + Mobile app-like */

:root {
    /* Palette verte type banque en ligne */
    --primary-color: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #14b8a6;
    --secondary-color: #6c757d;
    --success-color: #059669;
    --danger-color: #dc3545;
    --warning-color: #d97706;
    --info-color: #0891b2;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    /* Mobile: hauteur barre nav bas */
    --mobile-bottom-nav-height: 64px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Global Styles — scroll toujours actif */
html {
    overflow-x: hidden;
    overflow-y: scroll;
    height: 100%;
}
body {
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100%;
}
/* Verrouillage du scroll uniquement quand le drawer est ouvert */
body.sidebar-drawer-open {
    overflow: hidden !important;
}

/* Pagination (Laravel) : limiter la taille des flèches SVG pour qu'elles ne paraissent pas trop grandes */
nav[aria-label="Pagination Navigation"] svg,
nav[role="navigation"] svg.w-5,
.pagination svg,
.card-footer nav svg {
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem;
    min-height: 1rem;
    flex-shrink: 0;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #0d9488 0%, #059669 100%);
}

/* Override Bootstrap primary → vert banque */
.navbar.bg-primary,
.bg-primary {
    background-color: var(--primary-color) !important;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
}
.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}
.btn-primary:hover {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}
.text-primary {
    color: var(--primary-color) !important;
}
.border-primary { border-color: var(--primary-color) !important; }
.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}
.nav-link.active { background-color: var(--primary-color) !important; color: #fff !important; }
.badge.bg-primary { background-color: var(--primary-color) !important; }
.page-link { color: var(--primary-color); }
.page-item.active .page-link { background-color: var(--primary-color); border-color: var(--primary-color); }
.link-primary { color: var(--primary-color) !important; }
.link-primary:hover { color: var(--primary-dark) !important; }

/* Navigation */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* Vues détail & liste - style pro */
.card.border-0.shadow-sm .card-header.bg-light {
    background-color: #f8f9fa !important;
    padding: 0.75rem 1rem;
    font-weight: 600;
}
.table-responsive .table thead.table-light th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: none;
}
.breadcrumb {
    font-size: 0.875rem;
}
.detail-recap .card-body {
    padding: 0.75rem 1rem;
}
.detail-recap small.text-uppercase {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
}

/* Forms */
.form-control {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}

.input-group-text {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    color: #6c757d;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--dark-color);
    background-color: rgba(0, 0, 0, 0.03);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
}

.alert-success {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.alert-info {
    background-color: rgba(13, 202, 240, 0.1);
    color: #055160;
}

/* Sidebar Navigation */
.nav-sidebar .nav-link {
    color: #6c757d;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: all 0.3s ease;
}

.nav-sidebar .nav-link:hover {
    background-color: #f8f9fa;
    color: #495057;
}

.nav-sidebar .nav-link.active {
    background-color: var(--primary-color) !important;
    color: white !important;
}

/* Dashboard Stats */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Wallet Cards */
.wallet-card {
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.wallet-card:hover {
    border-left-color: var(--success-color);
    transform: translateX(5px);
}

.wallet-card .currency {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.wallet-card .balance {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
}

/* Transaction Items */
.transaction-item {
    border-left: 4px solid transparent;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.transaction-item:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    transform: translateX(5px);
}

.transaction-item.deposit {
    border-left-color: var(--success-color);
}

.transaction-item.withdrawal {
    border-left-color: var(--warning-color);
}

.transaction-item.transfer {
    border-left-color: var(--info-color);
}

/* KYC Status */
.kyc-status {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.kyc-status.verified {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.kyc-status.pending {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.kyc-status.rejected {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Admin Dashboard */
.admin-sidebar {
    background-color: #f8f9fa;
    min-height: calc(100vh - 56px);
    border-right: 1px solid #dee2e6;
}

.admin-content {
    background-color: white;
    min-height: calc(100vh - 56px);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 0.125rem solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* ========== MOBILE APP-LIKE (max 768px) ========== */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.25rem;
    }
    
    .wallet-card .balance {
        font-size: 1.1rem;
    }

    /* Contenu principal: marge basse pour la barre de navigation du bas */
    body.has-mobile-nav main {
        padding-bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom) + 1rem);
    }

    /* Cartes plus compactes sur mobile */
    .card-body {
        padding: 0.75rem !important;
    }
    .card .card-header {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.95rem;
    }
    .card h5, .card .h5 {
        font-size: 1rem;
    }
    .card h4, .card .h4 {
        font-size: 1.1rem;
    }

    /* Footer masqué en mode mobile (optionnel: garder mais compact) */
    footer .row > div {
        margin-bottom: 1rem;
    }
    footer {
        padding-top: 1.5rem !important;
        padding-bottom: calc(1rem + var(--safe-area-bottom)) !important;
    }
}

/* Layout mobile : barre du bas toujours visible + marge main */
body.layout-mobile .mobile-bottom-nav {
    display: block !important;
}
body.layout-mobile main {
    padding-bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom) + 1.5rem) !important;
}
body.layout-mobile footer {
    margin-bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom)) !important;
}

/* Barre de navigation du bas (mobile, type app native) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom));
    background: #fff;
    border-top: 1px solid #e5e7eb;
    z-index: 1030;
    padding-bottom: var(--safe-area-bottom);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}
.mobile-bottom-nav .nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: var(--mobile-bottom-nav-height);
    max-width: 100%;
}
.mobile-bottom-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.25rem;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
    border-radius: 0.5rem;
    margin: 0 2px;
}
.mobile-bottom-nav .nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.2rem;
    display: block;
}
.mobile-bottom-nav .nav-item:hover,
.mobile-bottom-nav .nav-item:focus {
    color: var(--primary-color);
    background: rgba(13, 148, 136, 0.08);
}
.mobile-bottom-nav .nav-item.active {
    color: var(--primary-color);
}
.mobile-bottom-nav .nav-item button,
.mobile-bottom-nav .nav-item.btn-sidebar-open {
    cursor: pointer;
    font-family: inherit;
}
.mobile-bottom-nav .nav-item.btn-sidebar-open.active,
.mobile-bottom-nav .nav-item.btn-sidebar-open:active {
    color: var(--primary-color);
}

/* Menu hamburger mobile (drawer) */
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s;
}
.mobile-drawer-overlay.show {
    opacity: 1;
}
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 85vw);
    height: 100%;
    background: #fff;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    overflow-y: auto;
    padding-top: env(safe-area-inset-top);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}
.mobile-drawer.show {
    transform: translateX(0);
}
.mobile-drawer .drawer-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mobile-drawer .drawer-body .nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    color: #374151;
    border-radius: 0;
    margin: 0;
}
.mobile-drawer .drawer-body .nav-link i {
    width: 1.5rem;
    margin-right: 0.75rem;
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* Menu latéral unique (drawer hamburger) — desktop et mobile. Toujours hors flux (body). */
.sidebar-drawer-overlay {
    display: none;
    position: fixed !important;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s, visibility 0.25s;
}
.sidebar-drawer-overlay.show {
    display: block !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.sidebar-drawer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: min(300px, 85vw);
    height: 100%;
    min-height: 100vh;
    background: #fff;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out, visibility 0.25s;
    overflow-y: auto;
    padding-top: env(safe-area-inset-top);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    visibility: hidden;
    pointer-events: none;
}
.sidebar-drawer.show {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}
.sidebar-drawer-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-drawer-body {
    padding: 0.5rem 0;
}
.sidebar-drawer-body .sidebar-menu-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: #374151;
    border-radius: 0;
    margin: 0;
    text-decoration: none;
}
.sidebar-drawer-body .sidebar-menu-nav .nav-link:hover {
    background: rgba(13, 148, 136, 0.08);
    color: var(--primary-color);
}
.sidebar-drawer-body .sidebar-menu-nav .nav-link.active {
    background: rgba(13, 148, 136, 0.12);
    color: var(--primary-color);
    font-weight: 600;
}
.sidebar-drawer-body .sidebar-menu-nav .nav-link i {
    width: 1.5rem;
    margin-right: 0.75rem;
    font-size: 1rem;
    color: var(--primary-color);
}

/* Bouton hamburger : toujours cliquable */
.btn-sidebar-open {
    cursor: pointer;
    z-index: 10;
    position: relative;
}
.btn-sidebar-open:focus {
    outline: 1px solid rgba(255,255,255,0.5);
    box-shadow: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block;
    }
    body.has-mobile-nav .navbar .navbar-collapse {
        max-height: 70vh;
        overflow-y: auto;
    }
}
@media (min-width: 769px) {
    .mobile-bottom-nav,
    .mobile-drawer-overlay {
        display: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #1a1a1a;
        --bs-body-color: #e9ecef;
    }
    
    .card {
        background-color: #2d2d2d;
        color: #e9ecef;
    }
    
    .table {
        color: #e9ecef;
    }
    
    .table th {
        background-color: #343a40;
        color: #e9ecef;
    }
}

/* Custom Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}
