/* CDECB Modern CSS Framework */
/* Built on Bootstrap 5 with custom CDECB styling */

:root {
    /* CDECB Brand Colors */
    --cdecb-primary: #318549;
    --cdecb-primary-dark: #2a7240;
    --cdecb-primary-light: #4a9b5e;
    --cdecb-secondary: #01a63b;
    --cdecb-accent: #00bf20;
    --cdecb-success: #28a745;
    --cdecb-warning: #ffc107;
    --cdecb-danger: #dc3545;
    --cdecb-info: #17a2b8;
    
    /* Typography */
    --cdecb-font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --cdecb-font-size-base: 1.25rem;
    --cdecb-line-height-base: 1.5;
    
    /* Spacing */
    --cdecb-spacer: 1rem;
    --cdecb-border-radius: 0.375rem;
    --cdecb-border-width: 1px;
    
    /* Shadows */
    --cdecb-box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --cdecb-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Base Typography */
body {
    font-family: var(--cdecb-font-family);
    font-size: var(--cdecb-font-size-base);
    line-height: var(--cdecb-line-height-base);
    color: #212529;
    background-color: #f8f9fa;
}

/* CDECB Header Styling */
.cdecb-header {
    background: linear-gradient(135deg, var(--cdecb-primary) 0%, var(--cdecb-primary-dark) 100%);
    box-shadow: var(--cdecb-box-shadow-lg);
    border-bottom: 3px solid var(--cdecb-accent);
}

.cdecb-logo {
    max-height: 80px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.cdecb-header h1 {
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin: 0;
}

/* Navigation Styling */
.cdecb-nav {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    border-top: 2px solid var(--cdecb-accent);
}

.cdecb-nav .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 1.1rem;
    padding: 0.25rem 1rem;
    transition: all 0.3s ease;
    border-radius: var(--cdecb-border-radius);
    margin: 0 0.25rem;
}

.cdecb-nav .navbar-nav .nav-link:hover,
.cdecb-nav .navbar-nav .nav-link.active {
    color: white;
    background-color: var(--cdecb-primary);
    transform: translateY(-1px);
}

.cdecb-nav .dropdown-menu {
    border: none;
    box-shadow: var(--cdecb-box-shadow-lg);
    border-radius: var(--cdecb-border-radius);
    z-index: 9999 !important;
    position: absolute !important;
    background: white !important;
    min-width: 200px;
    margin: 0;
    padding: 0.5rem 0;
}

.cdecb-nav .dropdown-menu li {
    padding: 0;
    margin: 0;
    list-style: none;
    position: relative;
    background: transparent;
}
.cdecb-nav .dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    background: transparent;
    position: relative;
    display: block;
    width: 100%;
    color: #212529 !important;
    text-decoration: none !important;
    border: none;
    white-space: nowrap;
    cursor: pointer;
    z-index: 1;
}

.cdecb-nav .dropdown-item:hover,
.cdecb-nav .dropdown-item:focus {
    background-color: var(--cdecb-primary) !important;
    color: white !important;
    text-decoration: none !important;
}

.cdecb-nav .dropdown-item:active {
    background-color: var(--cdecb-primary-dark) !important;
    color: white !important;
}

/* Additional dropdown menu fixes for layering issues */
.cdecb-nav .nav-item.dropdown {
    position: relative;
    z-index: 1000;
}

.cdecb-nav .dropdown-menu.show {
    z-index: 10000 !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Ensure dropdown doesn't get clipped */
.cdecb-nav .navbar-nav {
    position: static;
}

.cdecb-nav .navbar-collapse {
    position: relative;
    z-index: 999;
}

/* Fix for any potential text bleeding through */
.cdecb-nav .dropdown-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: -1;
    border-radius: var(--cdecb-border-radius);
}

