/* ================================================================
   BASE STYLES & GLOBAL SETTINGS
   ================================================================ */

/* Global box-sizing and scrollbar settings */
html, body {
    width: 100%;
    height: 100%;
    color: #838383;
    background-color: #f5f5f5;
    font-family: 'Nunito', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overflow-x: hidden;
}

/* Text selection utilities */
.no-select {
    user-select: none;
}

.select {
    user-select: text;
}

.cursor-pointer {
    cursor: pointer;
}

/* ================================================================
   LAYOUT COMPONENTS
   ================================================================ */

/* Main content area */
main {
    flex: 1;
}

/* ================================================================
   ANIMATION UTILITIES
   ================================================================ */
/* Fade animations */
.fade-in {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    visibility: visible;
}

.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Logo fade animations */
.logo-fade-in {
    opacity: 1;
    transition: opacity 0.5s ease-in;
}

.logo-fade-out {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

/* Slide down animation */
.slide-down {
    animation: slideDown 0.5s cubic-bezier(.4,0,.2,1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================================
   BOOTSTRAP CUSTOMIZATION
   Primary brand color: #369318 (Green)
   ================================================================ */

/* CSS Custom Properties for Bootstrap color system */
:root {
    --bs-primary: #369318;
    --bs-primary-rgb: 54, 147, 24;
    --bs-primary-text-emphasis: #1f5209;
    --bs-primary-bg-subtle: #d4f0ca;
    --bs-primary-border-subtle: #a9e194;
    --bs-success: #369318;
    --bs-success-rgb: 54, 147, 24;
    --bs-success-text-emphasis: #1f5209;
    --bs-success-bg-subtle: #d4f0ca;
    --bs-success-border-subtle: #a9e194;
}

/* ================================================================
   BUTTON CUSTOMIZATION
   ================================================================ */

/* Primary button styling with hover and focus states */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #369318;
    --bs-btn-border-color: #369318;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #2d7a14;
    --bs-btn-hover-border-color: #296f12;
    --bs-btn-focus-shadow-rgb: 54, 147, 24;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #296f12;
    --bs-btn-active-border-color: #256310;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #369318;
    --bs-btn-disabled-border-color: #369318;
}

/* Outline primary button styling */
.btn-outline-primary {
    --bs-btn-color: #369318;
    --bs-btn-border-color: #369318;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #369318;
    --bs-btn-hover-border-color: #369318;
    --bs-btn-focus-shadow-rgb: 54, 147, 24;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #369318;
    --bs-btn-active-border-color: #369318;
}

/* Success button styling with interaction states */
.btn-success {
    background-color: #369318;
    border-color: #369318;
}

    .btn-success:hover,
    .btn-success:focus,
    .btn-success:active {
        background-color: #2d7a14;
        border-color: #2d7a14;
    }

/* ================================================================
   LINK CUSTOMIZATION
   ================================================================ */

/* Primary link colors */
.link-primary {
    color: #369318 !important;
}

    .link-primary:hover,
    .link-primary:focus {
        color: #2d7a14 !important;
    }

/* ================================================================
   FORM CONTROLS CUSTOMIZATION
   ================================================================ */

/* Form control focus states with brand color */
.form-control:focus,
.form-select:focus {
    border-color: #369318;
    box-shadow: 0 0 0 0.25rem rgba(54, 147, 24, 0.25);
}

/* Checkbox and radio button customization */
.form-check-input:focus {
    border-color: #369318;
    box-shadow: 0 0 0 0.25rem rgba(54, 147, 24, 0.25);
}

.form-check-input:checked {
    background-color: #369318;
    border-color: #369318;
}

/* Select dropdown styling */
.form-select {
    cursor: pointer;
}

    .form-select option {
        cursor: pointer;
    }

    /* Form select customization for better UX */
    .form-select:focus {
        border-color: #369318;
        box-shadow: 0 0 0 0.2rem rgba(54, 147, 24, 0.25);
    }

.form-select-sm {
    font-size: 0.9rem;
    padding: 0.375rem 0.75rem;
    background-color: #ffffff;
}

/* ================================================================
   SEARCH COMPONENTS
   ================================================================ */

/* Search container with responsive behavior */
.search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    transition: min-height 0.5s cubic-bezier(.4,0,.2,1), padding-top 0.5s cubic-bezier(.4,0,.2,1);
    padding-top: 0;
}

    .search-container.shrink {
        min-height: 65px;
    }

/* Search logo with show/hide animations */
.search-logo {
    overflow: hidden;
    opacity: 0;
    max-height: 0;
    transition: opacity 0.2s cubic-bezier(.4,0,.2,1), max-height 0.4s cubic-bezier(.4,0,.2,1), margin-bottom 0.4s cubic-bezier(.4,0,.2,1);
    margin-bottom: 0;
    width: 250px;
    display: block;
}

    .search-logo.fade-in {
        opacity: 1;
        max-height: 150px;
        margin-bottom: 1rem;
    }

    .search-logo.fade-out {
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
    }

/* Search input wrapper */
.search-input-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

/* Enhanced search input */
.search-input {
    position: relative;
    z-index: 1;
    color: #333;
    font-size: 1.4rem;
    height: 56px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 5px;
    text-align: center;
    width: 100%;
    max-width: 480px;
    transition: box-shadow 0.2s;
    background: #fff;
}

    .search-input:focus {
        outline: none;
        box-shadow: 0 4px 16px rgba(0,0,0,0.12);
        border-color: #369318;
    }

    .search-input::placeholder {
        color: #b0b0b0;
        opacity: 1;
    }

/* Search options container */
.search-options-container {
    display: flex;
    justify-content: start;
    max-height: 100px;
    width: 100%;
    max-width: 400px;
    margin: 0.75rem auto 0;
    transition: opacity 0.3s cubic-bezier(.4,0,.2,1), max-height 0.4s cubic-bezier(.4,0,.2,1);
}

    .search-options-container .form-check {
        display: table-row;
        align-items: flex-start;
        margin-bottom: 0.25rem;
    }

    .search-options-container .form-check-input {
        cursor: pointer;
        border-color: #c6c6c6;
        width: 16px;
        height: 16px;
        margin-top: 0.25rem;
        flex-shrink: 0;
    }

        .search-options-container .form-check-input:focus {
            box-shadow: none;
            border-color: #369318;
        }

        .search-options-container .form-check-input:checked {
            background-color: #369318;
            border-color: #369318;
        }

    .search-options-container .form-check-label {
        cursor: pointer;
        padding: 0 0.4rem 0 0.4rem;
        user-select: none;
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .search-options-container .form-check:hover .form-check-input:not(:checked) {
        border-color: #369318;
    }

/* ================================================================
   LOADING COMPONENTS
   ================================================================ */

.loading-progress {
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    z-index: 9999;
    background-color: #f5f5f5;
}

.logo-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.logo-container {
    width: 194px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 0.375rem;
    padding: 10px;
    animation: float 4s ease-in-out infinite;
    border: 1px solid #ececec;
}

    .logo-container img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

.dots-progress {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-self: center;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #e0e0e0;
    transition: all 0.4s ease;
    position: relative;
}

    .progress-dot:nth-child(1) {
        animation: pulse 1.5s ease-in-out infinite;
    }

    .progress-dot:nth-child(2) {
        animation: pulse 1.5s ease-in-out infinite 0.2s;
    }

    .progress-dot:nth-child(3) {
        animation: pulse 1.5s ease-in-out infinite 0.4s;
    }

    .progress-dot:nth-child(4) {
        animation: pulse 1.5s ease-in-out infinite 0.6s;
    }

    .progress-dot:nth-child(5) {
        animation: pulse 1.5s ease-in-out infinite 0.8s;
    }


/* ================================================================
   TABLE COMPONENTS
   ================================================================ */

/* Table header styling */
th {
    height: 48px;
    vertical-align: middle;
}

.table-header {
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
}

.table-header-no-padding {
    padding: 0 5px 0 15px !important;
    height: 100%;
}

.table-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    min-height: inherit;
}

.table-sort-icon {
    display: flex;
    align-items: center;
    border-left: 1px solid #dee2e6;
    padding-left: 0.2rem;
    margin-left: 0.2rem;
    padding-right: 0.25rem;
    margin-right: 0.25rem;
    height: 100%;
    min-height: 100%;
    color: #838383;
}

/* Table row interactions */
.table-row-active td {
    background-color: #f3f6f9 !important;
    color: #222;
    transition: background 0.2s;
}

.table-row-hoverable:hover td {
    background-color: #f3f6f9 !important;
    color: #222;
}

/* Sort controls */
.sort-chevron {
    transition: transform 0.2s ease;
    margin-left: 0.5rem;
    font-size: 13px;
}

    .sort-chevron.desc {
        transform: rotate(180deg);
    }

.sort-dot {
    color: #dfdfdf;
    transition: transform 0.2s ease;
    margin-left: 0.5rem;
    font-size: 13px;
}

/* Expandable content */
.expandable-content {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
    will-change: max-height, opacity;
}

    .expandable-content.expanded {
        max-height: 2000px;
        opacity: 1;
    }

/* Accordion arrows */
.accordion-arrow {
    transition: transform 0.2s ease;
    font-size: 13px;
}

    .accordion-arrow.expanded {
        transform: rotate(90deg);
    }

/* ================================================================
   FILTER COMPONENTS
   ================================================================ */

/* Analysis filter input */
.filter-input {
    box-shadow: none !important;
    outline: none !important;
    border-color: #ced4da;
}

.filter-clear-btn {
    background: #fff;
    height: 38px;
    min-width: 38px;
    border: 1px solid;
    border-color: #ced4da;
    border-radius: 0 5px 5px 0;
    box-shadow: none;
    color: #b0b0b0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -1px;
    transition: background 0.2s, color 0.2s;
    font-size: 1.2rem;
    padding: 0;
}

    .filter-clear-btn:hover,
    .filter-clear-btn:focus {
        color: #6c757d;
        outline: none;
    }

/* ================================================================
   CARD COMPONENTS
   ================================================================ */

/* Enhanced card styling */
.card {
    border-radius: 0.375rem !important;
}

    .card .card-body:first-child {
        border-top-left-radius: 0.375rem;
        border-top-right-radius: 0.375rem;
    }

    .card .card-body:last-child {
        border-bottom-left-radius: 0.375rem;
        border-bottom-right-radius: 0.375rem;
    }

    .card .card-header:first-child {
        border-top-left-radius: 0.375rem;
        border-top-right-radius: 0.375rem;
    }

    .card .card-header + .card-body {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

/* Card header padding consistency */
.card-header {
    padding: .4rem 1rem;
}

/* Interactive cards */
.card-interactive {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s ease;
}

    .card-interactive:hover {
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }

    .card-interactive .card-header {
        border-bottom: 1px solid #dee2e6;
    }

        .card-interactive .card-header:hover {
            background-color: #e9ecef !important;
        }

/* ================================================================
   UI COMPONENTS CUSTOMIZATION
   ================================================================ */

/* Alert styling */
.alert-primary {
    --bs-alert-color: #1f5209;
    --bs-alert-bg: #d4f0ca;
    --bs-alert-border-color: #a9e194;
}

/* Badge styling */
.badge.text-bg-primary {
    color: #fff !important;
    background-color: #369318 !important;
}

/* Status badge colors */
.badge.bg-success {
    background-color: #27ae60 !important;
}

.badge.bg-warning {
    background-color: #f39c12 !important;
    color: #fff !important;
}

.badge.bg-danger {
    background-color: #e74c3c !important;
}

.badge.bg-info {
    background-color: #3498db !important;
    color: #fff !important;
}

.badge.bg-secondary {
    background-color: #95a5a6 !important;
}

/* Progress bar styling */
.progress-bar {
    background-color: #369318;
}

/* Utility color classes */
.text-primary {
    --bs-text-opacity: 1;
    color: rgba(54, 147, 24, var(--bs-text-opacity)) !important;
}

.bg-primary {
    --bs-bg-opacity: 1;
    background-color: rgba(54, 147, 24, var(--bs-bg-opacity)) !important;
}

.border-primary {
    --bs-border-opacity: 1;
    border-color: rgba(54, 147, 24, var(--bs-border-opacity)) !important;
}

.btn.disabled, .btn:disabled, fieldset:disabled .btn {
    color: #707862;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

/* ================================================================
   NAVIGATION COMPONENTS
   ================================================================ */

/* Dropdown menu active state */
.dropdown-item:active {
    background-color: #369318;
}

/* Pagination styling */
.page-link {
    color: #369318;
}

.page-item.active .page-link {
    background-color: #369318;
    border-color: #369318;
}

.page-link:hover {
    color: #2d7a14;
    background-color: rgba(54, 147, 24, 0.1);
    border-color: #369318;
}

/* ================================================================
   ADVANCED FORM COMPONENTS
   ================================================================ */

/* Custom toggle switch styling */
.custom-toggle .form-check-input:checked {
    background-color: #369318;
    border-color: #369318;
}

.custom-toggle .form-check-input:focus {
    border-color: #369318;
    box-shadow: 0 0 0 0.25rem rgba(54, 147, 24, 0.25);
}

/* Table striped rows with brand color accent */
.table-striped > tbody > tr:nth-of-type(odd) > td {
    --bs-table-striped-bg: rgba(54, 147, 24, 0.05);
}

/* ================================================================
   FOCUS STATE OVERRIDES
   Remove default browser focus styles for consistent UX
   ================================================================ */

/* Global focus state removal */
*:focus,
*:active,
button:focus,
button:active,
input:focus,
input:active,
textarea:focus,
textarea:active,
select:focus,
select:active,
a:focus,
a:active {
    outline: none !important;
    box-shadow: inherit !important;
}

/* Specific component focus state removal */
.btn:focus,
.btn:active,
.btn:focus-visible,
.form-check-input:focus,
.form-check-input:active,
.form-check-input:focus-visible {
    box-shadow: none;
    outline: none;
}

/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */

/* Mobile optimizations */
@media (max-width: 575.98px) {
    .search-input {
        font-size: 1.2rem;
        height: 48px;
    }

    .search-options-container .form-check-label {
        font-size: 0.75rem;
    }

    .card-header h6 {
        font-size: 0.9rem;
    }
}

@media (max-width: 767.98px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card-body {
        padding: 1rem 0.75rem;
    }
}

/* ================================================================
   ANIMATIONS
   ================================================================ */

/* Floating animation for logo container */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Pulsing animation for loading dots */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        background-color: #e0e0e0;
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        background-color: #369318;
        opacity: 0.8;
        box-shadow: 0 0 10px rgba(54, 147, 24, 0.4);
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
}
