/* ============================================================
   COMPENS EUI – UNIVERSAL CONSULTING
   Feuille de style principale – Version complète & optimisée
   ============================================================ */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #16a085;
    --dark-color: #34495e;
    --light-color: #ecf0f1;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    background: #f5f6fa;
    color: #333;
}

/* =========================================
   STRUCTURE GLOBALE
   ========================================= */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
    width: 260px;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    position: fixed;
    color: white;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

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

.sidebar-header .logo {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    margin: 0 auto 15px auto;
    font-size: 28px;
    color: var(--primary-color);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-header .logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-header h3 {
    margin-bottom: 10px;
}

.sidebar-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
}

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

.sidebar-menu li { margin: 0; }

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    text-decoration: none;
    color: rgba(255,255,255,0.8);
    border-left: 3px solid transparent;
    transition: var(--transition);
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.sidebar-menu a.active {
    background: rgba(52,152,219,0.25);
    color: white;
    border-left-color: var(--secondary-color);
}

.sidebar-menu a.active:hover {
    background: rgba(52,152,219,0.35);
}

.sidebar-menu a i {
    width: 22px;
    font-size: 18px;
}

/* Sous-menus */
.submenu-toggle {
    cursor: pointer;
}

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

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

.sidebar-submenu {
    list-style: none;
    padding-left: 40px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

.sidebar-submenu.show {
    max-height: 500px;
    opacity: 1;
}

.sidebar-submenu li {
    margin: 6px 0;
}

.sidebar-submenu a {
    border-radius: 6px;
    margin-right: 10px;
    padding-left: 15px;
    border-left: 3px solid transparent;
}

.sidebar-submenu a:hover {
    border-left-color: var(--secondary-color);
}

.sidebar-submenu a.active {
    border-left-color: var(--secondary-color);
}

/* =========================================
   MAIN CONTENT
   ========================================= */
.main-content {
    flex: 1;
    margin-left: 260px;
}

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

.topbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-user-name { font-weight: 600; }
.topbar-user-role { font-size: 12px; color: #7f8c8d; }

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

/* =========================================
   CONTENT / CARDS
   ========================================= */
.content {
    padding: 30px;
}

.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 25px;
}

.card-header {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
    font-size: 18px;
    font-weight: 600;
}

/* =========================================
   TABLES
   ========================================= */
.table-responsive { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table.data-table th {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 2px solid #e1e8ed;
    color: var(--primary-color);
}

table.data-table td {
    padding: 15px;
    border-bottom: 1px solid #f1f3f5;
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary { background: var(--secondary-color); color: white; }
.btn-success { background: var(--success-color); color: white; }
.btn-danger  { background: var(--danger-color); color: white; }
.btn-info    { background: var(--info-color); color: white; }
.btn-secondary { background: #95a5a6; color: white; }

/* =========================================
   FORMULAIRES
   ========================================= */
.form-group { margin-bottom: 15px; width: 100%; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    background: #f8f9fa;
    transition: .2s;
}

.form-control:focus {
    border-color: var(--secondary-color);
    background: #fff;
    box-shadow: 0 0 4px rgba(52,152,219,0.3);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,<svg width='14' height='8' viewBox='0 0 14 8' xmlns='http://www.w3.org/2000/svg'><path fill='%23666' d='M7 8L0 0h14z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* Login form inputs */
.login-box .form-control {
    background: #eef1f5;
    border-radius: 6px;
}

/* =========================================
   MODALES
   ========================================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal.show { display: flex; }

.modal-dialog {
    width: 90%;
    max-width: 600px;
    background: white;
    padding: 20px;
    border-radius: 10px;
}

.modal-header,
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}

/* Boutons dans le footer qui ont à la fois btn et modal-close */
.modal-footer .btn.modal-close {
    background: #95a5a6;
    color: white;
    font-size: 14px;
}

.modal-footer .btn.modal-close:hover {
    background: #7f8c8d;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        transform: translateX(-100%);
        transition: var(--transition);
    }

    .sidebar.show {
        width: 260px;
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .content {
        padding: 15px;
    }
}

/* =========================================
   FOOTER
   ========================================= */
.app-footer {
    background: white;
    padding: 20px;
    border-top: 1px solid #e1e8ed;
    text-align: center;
    color: #7f8c8d;
    margin-top: 40px;
}
