/* ==========================================================================
   Charte Graphique Officielle - Cour des Comptes
   Vert institutionnel: #008751
   Jaune / Or: #e5a800
   Rouge alerte: #dc2626
   ========================================================================== */

:root {
    --cc-green: #008751;
    --cc-green-dark: #00663d;
    --cc-green-darker: #004d2e;
    --cc-gold: #e5a800;
    --cc-gold-dark: #b88600;
    --cc-gold-light: #fff3cd;
    --cc-red: #dc2626;
    --cc-red-dark: #b91c1c;

    --bs-primary: #008751;
    --bs-primary-rgb: 0, 135, 81;
    --bs-warning: #e5a800;
    --bs-warning-rgb: 229, 168, 0;
    --bs-danger: #dc2626;
    --bs-danger-rgb: 220, 38, 38;
}

/* Override Bootstrap primary button */
.btn-primary {
    background: linear-gradient(135deg, #008751 0%, #00663d 100%);
    border: 1px solid #00663d;
    color: #fff !important;
    font-weight: 500;
    transition: all 0.25s ease-in-out;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: linear-gradient(135deg, #00663d 0%, #004d2e 100%);
    border-color: #004d2e;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 135, 81, 0.35);
}

.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active {
    background: #004d2e;
    color: #fff !important;
}

.btn-outline-primary {
    color: #008751;
    border-color: #008751;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: #008751;
    border-color: #008751;
    color: #fff !important;
}

.btn-soft-primary {
    color: #008751 !important;
    background-color: rgba(0, 135, 81, 0.12);
    border: none;
}

.btn-soft-primary:hover,
.btn-soft-primary:focus,
.btn-soft-primary:active {
    color: #fff !important;
    background: #008751;
}

/* Boutons accent jaune/or */
.btn-gold,
.btn-warning {
    background-color: #e5a800;
    border-color: #d19900;
    color: #1a1a1a !important;
    font-weight: 600;
}

.btn-gold:hover,
.btn-warning:hover {
    background-color: #d19900;
    border-color: #b88600;
    color: #000 !important;
}

/* Links */
a,
.link-primary {
    color: #008751 !important;
}

a:hover,
.link-primary:hover,
.link-primary:focus {
    color: #005c37 !important;
}

/* Text colors */
.text-primary {
    color: #008751 !important;
}

.text-gold {
    color: #e5a800 !important;
}

.text-danger {
    color: #dc2626 !important;
}

/* Background colors */
.bg-primary {
    background: #008751 !important;
}

.bg-soft-primary {
    background-color: rgba(0, 135, 81, 0.1) !important;
}

.bg-gold {
    background-color: #e5a800 !important;
}

.bg-danger {
    background-color: #dc2626 !important;
}

/* Borders */
.border-primary {
    border-color: #008751 !important;
}

.border-gold {
    border-color: #e5a800 !important;
}

/* Badges */
.badge.bg-primary {
    background: #008751 !important;
    color: #fff !important;
}

.badge.bg-gold,
.badge.bg-warning {
    background-color: #e5a800 !important;
    color: #212529 !important;
}

.badge.bg-danger {
    background-color: #dc2626 !important;
    color: #fff !important;
}

/* Badges spécifiques aux 3 Chambres */
.badge-chamber-ccjce {
    background: #008751;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-chamber-ccjccl {
    background: #e5a800;
    color: #1a1a1a;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-chamber-cccep {
    background: #0f766e;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Form controls focus */
.form-control:focus,
.form-select:focus {
    border-color: #008751;
    box-shadow: 0 0 0 0.2rem rgba(0, 135, 81, 0.2);
}

.form-check-input:checked {
    background-color: #008751;
    border-color: #008751;
}

.form-check-input:focus {
    border-color: #008751;
    box-shadow: 0 0 0 0.2rem rgba(0, 135, 81, 0.2);
}

/* Dropdown */
.dropdown-item.active,
.dropdown-item:active {
    background-color: #008751;
}

/* Pagination */
.page-link {
    color: #008751;
}

.page-link:hover {
    color: #00663d;
}

.page-item.active .page-link {
    background-color: #008751;
    border-color: #008751;
}

/* Progress bars */
.progress-bar {
    background-color: #008751;
}

/* Cards with primary accent */
.card-primary {
    border-top: 3px solid #008751;
}

/* Sidebar Styles - Institutional Green & Gold Accent */
.navbar-vertical-aside {
    background: linear-gradient(180deg, #004d2e 0%, #00663d 50%, #004d2e 100%) !important;
    border-right: 1px solid rgba(229, 168, 0, 0.25) !important;
    color: #fff;
}

.navbar-vertical-aside .navbar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
}

.navbar-vertical-aside .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    border-radius: 6px;
    margin: 2px 10px;
    padding: 0.65rem 1rem;
    transition: all 0.2s ease;
}

.navbar-vertical-aside .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.12);
}

