/**
 * JIEP Brand Identity Stylesheet
 * Based on JIEP Brand Guideline.pdf
 */

:root {
    /* Brand Colors (Dominant: Spring Green) */
    --jiep-spring-green: #39B54A;
    --jiep-space-blue: #1226AA;
    --jiep-light-grey: #D9D8D6;
    --jiep-dark: #231F20;
    --jiep-white: #FFFFFF;
    
    /* Functional Overrides (Spring Green as Primary) */
    --bs-primary: #39B54A;
    --bs-primary-rgb: 57, 181, 74;
    --bs-primary-hover: #2e933c;
    --bs-primary-border-color: #39B54A;
    --bs-primary-bg-rgb: 57, 181, 74;
    --bs-link-color: #39B54A;
    --bs-link-hover-color: #2e933c;
    
    /* Custom adaptive variables */
    --jiep-menu-search-bg: rgba(67, 89, 113, 0.1);
}

[data-bs-theme="dark"] {
    --jiep-menu-search-bg: rgba(255, 255, 255, 0.05);
}

/* --- Typography --- */
body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.5;
}

[data-bs-theme="light"] body {
    color: var(--jiep-dark);
    background-color: #f5f5f9;
}

[data-bs-theme="dark"] body {
    background-color: #232333 !important;
    color: #a3a4cc;
}

h1, h2, h3, h4, h5, h6, 
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Manrope', sans-serif !important;
    font-weight: 700 !important;
    color: var(--jiep-spring-green) !important;
}

.app-brand-text {
    font-family: 'Manrope', sans-serif !important;
    font-weight: 800 !important;
    background: linear-gradient(135deg, var(--jiep-space-blue) 0%, var(--jiep-spring-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

/* --- Background Accents (J Supergraphic) --- */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 20 H70 V40 H50 V60 C50 70 40 80 30 80 S10 70 10 60 V20' fill='none' stroke='%2339B54A' stroke-width='1' opacity='0.03'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-attachment: fixed;
    z-index: -1;
    pointer-events: none;
}

/* --- Sidebar & Menu --- */
[data-bs-theme="light"] .bg-menu-theme {
    background-color: #fff !important;
}

[data-bs-theme="dark"] .bg-menu-theme {
    background-color: #2b2c40 !important;
}

.menu-vertical .menu-item.active > .menu-link:not(.menu-toggle) {
    background: linear-gradient(135deg, var(--jiep-spring-green) 0%, #2e933c 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 8px rgba(57, 181, 74, 0.25) !important;
}

.menu-vertical .menu-item.active > .menu-link:not(.menu-toggle) i,
.menu-vertical .menu-item.active > .menu-link:not(.menu-toggle) .text-truncate {
    color: #fff !important;
}

.menu-vertical .menu-sub .menu-item.active > .menu-link::before {
    content: "";
    background-color: #fff !important;
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    border: none !important;
    position: absolute;
    left: 1.15rem !important;
}

/* --- Buttons & Primary Elements --- */
.btn-primary {
    background-color: var(--jiep-spring-green) !important;
    border-color: var(--jiep-spring-green) !important;
    color: #fff !important;
    box-shadow: 0 4px 8px rgba(57, 181, 74, 0.25) !important;
    transition: all 0.2s ease-in-out !important;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #2e933c !important;
    border-color: #2e933c !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(57, 181, 74, 0.3) !important;
}

.btn-outline-primary {
    color: var(--jiep-spring-green) !important;
    border-color: var(--jiep-spring-green) !important;
}

.btn-outline-primary:hover {
    background-color: var(--jiep-spring-green) !important;
    color: #fff !important;
}

.btn-label-primary {
    color: var(--jiep-spring-green) !important;
    background-color: rgba(57, 181, 74, 0.1) !important;
}

.btn-label-primary:hover {
    background-color: var(--jiep-spring-green) !important;
    color: #fff !important;
}

/* --- Components --- */
.card {
    border: none;
    box-shadow: 0 2px 6px 0 rgba(67, 89, 113, 0.12);
}

[data-bs-theme="light"] .card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bg-label-primary, .badge.bg-label-primary {
    background-color: rgba(57, 181, 74, 0.1) !important;
    color: var(--jiep-spring-green) !important;
}

.bg-label-success, .badge.bg-label-success {
    background-color: rgba(57, 181, 74, 0.1) !important;
    color: var(--jiep-spring-green) !important;
}

.bg-primary, .bg-gradient-primary {
    background-color: var(--jiep-spring-green) !important;
}

.text-primary, .text-success {
    color: var(--jiep-spring-green) !important;
}

/* --- Navbar --- */
[data-bs-theme="light"] .layout-navbar {
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
}

[data-bs-theme="dark"] .layout-navbar {
    background-color: rgba(43, 44, 64, 0.95) !important;
    backdrop-filter: blur(10px);
}

/* --- Dark Mode Utility Overrides --- */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-lighter {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.bg-card-adaptive {
    background-color: #fff;
}

[data-bs-theme="dark"] .bg-card-adaptive {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .progress {
    background-color: #323249 !important;
}

[data-bs-theme="dark"] .table:not(.table-dark) thead:not(.table-dark) th,
[data-bs-theme="dark"] .table:not(.table-dark) thead:not(.table-dark) td {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .modal-header.bg-light,
[data-bs-theme="dark"] .card-header.bg-light {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
    border-color: rgba(255, 255, 255, 0.2) !important;
    background-color: rgba(255, 255, 255, 0.03) !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: var(--jiep-spring-green) !important;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}
[data-bs-theme="light"] ::-webkit-scrollbar-track {
    background: #f1f1f1;
}
[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: #2b2c40;
}
::-webkit-scrollbar-thumb {
    background: var(--jiep-light-grey);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #c1c1c1;
}

/* --- Select2 Dark Mode Fix (Global) --- */
[data-bs-theme="dark"] .select2-container--default .select2-selection--single,
[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: #2b2c40 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #a3a4cc !important;
    min-height: 38px;
    display: flex;
    align-items: center;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    color: #a3a4cc !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #a3a4cc transparent transparent transparent !important;
}

[data-bs-theme="dark"] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #a3a4cc transparent !important;
}

[data-bs-theme="dark"] .select2-dropdown {
    background-color: #2b2c40 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #a3a4cc !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: rgba(57, 181, 74, 0.2) !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--jiep-spring-green) !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: #232333 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: rgba(57, 181, 74, 0.15) !important;
    border-color: var(--jiep-spring-green) !important;
    color: var(--jiep-spring-green) !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--jiep-spring-green) !important;
    border-right: 1px solid var(--jiep-spring-green) !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background-color: rgba(57, 181, 74, 0.2) !important;
}
