/* 
 * Salary Visualization Dashboard
 * Custom CSS Styling
 */


 :root {
    --bs-primary: #94C595;       /* Celadon Green */
    --bs-primary-dark: #3F7A40;  /* Green for links and other text: site green darkened to 5:1 on white */
    --bs-secondary: #553564;     /* Darker aubergine purple accent */
    --bs-danger: #C82333;        /* Red, only where something bad happened (pay decreases, behind inflation, errors) */
    --bs-danger-rgb: 200, 35, 51; /* .text-danger: 5:1 on white and on the gray table stripes */
    --bs-light: #F5F9F5;         /* Very light green tint */
    --bs-dark: #4A4A4A;          /* Dark gray for text */

    /* Palette: green, aubergine and grays only; red only where something bad happened
       (pay decreases, falling behind inflation, errors). These set Bootstrap 5.3's own
       variables, so .text-success, .alert-success and .alert-info follow the palette. */
    --bs-success: #3F7A40;       /* Site green, darkened so small text on white reads (5:1 contrast) */
    --bs-success-rgb: 63, 122, 64;
    --bs-success-text: #3F7A40;
    --bs-success-bg-subtle: #EAF3EA;
    --bs-success-border-subtle: #B9D9BA;
    --bs-info-text: #4A4A4A;     /* .alert-info: plain information, light gray */
    --bs-info-bg-subtle: #F3F4F5;
    --bs-info-border-subtle: #DEE2E6;
    --caution-bg: #F4EFF6;       /* Light aubergine for caution notes */
    --caution-border: #BFA9CB;
    --caution-text: #3E2649;     /* Dark aubergine text */
  }

/* Caution note (about page "Read this first", contact page): light aubergine,
   distinct from the gray information boxes. */
.alert-caution {
    --bs-alert-bg: var(--caution-bg);
    --bs-alert-border-color: var(--caution-border);
    --bs-alert-color: var(--caution-text);
    --bs-alert-link-color: var(--caution-text);
}

/* Inline SVG icons (templates/_icons.html): sit on the text baseline like the
   Bootstrap Icons webfont did. Scoped to svg so employee.php's <i> font icons
   are untouched. */
svg.bi {
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
}


/* Card styling */
.card {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
    border: none;
}

/* Hover: a purple glow in the accent colour (--bs-secondary, #553564); cards don't move.
   !important because the cards carry Bootstrap's .shadow-sm, whose box-shadow is !important. */
.card:hover {
    box-shadow: 0 0 0 1px rgba(85, 53, 100, 0.12), 0 4px 12px rgba(85, 53, 100, 0.12) !important;
}

/* Card headers */
.card-header {
    background-color: var(--bs-light);
    border-bottom: 1px solid rgba(148, 197, 149, 0.2);
}

/* Dashboard number cards */
.card .display-4,
.card .display-6 {
    color: var(--bs-primary-dark);
    font-weight: 600;
}

/* Table styling */
.table th {
    background-color: var(--bs-light);
    font-weight: 600;
    color: var(--bs-dark);
}

/* Employee page Pay Summary: the bold row labels sit on the card's white, not the header tint */
#summary-data th {
    background-color: transparent;
}

.table-hover tbody tr:hover {
    background-color: rgba(148, 197, 149, 0.08);
}

/* Table striping */
.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(148, 197, 149, 0.03);
}

/* Chart containers */
[id$="Chart"] {
    width: 100%;
    height: 100%;
    min-height: 300px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
}

/* Plotly chart containers */
.plotly-chart-container {
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    padding: 8px;
}

/* Employee badges in comparison page */
.employee-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    background-color: #e9ecef;
    border-radius: 0.25rem;
    font-weight: 500;
}