.navbar-vertical-aside .nav-link.active {
    color: #fff !important;
    background: linear-gradient(90deg, #008751 0%, #00a865 100%) !important;
    border-left: 3px solid #e5a800 !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.navbar-vertical-aside .nav-icon {
    color: rgba(255, 255, 255, 0.85);
}

.navbar-vertical-aside .nav-link.active .nav-icon {
    color: #e5a800;
}

.navbar-vertical-aside .dropdown-header {
    color: #e5a800 !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    font-weight: 700;
    padding: 0.75rem 1.5rem 0.25rem 1.5rem;
}

.navbar-vertical-aside .navbar-aside-toggler:hover {
    color: #e5a800;
}

/* User Badge in Sidebar */
.sidebar-user-pill {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(229, 168, 0, 0.3);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    margin: 0.75rem 0.75rem 0 0.75rem;
}

/* Table styling */
.table-primary {
    --bs-table-bg: rgba(0, 135, 81, 0.08);
    --bs-table-striped-bg: rgba(0, 135, 81, 0.12);
    color: #00663d;
}

/* Alerts */
.alert-primary {
    color: #004d2e;
    background-color: rgba(0, 135, 81, 0.12);
    border-color: rgba(0, 135, 81, 0.25);
}

.alert-warning {
    color: #855d00;
    background-color: rgba(229, 168, 0, 0.12);
    border-color: rgba(229, 168, 0, 0.3);
}

.alert-danger {
    color: #991b1b;
    background-color: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.25);
}

/* Dark mode overrides */
[data-hs-theme="dark"] .navbar-vertical-aside {
    background: linear-gradient(180deg, #062b1a 0%, #004d2e 100%) !important;
}

[data-hs-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #008751 0%, #00663d 100%);
}

/* Pagination - Cour des Comptes */
.pagination {
    margin-bottom: 0;
    gap: 2px;
}

.page-item .page-link {
    color: #008751;
    border-color: #e2e8f0;
    border-radius: 0.375rem !important;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.page-item .page-link:hover {
    color: #004d2e;
    background-color: rgba(0, 135, 81, 0.08);
    border-color: #008751;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #008751 0%, #00663d 100%) !important;
    border-color: #008751 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0, 135, 81, 0.25);
}

.page-item.disabled .page-link {
    color: #94a3b8;
    background-color: #f8fafc;
    border-color: #e2e8f0;
}

/* ================= TOM SELECT (SELECT INTUITIF & RECHERCHE) ================= */
.tom-select-custom {
    position: relative;
    width: 100%;
}

.tom-select-custom .ts-wrapper {
    width: 100%;
}

.tom-select-custom .ts-control {
    border-radius: 0.375rem;
    border-color: #cbd5e1;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.42rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.tom-select-custom .form-select-sm ~ .ts-wrapper .ts-control,
.tom-select-custom .ts-wrapper.form-select-sm .ts-control {
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

.tom-select-custom .ts-wrapper.focus .ts-control {
    border-color: #008751 !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 135, 81, 0.18) !important;
}

.tom-select-custom .ts-dropdown {
    border-radius: 0.5rem !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08) !important;
    padding: 0.35rem !important;
    z-index: 1070 !important;
}

.tom-select-custom .ts-dropdown .dropdown-input-wrap {
    padding: 0.35rem !important;
}

.tom-select-custom .ts-dropdown .dropdown-input {
    border-radius: 0.375rem !important;
    border: 1px solid #cbd5e1 !important;
    padding: 0.4rem 0.65rem !important;
    font-size: 0.85rem !important;
}

.tom-select-custom .ts-dropdown .dropdown-input:focus {
    border-color: #008751 !important;
    box-shadow: 0 0 0 0.15rem rgba(0, 135, 81, 0.2) !important;
}

.tom-select-custom .ts-dropdown .option {
    border-radius: 0.375rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    transition: background-color 0.15s ease;
}

.tom-select-custom .ts-dropdown .option.active,
.tom-select-custom .ts-dropdown .option:hover {
    background-color: rgba(0, 135, 81, 0.08) !important;
    color: #008751 !important;
}

.tom-select-custom .ts-dropdown .option.selected {
    background-color: #008751 !important;
    color: #ffffff !important;
    font-weight: 600;
}


