/* ============================================
   STYLES GÉNÉRAUX
   ============================================ */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #16a085;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container-fluid {
    padding: 0;
}

/* ============================================
   PAGE DE LOGIN
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255,255,255,.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,.1) 0%, transparent 50%);
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
}

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

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--dark-color) 100%);
    padding: 40px 30px;
    text-align: center;
    color: white;
}

.login-header .logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0,0,0,.2);
}

.login-header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 5px;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
}

.login-body {
    padding: 40px 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
    font-size: 14px;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 18px;
}

.form-control {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

.form-check label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
}

.btn-login:active {
    transform: translateY(0);
}

.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-danger {
    background-color: #fee;
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--dark-color) 100%);
    color: white;
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.1);
    background: rgba(0,0,0,.2);
}

.sidebar-logo {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 24px;
    color: var(--primary-color);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    display: none;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.menu-item {
    margin-bottom: 5px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,.8);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.menu-link:hover {
    background: rgba(255,255,255,.1);
    color: white;
}

.menu-link.active {
    background: var(--secondary-color);
    color: white;
}

.menu-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: white;
}

.menu-icon {
    min-width: 30px;
    font-size: 20px;
    text-align: center;
}

.menu-text {
    margin-left: 15px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    display: none;
}

.menu-badge {
    margin-left: auto;
    background: var(--danger-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.sidebar.collapsed .menu-badge {
    display: none;
}

/* Sous-menus */
.menu-item.has-submenu > .menu-link {
    position: relative;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.menu-item.has-submenu.open > .menu-link .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,.2);
}

.menu-item.has-submenu.open .submenu {
    max-height: 500px;
}

.submenu li {
    border-left: 3px solid rgba(255,255,255,.2);
    margin-left: 30px;
}

.submenu-link {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 15px;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
}

.submenu-link i {
    margin-right: 10px;
    font-size: 14px;
    width: 20px;
}

.submenu-link:hover {
    color: white;
    background: rgba(255,255,255,.05);
    border-left-color: var(--secondary-color);
}

.submenu-link.active {
    color: white;
    background: rgba(255,255,255,.1);
    border-left-color: var(--secondary-color);
    font-weight: 600;
}

.sidebar.collapsed .submenu-arrow {
    display: none;
}

.sidebar.collapsed .submenu {
    display: none;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,.1);
    background: rgba(0,0,0,.2);
}

.user-info {
    display: flex;
    align-items: center;
    padding: 10px;
    background: rgba(255,255,255,.05);
    border-radius: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--secondary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 10px;
}

.sidebar.collapsed .user-avatar {
    margin-right: 0;
}

.user-details {
    flex: 1;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .user-details {
    opacity: 0;
    display: none;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    display: block;
}

.user-role {
    font-size: 11px;
    opacity: 0.7;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* HEADER */
.main-header {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
}

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-color);
    cursor: pointer;
    margin-right: 20px;
    padding: 5px;
    transition: all 0.3s ease;
}

.toggle-sidebar:hover {
    color: var(--secondary-color);
    transform: scale(1.1);
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-icon {
    position: relative;
    width: 40px;
    height: 40px;
    background: var(--light-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.header-icon:hover {
    background: var(--secondary-color);
    color: white;
}

.header-icon .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* MAIN BODY */
.main-body {
    padding: 30px;
}

.welcome-section {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: white;
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,.1);
}

.welcome-section h2 {
    font-size: 32px;
    margin-bottom: 10px;
}

.welcome-section p {
    font-size: 16px;
    opacity: 0.9;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,.15);
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 15px;
}

.card-icon.blue {
    background: rgba(52, 152, 219, 0.1);
    color: var(--secondary-color);
}

.card-icon.green {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success-color);
}

.card-icon.orange {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning-color);
}

.card-icon.red {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

.card-content h3 {
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
    font-weight: 500;
}

.card-content .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

/* ============================================
   RESPONSIVE DESIGN (PDA / MOBILE)
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .sidebar-title,
    .menu-text,
    .menu-badge,
    .user-details {
        display: none;
    }
    
    .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }
    
    .main-header {
        padding: 10px 15px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .main-body {
        padding: 15px;
    }
    
    .welcome-section {
        padding: 20px;
    }
    
    .welcome-section h2 {
        font-size: 22px;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .login-container {
        max-width: 100%;
        padding: 15px;
    }
    
    .login-header {
        padding: 30px 20px;
    }
    
    .login-body {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .header-icon {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .card-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .card-content .value {
        font-size: 26px;
    }
}

/* ============================================
   UTILITAIRES
   ============================================ */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.d-none {
    display: none;
}

/* Scrollbar personnalisée pour la sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0,0,0,.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,.5);
}
