/* ============================
   Portail Gestion d'Activités
   Couleurs Caisse d'Épargne
   ============================ */

:root {
    --ce-red: #e4002b;
    --ce-red-dark: #c40025;
    --ce-red-light: #ff1a45;
    --ce-gray-dark: #333333;
    --ce-gray: #666666;
    --ce-gray-light: #f5f5f5;
    --ce-white: #ffffff;
    --ce-green: #28a745;
    --ce-orange: #fd7e14;
    --ce-blue: #007bff;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--ce-gray-light);
    color: var(--ce-gray-dark);
}

/* LOGIN PAGE */
.login-page {
    background: linear-gradient(135deg, var(--ce-red) 0%, var(--ce-red-dark) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--ce-white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    max-width: 250px;
    margin-bottom: 15px;
}

.login-header h2 {
    color: var(--ce-gray-dark);
    font-size: 18px;
    margin: 0;
}

/* BUTTONS */
.btn-ce {
    background: var(--ce-red);
    color: white;
    border: none;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-ce:hover {
    background: var(--ce-red-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(228,0,43,0.3);
}

.btn-ce-outline {
    border: 2px solid var(--ce-red);
    color: var(--ce-red);
    background: transparent;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-ce-outline:hover {
    background: var(--ce-red);
    color: white;
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--ce-red-dark) 0%, var(--ce-red) 100%);
    color: white;
    z-index: 1000;
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.sidebar-header img {
    max-width: 180px;
    filter: brightness(0) invert(1);
}

.sidebar-header h3 {
    font-size: 12px;
    margin: 8px 0 0;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 10px 0;
    flex: 1 1 0;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left-color: white;
}

.sidebar-nav a i {
    width: 22px;
    margin-right: 10px;
    text-align: center;
    font-size: 15px;
}

.sidebar-nav .nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 20px;
}

.sidebar-nav .nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 20px 5px;
    opacity: 0.6;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: opacity 0.2s;
    color: rgba(255,255,255,0.85);
}
.sidebar-nav .nav-section:hover {
    opacity: 1;
}
.sidebar-nav .nav-section .nav-chevron {
    font-size: 9px;
    transition: transform 0.25s ease;
}
.sidebar-nav .nav-section.open .nav-chevron {
    transform: rotate(90deg);
}
.sidebar-nav .nav-group {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-user-info {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.1);
    flex-shrink: 0;
    margin-top: auto;
}
.sidebar-user-name {
    font-weight: 700;
    font-size: 13px;
    color: white;
    margin-bottom: 4px;
}
.sidebar-user-detail {
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.topbar {
    background: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 999;
}

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

.topbar-left h1 {
    font-size: 20px;
    margin: 0;
    color: var(--ce-gray-dark);
}

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

.topbar-search {
    position: relative;
}

.topbar-search input {
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 15px 8px 35px;
    width: 300px;
    font-size: 14px;
    transition: all 0.2s;
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--ce-red);
    box-shadow: 0 0 0 3px rgba(228,0,43,0.1);
}

.topbar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.page-content {
    padding: 25px;
}

/* STAT CARDS */
.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s;
    border-left: 4px solid var(--ce-red);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-card .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--ce-red);
}

.stat-card .stat-label {
    color: var(--ce-gray);
    font-size: 13px;
    margin-top: 5px;
}

.stat-card.stat-warning {
    border-left-color: var(--ce-orange);
}

.stat-card.stat-warning .stat-number {
    color: var(--ce-orange);
}

.stat-card.stat-success {
    border-left-color: var(--ce-green);
}

.stat-card.stat-success .stat-number {
    color: var(--ce-green);
}

.stat-card.stat-info {
    border-left-color: var(--ce-blue);
}

.stat-card.stat-info .stat-number {
    color: var(--ce-blue);
}

/* DATA TABLE */
.data-table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}

.data-table-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.data-table-header h3 {
    margin: 0;
    font-size: 16px;
}

.search-box {
    position: relative;
}

.search-box input {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px 8px 34px;
    font-size: 13px;
    width: 250px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--ce-red);
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

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

