/* ============================================================
   ANGALISHO FINANCE - DESIGN PRINCIPAL
   Institut Angalisho - Système de Gestion Financière
   ============================================================ */

/* --- VARIABLES DE COULEURS --- */
:root {
    --primary:        #1a3c5e;    /* Bleu foncé professionnel */
    --primary-light:  #2d6a9f;    /* Bleu moyen */
    --primary-dark:   #0f2440;    /* Bleu très foncé */
    --secondary:      #28a745;    /* Vert succès */
    --accent:         #f0a500;    /* Or/Jaune accent */
    --danger:         #dc3545;    /* Rouge danger */
    --warning:        #ffc107;    /* Orange avertissement */
    --info:           #17a2b8;    /* Bleu info */
    --light:          #f8f9fa;    /* Gris très clair */
    --dark:           #343a40;    /* Gris foncé */
    --white:          #ffffff;
    --sidebar-width:  260px;
    --header-height:  65px;
    --shadow:         0 2px 15px rgba(0,0,0,0.1);
    --shadow-hover:   0 5px 25px rgba(0,0,0,0.2);
    --radius:         10px;
    --radius-sm:      6px;
    --transition:     all 0.3s ease;
}

/* --- RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: var(--dark);
    font-size: 14px;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* ============================================================
   PAGE DE CONNEXION
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(
        135deg,
        var(--primary-dark) 0%,
        var(--primary) 50%,
        var(--primary-light) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Cercles décoratifs en arrière-plan */
.login-page::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    top: -100px;
    right: -100px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    bottom: -80px;
    left: -80px;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 45px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .school-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-light)
    );
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 35px;
    color: white;
    box-shadow: 0 5px 20px rgba(26,60,94,0.4);
}

.login-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

.login-logo p {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 25px;
    text-align: center;
}

/* --- FORMULAIRE --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    display: block;
}

.form-control {
    width: 100%;
    padding: 12px 15px 12px 42px;
    border: 2px solid #e8ecef;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: #fafafa;
    color: var(--dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 3px rgba(45,106,159,0.1);
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 16px;
    z-index: 1;
}

.btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-light)
    );
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.5px;
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(26,60,94,0.4);
}

.btn-login:active {
    transform: translateY(0);
}

/* ============================================================
   SIDEBAR (MENU LATÉRAL)
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(
        180deg,
        var(--primary-dark) 0%,
        var(--primary) 100%
    );
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    box-shadow: 3px 0 15px rgba(0,0,0,0.2);
}

.sidebar-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-logo {
    width: 55px;
    height: 55px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 24px;
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

.sidebar-school-name {
    color: white;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.sidebar-subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 3px;
}

/* --- MENU ITEMS --- */
.sidebar-menu {
    padding: 15px 0;
    list-style: none;
}

.menu-section-title {
    color: rgba(255,255,255,0.4);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 15px 20px 5px;
    font-weight: 600;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: rgba(255,255,255,0.75);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    gap: 12px;
}

.sidebar-menu li a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: var(--accent);
    padding-left: 25px;
}

.sidebar-menu li a.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: var(--accent);
    font-weight: 600;
}

.sidebar-menu li a i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.menu-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
}

/* ============================================================
   HEADER PRINCIPAL
   ============================================================ */
.main-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: white;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: var(--transition);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--primary);
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: var(--transition);
}

.btn-toggle-sidebar:hover {
    background: var(--light);
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-date {
    font-size: 12px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- USER DROPDOWN --- */
.user-dropdown {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--light);
    border: none;
    padding: 8px 15px;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
}

.user-btn:hover {
    background: #e2e6ea;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-light)
    );
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
}

.user-info {
    text-align: left;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.2;
}

.user-role {
    font-size: 11px;
    color: #888;
}

.dropdown-menu-custom {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    min-width: 200px;
    z-index: 1001;
    display: none;
    animation: fadeIn 0.2s ease;
    border: 1px solid #eee;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-menu-custom.show {
    display: block;
}

.dropdown-item-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--dark);
    font-size: 13px;
    transition: var(--transition);
}

.dropdown-item-custom:hover {
    background: var(--light);
    color: var(--primary);
}

.dropdown-divider-custom {
    border-top: 1px solid #eee;
    margin: 5px 0;
}