/* Ensure dropdown links work properly */
.cdecb-nav .dropdown-menu a.dropdown-item {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Prevent Bootstrap from interfering with dropdown functionality */
.cdecb-nav .dropdown-menu .dropdown-item:not(:disabled):not(.disabled) {
    cursor: pointer;
}

/* Fix for Bootstrap dropdown auto-close behavior */
.cdecb-nav .dropdown-menu[data-bs-popper] {
    position: absolute !important;
    inset: auto auto auto 0px !important;
    margin: 0px !important;
    transform: translate3d(0px, 40px, 0px) !important;
}

/* Card Components */
.cdecb-card {
    border: none;
    border-radius: var(--cdecb-border-radius);
    box-shadow: var(--cdecb-box-shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.cdecb-card:hover {
    box-shadow: var(--cdecb-box-shadow-lg);
    transform: translateY(-2px);
}

.cdecb-card-header {
    background: linear-gradient(135deg, var(--cdecb-primary) 0%, var(--cdecb-primary-dark) 100%);
    color: white;
    font-weight: 600;
    border-bottom: none;
    padding: 1rem 1.25rem;
}

.cdecb-card-body {
    padding: 1.5rem;
}

/* Form Styling */
.cdecb-form {
    background: white;
    border-radius: var(--cdecb-border-radius);
    box-shadow: var(--cdecb-box-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.cdecb-form .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.cdecb-form .form-control {
    border: 2px solid #e9ecef;
    border-radius: var(--cdecb-border-radius);
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 1.1875rem;
}

.cdecb-form .form-control:focus {
    border-color: var(--cdecb-primary);
    box-shadow: 0 0 0 0.2rem rgba(49, 133, 73, 0.25);
}

.cdecb-form .form-control.is-invalid {
    border-color: var(--cdecb-danger);
}

.cdecb-form .form-control.is-valid {
    border-color: var(--cdecb-success);
}

/* Button Styling */
.btn-cdecb-primary {
    background: linear-gradient(135deg, var(--cdecb-primary) 0%, var(--cdecb-primary-dark) 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--cdecb-border-radius);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 1.09375rem;
}

.btn-cdecb-primary:hover {
    background: linear-gradient(135deg, var(--cdecb-primary-dark) 0%, var(--cdecb-primary) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(49, 133, 73, 0.3);
    color: white;
}

.btn-cdecb-secondary {
    background: linear-gradient(135deg, var(--cdecb-secondary) 0%, var(--cdecb-accent) 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--cdecb-border-radius);
    transition: all 0.3s ease;
}

.btn-cdecb-secondary:hover {
    background: linear-gradient(135deg, var(--cdecb-accent) 0%, var(--cdecb-secondary) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(1, 166, 59, 0.3);
    color: white;
}

.btn-cdecb-outline {
    background: transparent;
    border: 2px solid var(--cdecb-primary);
    color: var(--cdecb-primary);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--cdecb-border-radius);
    transition: all 0.3s ease;
}

.btn-cdecb-outline:hover {
    background: var(--cdecb-primary);
    color: white;
    transform: translateY(-1px);
}

/* Table Styling */
.cdecb-table {
    background: white;
    border-radius: var(--cdecb-border-radius);
    overflow: hidden;
    box-shadow: var(--cdecb-box-shadow);
}

.cdecb-table .table {
    margin-bottom: 0;
}

.cdecb-table .table thead th {
    background: linear-gradient(135deg, var(--cdecb-primary) 0%, var(--cdecb-primary-dark) 100%);
    color: white;
    font-weight: 600;
    border: none;
    padding: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 1.09375rem;
}

.cdecb-table .table tbody tr {
    transition: all 0.2s ease;
}

.cdecb-table .table tbody tr:hover {
    background-color: rgba(49, 133, 73, 0.05);
}

.cdecb-table .table tbody td {
    padding: 1rem;
    border-color: #e9ecef;
    vertical-align: middle;
}

/* Alert Styling */
.cdecb-alert {
    border: none;
    border-radius: var(--cdecb-border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.cdecb-alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    border-left-color: var(--cdecb-success);
    color: #155724;
}

.cdecb-alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border-left-color: var(--cdecb-warning);
    color: #856404;
}

.cdecb-alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    border-left-color: var(--cdecb-danger);
    color: #721c24;
}

.cdecb-alert-info {
    background-color: rgba(23, 162, 184, 0.1);
    border-left-color: var(--cdecb-info);
    color: #0c5460;
}

/* Progress Bar Styling */
.cdecb-progress {
    height: 1rem;
    background-color: #e9ecef;
    border-radius: var(--cdecb-border-radius);
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.cdecb-progress-bar {
    background: linear-gradient(135deg, var(--cdecb-primary) 0%, var(--cdecb-accent) 100%);
    transition: width 0.6s ease;
}

/* Badge Styling */
.cdecb-badge {
    padding: 0.5rem 0.75rem;
    border-radius: var(--cdecb-border-radius);
    font-weight: 600;
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cdecb-badge-primary {
    background: var(--cdecb-primary);
    color: white;
}

.cdecb-badge-success {
    background: var(--cdecb-success);
    color: white;
}

.cdecb-badge-warning {
    background: var(--cdecb-warning);
    color: #212529;
}

.cdecb-badge-danger {
    background: var(--cdecb-danger);
    color: white;
}

/* Loading Overlay */
.cdecb-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.cdecb-spinner {
    width: 3rem;
    height: 3rem;
    border: 0.3rem solid rgba(255, 255, 255, 0.3);
    border-top: 0.3rem solid var(--cdecb-primary);
    border-radius: 50%;
    animation: cdecb-spin 1s linear infinite;
}

@keyframes cdecb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .cdecb-header h1 {
        font-size: 1.875rem;
    }
    
    .cdecb-form {
        padding: 1rem;
    }
    
    .cdecb-table {
        font-size: 1.09375rem;
    }
    
    .cdecb-table .table thead th,
    .cdecb-table .table tbody td {
        padding: 0.75rem 0.5rem;
    }
}

/* Utility Classes */
.cdecb-shadow-sm { box-shadow: var(--cdecb-box-shadow); }
.cdecb-shadow-lg { box-shadow: var(--cdecb-box-shadow-lg); }
.cdecb-rounded { border-radius: var(--cdecb-border-radius); }
.cdecb-text-primary { color: var(--cdecb-primary) !important; }
.cdecb-text-secondary { color: var(--cdecb-secondary) !important; }
.cdecb-bg-primary { background-color: var(--cdecb-primary) !important; }
.cdecb-bg-secondary { background-color: var(--cdecb-secondary) !important; }

/* Animation Classes */
.cdecb-fade-in {
    animation: cdecb-fadeIn 0.5s ease-in;
}

@keyframes cdecb-fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.cdecb-slide-in {
    animation: cdecb-slideIn 0.5s ease-out;
}

@keyframes cdecb-slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Print Styles */
@media print {
    .cdecb-header,
    .cdecb-nav,
    .no-print {
        display: none !important;
    }
    
    .cdecb-card,
    .cdecb-form {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .cdecb-table .table thead th {
        background: #f8f9fa !important;
        color: #212529 !important;
    }
}
html {
    font-size: 13px;
    scroll-behavior: smooth;
}