/* assets/css/style.css */

/* ========== VARIABLES ========== */
:root {
    --primary-color: #d52747;
    --primary-light: #efbfbf;
    --gradient-primary: linear-gradient(126deg, #efbfbf 0%, #d52747fa 100%);
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --font-family: 'Nunito', sans-serif;
    --text-dark: #2d3748;
    --text-muted: #718096;
    --bg-light: #f7fafc;
    --border-color: #e2e8f0;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
}

/* ========== BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-light);
    color: var(--text-dark);
    overflow-x: hidden;
}

/* ========== WRAPPER ========== */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */
/* ========== SIDEBAR COMPLETE ========== */

.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: #ffffff;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* État replié de la sidebar */
.sidebar.collapsed {
    transform: translateX(-260px);
    /* ou */
    /* margin-left: -260px; */
}

/* Header avec logo */
.sidebar-header {
    padding: 20px;
    background: linear-gradient(126deg, #efbfbf 0%, #d52747fa 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    min-height: 70px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-logo i {
    font-size: 1.8rem;
}

/* Menu de navigation */
.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

.sidebar-menu .nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sidebar-menu .nav-link:hover {
    background: rgba(213, 39, 71, 0.05);
    color: #d52747;
    border-left-color: #d52747;
}

.sidebar-menu .nav-link.active {
    background: rgba(213, 39, 71, 0.1);
    color: #d52747;
    border-left-color: #d52747;
    font-weight: 600;
}

.sidebar-menu .nav-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Badge de notification dans le menu */
.sidebar-menu .badge-notification {
    margin-left: auto;
    background: #d52747;
    color: white;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 10px;
}

/* Séparateur de menu */
.sidebar-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 10px 20px;
    opacity: 0.6;
}

/* Titre de section */
.sidebar-section-title {
    padding: 8px 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Footer de la sidebar */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f7fafc;
    flex-shrink: 0;
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-footer .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(126deg, #efbfbf 0%, #d52747fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.sidebar-footer .user-details {
    flex: 1;
    min-width: 0; /* Permet le text-overflow */
}

.sidebar-footer .user-details strong {
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .user-details small {
    color: #718096;
    font-size: 0.75rem;
}

/* Bouton de toggle pour mobile */
.sidebar-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
}

/* Overlay pour mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* Scrollbar personnalisée */
.sidebar::-webkit-scrollbar,
.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track,
.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.sidebar-menu::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-260px);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
        max-width: 300px;
    }
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-avatar {
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.user-details strong {
    font-size: 0.9rem;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 0;
    transition: all 0.3s ease;
    min-height: 100vh;
    background: var(--bg-light);
}

.main-content.expanded {
    margin-left: 0;
}

.main-content .container-fluid {
    padding: 1.5rem;
}

/* ========== NAVBAR ========== */
.navbar {
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* ========== CARDS ========== */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1.5rem;
    background: white;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 30px rgba(0,0,0,0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1.2rem 1.5rem;
    border-radius: 15px 15px 0 0 !important;
}

.card-header h5 {
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* ========== STATS CARDS ========== */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
}

.stats-card .stats-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.stats-card .stats-number {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-card .stats-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stats-card.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stats-card.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.stats-card.warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

.stats-card.danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

/* ========== BUTTONS ========== */
.btn {
    font-weight: 600;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(213, 39, 71, 0.3);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

/* ========== FORMS ========== */
.form-control {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(213, 39, 71, 0.15);
}

.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* ========== TABLES ========== */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr {
    transition: background 0.3s ease;
}

.table tbody tr:hover {
    background: rgba(213, 39, 71, 0.02);
}

/* ========== BADGES ========== */
.badge {
    padding: 0.5em 1em;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8rem;
}

.badge-status-planifie {
    background: #4299e1;
    color: white;
}

.badge-status-en-cours {
    background: #48bb78;
    color: white;
}

.badge-status-termine {
    background: #718096;
    color: white;
}

.badge-status-annule {
    background: #f56565;
    color: white;
}

/* ========== WIZARD (5 Étapes Patient) ========== */
.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    position: relative;
}

.wizard-progress::before {
    content: '';
    position: absolute;
    top: 25px;
    left: 10%;
    right: 10%;
    height: 3px;
    background: var(--border-color);
    z-index: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.wizard-step-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.wizard-step.active .wizard-step-circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.wizard-step.completed .wizard-step-circle {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.wizard-step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.wizard-step.active .wizard-step-label {
    color: var(--primary-color);
}

.wizard-step.completed .wizard-step-label {
    color: var(--success);
}

/* ========== ALERTS ========== */
.alert {
    border-radius: 10px;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 500;
}

/* ========== LOGIN PAGE ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.login-header h2 {
    font-weight: 700;
    color: var(--text-dark);
}

/* ========== CHARTS CONTAINER ========== */
.chart-container {
    position: relative;
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
}

/* ========== FOOTER ========== */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    
    .sidebar.show {
        margin-left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .wizard-progress {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .wizard-progress::before {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .main-content .container-fluid {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* ========== PRINT STYLES ========== */
@media print {
    .sidebar, .navbar, .btn, .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        break-inside: avoid;
    }
}