/* ============================================================
   CONTENU PRINCIPAL
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 25px;
    min-height: calc(100vh - var(--header-height));
    transition: var(--transition);
}

/* ============================================================
   CARTES STATISTIQUES (DASHBOARD)
   ============================================================ */
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 4px solid transparent;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-card.blue   { border-left-color: var(--primary-light); }
.stat-card.green  { border-left-color: var(--secondary); }
.stat-card.gold   { border-left-color: var(--accent); }
.stat-card.red    { border-left-color: var(--danger); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    margin-bottom: 15px;
}

.stat-icon.blue  { background: linear-gradient(135deg, #2d6a9f, #1a3c5e); }
.stat-icon.green { background: linear-gradient(135deg, #28a745, #1e7e34); }
.stat-icon.gold  { background: linear-gradient(135deg, #f0a500, #c87800); }
.stat-icon.red   { background: linear-gradient(135deg, #dc3545, #a71d2a); }

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-value.fc::after  { content: ' FC';  font-size: 14px; color: #888; }
.stat-value.usd::before { content: '$ '; font-size: 16px; color: #888; }

.stat-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

.stat-change {
    font-size: 12px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-change.up   { color: var(--secondary); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   CARTES GÉNÉRALES
   ============================================================ */
.card-custom {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header-custom {
    padding: 18px 25px;
    background: white;
    border-bottom: 2px solid #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-custom h5 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body-custom {
    padding: 25px;
}

/* ============================================================
   TABLEAUX
   ============================================================ */
.table-custom {
    width: 100%;
    border-collapse: collapse;
}

.table-custom thead th {
    background: #f8f9fa;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 15px;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 13px 15px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 13.5px;
    color: var(--dark);
    vertical-align: middle;
}

.table-custom tbody tr:hover {
    background: #f8f9fa;
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   BADGES & STATUTS
   ============================================================ */
.badge-custom {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: #cce5ff; color: #004085; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn-primary-custom {
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-light)
    );
    color: white;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26,60,94,0.3);
    color: white;
}

.btn-success-custom {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-success-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40,167,69,0.3);
    color: white;
}

.btn-danger-custom {
    background: linear-gradient(135deg, #dc3545, #a71d2a);
    color: white;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-danger-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220,53,69,0.3);
    color: white;
}

.btn-sm-custom {
    padding: 5px 12px;
    font-size: 12px;
}

/* ============================================================
   ALERTES / MESSAGES
   ============================================================ */
.alert-custom {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.alert-danger  { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }
.alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }
.alert-info    { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }

/* ============================================================
   COMPTE FC/USD CARDS
   ============================================================ */
.compte-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    height: 100%;
}

.compte-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.compte-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.compte-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.devise-tabs {
    display: flex;
    background: #f0f2f5;
    border-radius: 20px;
    padding: 3px;
    margin-bottom: 10px;
}

.devise-tab {
    flex: 1;
    text-align: center;
    padding: 6px 12px;
    border-radius: 17px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: transparent;
}

.devise-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.solde-amount {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.solde-devise {
    font-size: 13px;
    color: #888;
    margin-left: 5px;
}

/* ============================================================
   FORMULAIRES DANS LES PAGES
   ============================================================ */
.form-section {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.form-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-control-custom {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e8ecef;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    transition: var(--transition);
    background: #fafafa;
    color: var(--dark);
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 3px rgba(45,106,159,0.1);
}

.form-label-custom {
    font-size: 12.5px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    display: block;
}

.form-text-custom {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
}

/* ============================================================
   RESPONSIVE MOBILE
   ============================================================ */
@media (max-width: 768px) {

    .sidebar {
        left: calc(-1 * var(--sidebar-width));
    }

    .sidebar.open {
        left: 0;
    }

    .main-header {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .login-card {
        padding: 30px 20px;
    }

    .stat-value {
        font-size: 20px;
    }

    .page-title {
        font-size: 15px;
    }

    .header-date {
        display: none;
    }

    /* Overlay quand sidebar ouverte sur mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 480px) {
    .stat-card {
        margin-bottom: 15px;
    }

    .card-body-custom {
        padding: 15px;
    }

    .user-info {
        display: none;
    }
}

/* ============================================================
   SCROLLBAR PERSONNALISÉE
   ============================================================ */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

/* ============================================================
   UTILITAIRES
   ============================================================ */
.text-fc  { color: var(--primary);   font-weight: 700; }
.text-usd { color: var(--secondary); font-weight: 700; }
.text-muted-custom { color: #888; font-size: 12px; }

.divider {
    border: none;
    border-top: 2px solid #f0f2f5;
    margin: 20px 0;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #aaa;
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 15px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}