/* ============================================================
   RESET & BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f9;
    color: #333;
    display: flex;
    height: 100vh;
}

.main-wrapper {
    overflow-y: auto;
    height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    overflow-y: auto;
    background: #2d2c31;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 3px 0 15px rgba(0,0,0,0.25);
    z-index: 100;
}

/* Logo */
.sidebar-logo {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.logo-img {
    max-width: 170px;
    max-height: 60px;
    object-fit: contain;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.82rem 1.2rem;
    color: rgba(255,255,255,0.68);
    text-decoration: none;
    font-size: 0.91rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.2s, color 0.2s;
}

.sidebar-nav li a i {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav li a:hover {
    background: rgba(16, 118, 189, 0.18);
    color: #ffffff;
    border-left-color: rgba(16, 118, 189, 0.5);
}

.sidebar-nav li.active a {
    background: #1076bd;
    color: #ffffff;
    border-left-color: rgba(255,255,255,0.6);
    font-weight: 600;
}

/* Footer */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(0,0,0,0.12);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex: 1;
    min-width: 0;
}

.user-avatar i {
    font-size: 1.9rem;
    color: rgba(255,255,255,0.45);
    display: block;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.42);
    text-transform: capitalize;
}

.sidebar-logout {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.sidebar-logout:hover {
    background: rgba(220, 53, 69, 0.28);
    color: #ff6b7a;
}

.sidebar-logout i {
    font-size: 0.95rem;
}

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.page-header {
    background: #ffffff;
    padding: 1rem 1.75rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #333;
}

.page-content {
    padding: 1.75rem;
    flex: 1;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.87rem;
    color: #5a595d;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.62rem 0.875rem;
    border: 1.5px solid #dee2e6;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.93rem;
    color: #333;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #1076bd;
    box-shadow: 0 0 0 3px rgba(16, 118, 189, 0.12);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    padding: 0.58rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.4;
}

.btn-primary {
    background: #1076bd;
    color: #ffffff;
}
.btn-primary:hover {
    background: #0c5d96;
    box-shadow: 0 3px 10px rgba(16, 118, 189, 0.35);
}

.btn-secondary {
    background: #5a595d;
    color: #ffffff;
}
.btn-secondary:hover { background: #3a393e; }

.btn-success {
    background: #28a745;
    color: #ffffff;
}
.btn-success:hover { background: #218838; }

.btn-danger {
    background: #dc3545;
    color: #ffffff;
}
.btn-danger:hover { background: #c82333; }

.btn-warning {
    background: #f0a500;
    color: #ffffff;
}
.btn-warning:hover { background: #d4920a; }

.btn-sm {
    padding: 0.28rem 0.65rem;
    font-size: 0.8rem;
}

.btn-group {
    display: flex;
    gap: 0.45rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid #dee2e6;
    background: #ffffff;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
}

.card-body {
    padding: 1.4rem;
}

/* ============================================================
   STATS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.2rem 1.4rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #1076bd;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.stat-card .stat-icon {
    font-size: 1.5rem;
    color: #1076bd;
}

.stat-card h3 {
    color: #6c757d;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 800;
    color: #1076bd;
    line-height: 1;
}

/* ============================================================
   TABLES
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f4f6f9;
}

th {
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.77rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5a595d;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.9rem;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #e8f3fb;
}

/* ============================================================
   KANBAN
   ============================================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.1rem;
    margin-top: 1rem;
}

.kanban-column {
    background: #f4f6f9;
    border-radius: 8px;
    padding: 1rem;
    min-height: 350px;
}

.kanban-header {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #1076bd;
    color: #1076bd;
}

.task-card {
    background: #ffffff;
    border-radius: 6px;
    padding: 0.8rem 0.9rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid #1076bd;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.15s;
}

.task-card:hover {
    box-shadow: 0 4px 12px rgba(16, 118, 189, 0.15);
    transform: translateY(-1px);
}

.task-card.priority-haute   { border-left-color: #dc3545; }
.task-card.priority-normale { border-left-color: #1076bd; }
.task-card.priority-basse   { border-left-color: #28a745; }

.task-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #333;
    font-size: 0.88rem;
}

.task-description {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.35rem;
}

.task-meta {
    font-size: 0.77rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.15rem;
}

.task-meta i {
    color: #1076bd;
    font-size: 0.72rem;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.2rem;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info    { background: #e8f3fb; color: #0c5d96; border: 1px solid #b8d9f0; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem 0.65rem;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger  { background: #f8d7da; color: #721c24; }
.badge-info    { background: #e8f3fb; color: #0c5d96; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #1076bd 0%, #2d2c31 100%);
}

.login-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    padding: 2.25rem 2rem;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.login-logo img {
    max-width: 180px;
    max-height: 70px;
    object-fit: contain;
}

.login-title {
    text-align: center;
    margin-bottom: 1.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d2c31;
}

.login-title span { color: #1076bd; }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center  { text-align: center; }
.text-muted   { color: #6c757d; }
.text-primary { color: #1076bd; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
    .sidebar {
        width: 60px;
        min-width: 60px;
    }

    .sidebar-logo {
        padding: 0.875rem 0.5rem;
        min-height: 64px;
    }

    .logo-img {
        max-width: 36px;
        max-height: 36px;
    }

    .sidebar-nav li a span,
    .user-info,
    .sidebar-logout span {
        display: none;
    }

    .sidebar-nav li a {
        justify-content: center;
        padding: 0.9rem 0;
        border-left: none;
        gap: 0;
    }

    .sidebar-footer {
        flex-direction: column;
        padding: 0.75rem 0;
        align-items: center;
        gap: 0.5rem;
    }

    .sidebar-user {
        justify-content: center;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .page-content {
        padding: 1rem;
    }
    th, td {
        padding: 0.6rem 0.6rem;
    }
}