.employee-badge .close {
    margin-left: 0.5rem;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

/* Search results styling */
.search-result {
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result:hover {
    background-color: rgba(148, 197, 149, 0.1);
}

/* Pagination active item */
.pagination .page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.page-link {
    color: var(--bs-primary-dark);
}

.page-link:hover {
    color: var(--bs-primary-dark);
    background-color: var(--bs-light);
}

/* Highlight significant salary changes */
.significant-increase {
    color: var(--bs-success);
    font-weight: 600;
}

.significant-decrease {
    color: var(--bs-danger);
    font-weight: 600;
}

/* Table row highlighting */
.table-success {
    background-color: rgba(62, 137, 72, 0.1) !important;
}

.table-danger {
    background-color: rgba(214, 64, 69, 0.1) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .display-4 {
        font-size: 2.5rem;
    }
    
    .display-6 {
        font-size: 1.5rem;
    }
}

/* Loading indicator */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid rgba(148, 197, 149, 0.3);
    border-radius: 50%;
    border-top-color: var(--bs-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Raise detection threshold slider */
#raiseThreshold {
    width: 100%;
}

#thresholdValue {
    font-weight: 600;
    color: #007bff;
}

/* Chart legends */
.legend-item {
    display: inline-block;
    margin-right: 1rem;
}

.legend-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 5px;
    border-radius: 2px;
}


/* Enhanced Salary Visualization Styling */

/* General visualization enhancements */
#salaryDistribution {
    min-height: 400px;
    transition: height 0.3s ease;
}

/* Statistics panel styling */
#salary-statistics .card {
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#salary-statistics .card-header {
    background-color: rgba(148, 197, 149, 0.1);
    border-bottom: 1px solid rgba(148, 197, 149, 0.2);
}

#salary-statistics {
    background-color: var(--bs-light);
    border-left: 4px solid var(--bs-primary) !important;
}

/* Insights panel styling */
#salary-insights .card {
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#salary-insights .card-header {
    background-color: rgba(40, 167, 69, 0.1);
    border-bottom: 1px solid rgba(40, 167, 69, 0.2);
}

/* Visualization controls styling */
.btn-group .btn {
    transition: all 0.2s ease;
}

.btn-group .btn.active {
    box-shadow: 0 0 0 0.2rem rgba(148, 197, 149, 0.25);
}

/* Button styling */
.btn-primary {
    background-color: var(--bs-secondary);
    border-color: var(--bs-secondary);
    color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--bs-secondary);
    filter: brightness(90%);
    border-color: var(--bs-secondary);
}

.btn-outline-primary {
    color: var(--bs-secondary);
    border-color: var(--bs-secondary);
}

.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary.active {
    background-color: var(--bs-secondary);
    border-color: var(--bs-secondary);
    color: #fff;
}

/* Active button state */
.btn-group .btn.active {
    background-color: var(--bs-secondary) !important;
    color: white !important;
}

/* Tooltip styling for Plotly */
.plotly .tooltiptext {
    font-size: 14px !important;
    line-height: 1.4 !important;
}

/* Make the visualization more responsive */
@media (max-width: 768px) {
    #salaryDistribution {
        height: 350px !important;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    #salary-statistics .card-body,
    #salary-insights .card-body {
        font-size: 0.875rem;
    }
}

/* Enhance the legend readability */
.legend text {
    font-size: 12px !important;
}

/* Style the median and reference lines */
.reference-line {
    stroke-dasharray: 4,4;
    stroke-width: 2px;
}

/* Enhance Plotly buttons styling */
.modebar-btn {
    opacity: 0.5 !important;
    transition: opacity 0.2s ease;
}

.modebar-btn:hover {
    opacity: 1 !important;
}