.data-table thead th {
    background: var(--ce-gray-light);
    padding: 12px 15px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ce-gray);
    text-align: left;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 15px;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(228,0,43,0.02);
}

.data-table .actions {
    white-space: nowrap;
}

.data-table .actions .btn {
    padding: 4px 8px;
    font-size: 12px;
    margin: 0 2px;
}

/* STATUS BADGES */
.badge-fait {
    background: var(--ce-green);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-afaire {
    background: var(--ce-orange);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-retard {
    background: var(--ce-red);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* MODAL */
.modal-fullscreen-custom .modal-dialog {
    max-width: 100%;
    margin: 0;
    min-height: 100vh;
}

.modal-fullscreen-custom .modal-content {
    min-height: 100vh;
    border-radius: 0;
    border: none;
}

.modal-fullscreen-custom .modal-header {
    background: var(--ce-red);
    color: white;
    border-radius: 0;
    padding: 15px 25px;
}

.modal-fullscreen-custom .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-fullscreen-custom .modal-body {
    padding: 30px;
    overflow-y: auto;
}

/* NOTES */
.notes-section {
    margin-top: 25px;
    border-top: 2px solid #eee;
    padding-top: 20px;
}

.note-item {
    background: var(--ce-gray-light);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-left: 3px solid var(--ce-red);
}

.note-meta {
    font-size: 12px;
    color: var(--ce-gray);
    margin-bottom: 5px;
}

.note-content {
    font-size: 14px;
}

/* DASHBOARD CARDS */
.dashboard-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.dashboard-card h4 {
    color: var(--ce-red);
    margin-bottom: 15px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* TABS */
.nav-tabs .nav-link {
    color: var(--ce-gray);
    font-weight: 500;
}

.nav-tabs .nav-link.active {
    color: var(--ce-red);
    border-color: #dee2e6 #dee2e6 #fff;
    font-weight: 600;
}

.nav-tabs .nav-link:hover {
    color: var(--ce-red-dark);
}

/* FORM */
.form-label {
    font-weight: 500;
    color: var(--ce-gray-dark);
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--ce-red);
    box-shadow: 0 0 0 3px rgba(228,0,43,0.1);
}

/* CHECKBOX TOGGLE */
.form-check-input:checked {
    background-color: var(--ce-red);
    border-color: var(--ce-red);
}

/* SEARCH RESULTS */
.search-result-item {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.search-result-item:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.search-result-type {
    background: var(--ce-red);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* PRINT STYLES */
@media print {
    .sidebar, .topbar, .no-print, .btn, .modal-header .btn-close {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .page-content {
        padding: 0 !important;
    }
}

/* PRINT COURRIER */
.print-courrier {
    font-family: 'Times New Roman', serif;
    font-size: 12pt;
    line-height: 1.5;
    max-width: 210mm;
    margin: 0 auto;
    padding: 20mm;
}

.print-courrier .logo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.print-courrier .destinataire {
    text-align: right;
    margin-bottom: 30px;
    min-width: 250px;
}

.print-courrier .lieu-date {
    text-align: right;
    margin-bottom: 20px;
}

.print-courrier .objet {
    font-weight: bold;
    margin-bottom: 20px;
}

.print-courrier .footer-conseiller {
    text-align: right;
    margin-top: 50px;
}

/* RESPONSIVE */
.sidebar-toggle {
    display: none;
    background: var(--ce-red);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: inline-block;
    }
    .topbar-search input {
        width: 200px;
    }
}

/* PROCEDURES HIGHLIGHT */
.procedure-highlight {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-left: 4px solid var(--ce-red);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* PHONING PROGRESS BAR */
.progress-ce .progress-bar {
    background: var(--ce-red);
}

.progress-ce {
    height: 25px;
    border-radius: 12px;
}

/* Budget calculator */
.budget-section {
    background: var(--ce-gray-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.budget-section h5 {
    color: var(--ce-red);
    border-bottom: 2px solid var(--ce-red);
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.budget-result {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    padding: 20px;
    border-radius: 10px;
}

.budget-result.positive {
    color: var(--ce-green);
    background: #d4edda;
}

.budget-result.negative {
    color: var(--ce-red);
    background: #f8d7da;
}