/* Visualization container shadow */
.card:has(#salaryDistribution) {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}


     /* Custom styles for emphasis */
     .highlight-metric {
        font-size: 1.75rem; /* Larger font size */
        font-weight: 700; /* Bolder */
        color: var(--bs-primary); /* Use theme color */
    }
    .redistribution-highlight {
        color: var(--bs-success); /* Green for positive potential */
        font-weight: 600;
    }
    .disparity-card .card-body {
        background-color: #f8f9fa; /* Slightly different background */
    }
     .disparity-card .card-header {
        background-color: #e9ecef; /* Slightly different header background */
    }
    /* Ensure Plotly charts resize correctly */
    .plotly-chart-container {
        width: 100%;
        height: 100%;
        min-height: 300px; /* Minimum height for charts */
    }
    /* Style for search results */
    #searchResults .list-group-item {
        border-radius: 0.25rem; /* Slightly rounded corners */
    }
    /* Responsive table */
    .table-responsive {
        overflow-x: auto;
    }

    /* Fixed navbar spacing */
    body {
        padding-top: 70px;
    }

    main.container {
        margin-top: 0 !important; /* Override the inline style */
    }

    /* Employee page specific styles */
    .breadcrumb {
        background-color: transparent;
        padding: 0.5rem 0;
    }

    /* Chart container for employee page */
    #salaryHistoryChart {
        width: 100%; /* height comes from the Plotly layout in employee.js; a fixed height here let the "Year" axis title spill out of the card */
    }

    /* Footer styling */
    /* The page footer only (body > footer), not the <footer> inside the about page's blockquote */
    body > footer {
        margin-top: 2rem;
        padding: 1rem 0;
        border-top: 1px solid #eee;
    }

    /* Navbar styling */
    .navbar-brand {
        font-weight: bold;
    }

    .navbar {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .navbar-dark {
        background-color: var(--bs-secondary) !important;
        /* Header links (e.g. "About"): near-white instead of Bootstrap's 55% white, which was faint on the purple */
        --bs-navbar-color: rgba(255, 255, 255, 0.92);
        --bs-navbar-hover-color: #fff;
    }

    /* One-line header on every page (templates/_layout.html): brand, then on employee pages
       the scrolling name (cut short with "..." if it doesn't fit), then About on the right. */
    .site-nav > .container {
        flex-wrap: nowrap;
    }

    .site-nav .navbar-brand {
        flex-shrink: 0;
    }

    .site-nav .employee-name-header {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .bg-primary {
        background-color: var(--bs-secondary) !important;
    }

    .text-primary {
        color: var(--bs-secondary) !important;
    }

    /* Heading styles */
    h1, h2, h3, h4, h5, h6 {
        color: var(--bs-secondary);
    }
    
    /* Card title headers */
    .card-title, .card-header h5 {
        color: var(--bs-secondary) !important;
    }
    
    /* Employee name in header */
    .employee-name-header {
        font-weight: 500;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .employee-name-header.visible {
        opacity: 1;
    }

    /* Link styling: text links are always underlined. Bootstrap's own classes
       (.navbar-brand, .nav-link, .list-group-item-action, .btn) are more
       specific and keep the header and search-result rows plain. */
    a {
        color: var(--bs-primary-dark);
        text-decoration: underline;
        text-underline-offset: 0.15em;
        transition: color 0.2s;
    }

    a:hover {
        color: var(--bs-secondary);
    }

    /* Footer styling */
    body > footer {
        background-color: var(--bs-light) !important;
    }

/* Focus ring on text boxes and selects: site green instead of Bootstrap's blue */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(148, 197, 149, 0.35);
}

/* Matched parts of names in search results: site green instead of Bootstrap's yellow */
mark {
    background-color: rgba(148, 197, 149, 0.4);
    color: inherit;
}

/* Yearly table: the current year's "so far" row (estimates, see #partialYearNote) */
.partial-year td {
    font-style: italic;
}

/* Accent text, e.g. the required-field * on the contact form */
.text-accent {
    color: var(--bs-secondary);
}

/* Quote attributions (about page): Bootstrap's #6c757d is just under 4.5:1 on the light green card */
.blockquote-footer {
    color: #5C636A;
}
