/* TelAudit - Poultry Farm Audit System */

/* Header Styling */
.site-header {
    background: linear-gradient(135deg, 
        #1a73e8 0%, 
        #0d6efd 40%, 
        #0956c8 80%, 
        #084ba8 100%);
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: #fff;
    overflow: visible;
    z-index: 1050;
}

.site-header .container {
    max-width: 1280px;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill="none" width="100" height="100"/><rect fill-opacity="0.03" fill="white" x="25" y="25" width="50" height="50" transform="rotate(45 50 50)"/></svg>');
    background-size: 30px 30px;
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
}

.site-header::after {
    content: '';
    position: absolute;
    top: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(20deg);
    pointer-events: none;
}

.logo-container {
    margin-right: 1rem;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1;
}

.logo-img {
    height: 55px;
    width: auto;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: filter 0.3s ease;
}

.logo-img:hover {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 10px rgba(255, 255, 255, 0.4));
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.site-subtitle {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.85;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.main-nav {
    display: flex;
    align-items: center;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.75rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: #fff;
    padding: 0.5rem 0.875rem;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 600;
}

.nav-icon {
    margin-right: 0.5rem;
}

/* General styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.5;
    padding-top: 0.5rem;
    position: relative; /* Establish stacking context for body if needed */
}

main.container.py-4 {
    position: relative; /* Ensure it can have a z-index */
    z-index: 1;      /* Lower z-index than the header and dropdown menus */
    /* overflow: visible; /* Explicitly set to visible if there are any doubts, though default is usually fine */
}

/* Card styling */
.card {
    border-radius: 0.5rem;
    overflow: hidden;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    margin-bottom: 1.25rem;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.card-header {
    font-weight: 600;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-body {
    padding: 1.25rem;
}

/* Table with fixed columns */
.table-responsive {
    position: relative;
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.table-fixed-columns {
    position: relative;
}

.table-fixed-columns thead th {
    position: sticky;
    top: 0;
    z-index: 15;
    background-color: #f8f9fa;
}

/* ID column (fixed) */
.id-column {
    min-width: 60px;
    width: 60px;
    position: sticky;
    left: 0;
    background-color: #fff;
    z-index: 10;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    white-space: nowrap;
}

/* Branch column (fixed) */
.branch-column {
    min-width: 120px;
    width: 120px;
    position: sticky;
    left: 60px; /* Must match ID column width */
    background-color: #fff;
    z-index: 10;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    white-space: nowrap;
}

/* Farmer column (fixed) */
.farmer-column {
    min-width: 180px;
    width: 180px;
    position: sticky;
    left: 180px; /* Must match combined width of ID + Branch columns */
    background-color: #fff;
    z-index: 10;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}

/* Action column (fixed) */
.action-column {
    width: 140px;
    min-width: 140px;
    white-space: nowrap;
    position: sticky;
    right: 0;
    background-color: #fff;
    z-index: 10; /* Same z-index as other fixed columns */
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
}

/* Header styling for fixed columns */
.table-primary .id-column,
.table-light .id-column,
thead .id-column {
    background-color: #f8f9fa !important;
    z-index: 20; /* Higher z-index for header cells */
}

.table-primary .branch-column,
.table-light .branch-column,
thead .branch-column {
    background-color: #f8f9fa !important;
    z-index: 20; /* Higher z-index for header cells */
}

.table-primary .farmer-column,
.table-light .farmer-column,
thead .farmer-column {
    background-color: #f8f9fa !important;
    z-index: 20; /* Higher z-index for header cells */
}

.table-primary .action-column,
.table-light .action-column,
thead .action-column {
    background-color: #f8f9fa !important; 
    z-index: 20; /* Higher z-index for header cells */
}

/* Row styling for odd rows with fixed columns */
.table-striped tbody tr:nth-of-type(odd) .id-column,
.table-striped tbody tr:nth-of-type(odd) .branch-column,
.table-striped tbody tr:nth-of-type(odd) .farmer-column,
.table-striped tbody tr:nth-of-type(odd) .action-column {
    background-color: #f2f2f2; /* Match the striped row color */
}

/* Hover effect for fixed columns */
.table-hover tbody tr:hover .id-column,
.table-hover tbody tr:hover .branch-column,
.table-hover tbody tr:hover .farmer-column,
.table-hover tbody tr:hover .action-column {
    background-color: #e9ecef; /* Match the hover color */
}

/* Table striped rows with fixed columns */
.table-striped.table-fixed-columns tbody tr:nth-of-type(odd) th:first-child,
.table-striped.table-fixed-columns tbody tr:nth-of-type(odd) td:first-child,
.table-striped.table-fixed-columns tbody tr:nth-of-type(odd) th:nth-child(2),
.table-striped.table-fixed-columns tbody tr:nth-of-type(odd) td:nth-child(2),
.table-striped.table-fixed-columns tbody tr:nth-of-type(odd) th:nth-child(3),
.table-striped.table-fixed-columns tbody tr:nth-of-type(odd) td:nth-child(3),
.table-striped.table-fixed-columns tbody tr:nth-of-type(odd) th:last-child,
.table-striped.table-fixed-columns tbody tr:nth-of-type(odd) td:last-child {
    background-color: #f2f2f2;
}

/* Table hover effect with fixed columns */
.table-hover.table-fixed-columns tbody tr:hover td:first-child,
.table-hover.table-fixed-columns tbody tr:hover td:nth-child(2),
.table-hover.table-fixed-columns tbody tr:hover td:nth-child(3),
.table-hover.table-fixed-columns tbody tr:hover td:last-child {
    background-color: #e9ecef;
}

/* Fixed header and pagination */
.table-fixed-header {
    position: sticky;
    top: 0;
    z-index: 15;
    background-color: #f8f9fa;
}

.pagination-fixed {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background-color: #ffffff;
    padding: 10px 0;
    border-top: 1px solid #dee2e6;
}

/* Rows per page dropdown */
.rows-per-page {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.rows-per-page select {
    width: auto;
    margin: 0 10px;
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
}

/* Form styling - Updated for better layout */
.form-control, .form-select {
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease-in-out;
    font-size: 0.9375rem;
    width: 100%;
    height: 42px;
}

/* Field width optimizations */
input[type="number"] {
    width: auto;
    min-width: 120px;
    max-width: 100%;
}

.form-select {
    width: auto;
    min-width: 140px;
    max-width: 100%;
    padding-right: 2.25rem;
    background-position: right 0.75rem center;
}

/* Better focus states */
.form-control:focus, .form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.1);
    outline: 0;
}

/* Form groups - improve spacing and alignment */
.row.g-3 {
    margin-bottom: 0;
    row-gap: 0.5rem !important;
}

.row.g-3 > [class*="col-"] {
    margin-bottom: 0.5rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}

.form-label {
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: #4a5568;
    font-size: 0.875rem;
    display: block;
}

/* Checkbox styling */
.form-check {
    padding-left: 1.75rem;
    margin-bottom: 0.375rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
    margin-top: 0.25rem;
    margin-left: -1.5rem;
    border-radius: 0.2rem;
    border: 1px solid #cbd5e0;
    background-color: #fff;
}

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

.form-check-label {
    font-weight: 400;
    color: #4a5568;
    font-size: 0.875rem;
}

/* Conditional fields styling */
.fast-vaccine-options, .second-vaccine-options {
    padding: 0.75rem;
    border-radius: 0.375rem;
    background-color: #f9fafb;
    margin-top: 0.375rem;
    border-left: 3px solid #0d6efd;
}

/* Button styling */
.btn {
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    font-size: 0.9375rem;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn:focus {
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.25);
}

.btn-primary {
    background-color: #0d6efd;
    border: none;
    box-shadow: 0 2px 5px rgba(13, 110, 253, 0.2);
    transition: all 0.2s ease;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    border-radius: 0.375rem;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

.btn-info {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

.btn-info:hover {
    background-color: #31d2f2;
    border-color: #25cff2;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
}

/* Form action buttons container */
.d-flex.gap-2.mt-4 {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem !important;
}

.d-flex.gap-2.mt-4 .btn {
    margin-bottom: 0.375rem;
}

/* Improved desktop button groups */
.card-body .d-flex.gap-2 {
    gap: 0.5rem !important;
}

.card-body .d-flex.gap-2 .btn {
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    min-width: 100px;
}

.card-body .d-flex.gap-2 .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.12);
}

.card-body .d-flex.gap-2 .btn:active {
    transform: translateY(0);
}

.card-body .d-flex.gap-2 .btn i {
    margin-right: 0.4rem;
}

/* Upload page buttons */
#upload-section .d-flex.gap-2 .btn,
#file-upload-section .d-flex.gap-2 .btn {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    min-width: 120px;
}

/* Admin page "Add New User" button */
.d-md-none .d-grid .btn-primary.btn-lg.rounded-pill {
    padding: 0.6rem 1.5rem;
}

/* Textarea styling */
textarea.form-control {
    min-height: 80px;
    resize: vertical;
    height: auto;
}

/* Mobile responsiveness */
@media (max-width: 767.98px) {
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    h5 {
        font-size: 1rem;
    }
    
    .btn {
        padding: 0.4375rem 0.875rem;
        font-size: 0.875rem;
        width: 100%; /* Full width buttons on mobile */
        margin-right: 0 !important;
    }
    
    .form-label {
        font-size: 0.875rem;
    }
    
    /* Stack buttons on mobile */
    .d-flex.gap-2.mt-4 {
        flex-direction: column;
        gap: 0.375rem !important;
    }
    
    .d-flex.gap-2.mt-4 .btn {
        margin-right: 0;
    }
}

/* Improve tablet view */
@media (min-width: 768px) and (max-width: 991.98px) {
    .card-body {
        padding: 1rem;
    }
    
    .row.g-3 {
        margin-bottom: -0.625rem;
    }
    
    .row.g-3 > [class*="col-"] {
        margin-bottom: 0.625rem;
    }
}

/* Improved table styling */
.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 0;
    font-size: 0.95rem;
}

/* Better table header */
.table thead th {
    font-weight: 600;
    background-color: #f2f4f8;
    border-bottom: 2px solid #e2e8f0;
    padding: 1rem 0.75rem;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #4a5568;
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Better table cells */
.table tbody td {
    vertical-align: middle;
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid #edf2f7;
    transition: background-color 0.2s;
}

/* Improved row banding */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: #f9fafc;
}

.table-striped tbody tr:nth-of-type(even) {
    background-color: #ffffff;
}

/* Nicer hover effect */
.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.04);
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.1);
}

/* Last row styling */
.table tbody tr:last-child td {
    border-bottom: none;
}

/* Column widths optimization */
.table td:first-child,
.table th:first-child {
    padding-left: 1.25rem;
}

.table td:last-child,
.table th:last-child {
    padding-right: 1.25rem;
}

/* Action column */
.table th.text-center,
.table td.text-center {
    width: 140px;
}

/* ID column */
.table th:first-child,
.table td:first-child {
    width: 70px;
}

/* Optimize text columns */
.table td:nth-child(2),  /* Branch */
.table td:nth-child(3) { /* Farmer */
    min-width: 150px;
    max-width: 200px;
}

/* Optimize numeric columns */
.table td.text-end,
.table th.text-end {
    min-width: 100px;
}

/* Date column */
.table td:nth-child(9),
.table th:nth-child(9) {
    min-width: 140px;
}

/* Responsive table */
@media (max-width: 768px) {
    .table {
        font-size: 0.85rem;
    }
    
    .table th, 
    .table td {
        padding: 0.7rem 0.5rem;
    }
}

/* Custom background colors */
.bg-primary {
    background-color: #0d6efd !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

/* Alerts */
.alert {
    border-radius: 0.375rem;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    padding: 0.875rem 1.125rem;
    margin-bottom: 1.25rem;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

/* Field rows in view mode */
.field-row {
    margin-bottom: 1rem;
}

.field-row:last-child {
    margin-bottom: 0;
}

.field-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

/* Print specific styles */
@media print {
    .btn, header, footer, .no-print {
        display: none !important;
    }
    
    body {
        padding: 0;
        margin: 0;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
        margin-bottom: 0.75rem !important;
    }
    
    .card-header {
        background-color: #f8f9fa !important;
        color: #212529 !important;
    }
}

/* Statistics Cards */
.card .h3 {
    margin-bottom: 0;
    font-weight: 700;
    color: #0d6efd;
}

/* For a cleaner view, add some space between vaccine options */
.form-check + .form-check {
    margin-top: 0.25rem;
}

/* Compact layout for dense forms */
.container {
    max-width: 1280px;
}

/* Section headers - make more attractive */
.card > .card-header {
    background: linear-gradient(to right, #faf9f8, #ffffff);
    border-left: 3px solid #0d6efd;
}

.card-header .text-dark {
    color: #343a40 !important;
    font-weight: 600;
}

/* Make dropdowns more modern */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Fine-tune specific input widths based on their content */
input[type="number"][id$="age"],
input[type="number"][id$="body_weight"],
input[type="number"][id$="actual_fcr"],
input[type="number"][id$="balance_feed"],
input[type="number"][id$="brooding"],
input[type="number"][id$="partition"],
input[type="number"][id$="feeder"],
input[type="number"][id$="drinker"] {
    width: 100px;
}

/* New styles for enhanced form layout */
.audit-form-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.audit-form-column {
    flex: 1;
    min-width: 300px;
}

.form-field-group {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-field-group .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0.3rem;
}

.form-field-group.compact .form-group {
    min-width: 150px;
}

/* Add visual separation between sections */
.section-divider {
    border-top: 1px solid #e9ecef;
    margin: 1rem 0;
}

/* Consistent field heights */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.4rem;
    margin-left: -0.4rem;
    align-items: flex-end;
}

.form-row > .col,
.form-row > [class*="col-"] {
    padding-right: 0.4rem;
    padding-left: 0.4rem;
}

/* Add icons to section headers */
.card-header .section-icon {
    margin-right: 0.5rem;
    color: #0d6efd;
}

/* Make card borders more subtle */
.card {
    border: 1px solid #e9ecef;
}

/* Reports page specific styling */
.reports-stats-card {
    transition: all 0.3s ease;
    overflow: hidden;
    border-radius: 0.5rem;
}

.reports-stats-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

.reports-stats-card .card-body {
    position: relative;
    z-index: 1;
}

.reports-stats-card .card-body:after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    z-index: -1;
}

.bg-primary.bg-opacity-10 {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.bg-success.bg-opacity-10 {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

.bg-warning.bg-opacity-10 {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.bg-info.bg-opacity-10 {
    background-color: rgba(13, 202, 240, 0.1) !important;
}

.text-primary {
    color: #0d6efd !important;
}

.text-success {
    color: #198754 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-info {
    color: #0dcaf0 !important;
}

/* Improved table styling for reports */
.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

.table.table-hover thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-top: none;
    border-bottom-width: 1px;
}

.table.table-hover tbody td {
    vertical-align: middle;
    padding: 0.75rem 0.5rem;
    border-color: #f0f0f0;
}

/* Filter card styling */
.card-header .mb-0 {
    font-weight: 600;
    font-size: 0.9rem;
}

.input-group-text {
    background-color: #f8f9fa;
    border-right: none;
    transition: all 0.2s ease;
}

.input-group-text + .form-control,
.input-group-text + .form-select {
    border-left: none;
}

.input-group:focus-within {
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
    border-radius: 0.375rem;
}

.input-group:focus-within .input-group-text,
.input-group:focus-within .form-control,
.input-group:focus-within .form-select {
    border-color: #80bdff;
    box-shadow: none;
}

/* Instant search styling */
.input-group-text.bg-primary {
    border-color: #0d6efd;
    color: white;
}

#search {
    border-width: 2px;
    transition: all 0.2s ease;
}

#search:focus {
    border-color: #0d6efd;
    box-shadow: none;
}

/* Improving filter layout */
#filterForm .col-md-3,
#filterForm .col-md-4 {
    margin-bottom: 0.75rem;
}

#filterForm label {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #4a5568;
}

/* Styling for sort controls */
#sort_by {
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#sort_order {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Search results highlight */
.search-highlight {
    background-color: rgba(255, 243, 205, 0.5);
    border-radius: 0.25rem;
    padding: 0.125rem 0.25rem;
    font-weight: bold;
}

/* Loading spinner */
.spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 0.2em;
    margin-bottom: 0.5rem;
}

/* Animation for row updates */
@keyframes rowHighlight {
    0% {
        background-color: rgba(13, 110, 253, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

.row-updated {
    animation: rowHighlight 1.5s ease;
}

/* Responsive adjustments for filters */
@media (max-width: 767.98px) {
    #filterForm .input-group {
        margin-bottom: 0.75rem;
    }
    
    #search {
        margin-bottom: 1rem;
    }
    
    .btn-filter-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-filter-group .btn {
        margin-bottom: 0.5rem;
    }
}

/* Select2 custom styling */
.select2-container--bootstrap-5 .select2-selection {
    height: 42px;
    padding: 0.375rem 0.75rem;
    border-color: #dee2e6;
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #80bdff;
    box-shadow: none;
}

.select2-container--bootstrap-5 .select2-dropdown {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border-color: #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.select2-container--bootstrap-5 .select2-results__option {
    padding: 0.5rem 1rem;
    transition: background-color 0.15s ease;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: rgba(13, 110, 253, 0.1);
    color: #212529;
}

.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: #0d6efd;
    color: white;
}

.select2-container--bootstrap-5 .select2-search__field {
    border-radius: 0.375rem;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075);
}

/* Placeholder for select2 */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: #6c757d;
}

/* Fix input groups with select2 */
.input-group > .select2-container--bootstrap-5 {
    width: auto !important;
    flex: 1 1 auto;
}

/* Fix dropdown within input group */
.input-group .select2-container--bootstrap-5 .select2-selection--single {
    height: 42px;
    line-height: 1.5;
    padding: 0.375rem 0.75rem;
}

/* Keep select2 dropdown above modal */
.select2-container--bootstrap-5 {
    z-index: 1056 !important;
}

/* Modern filter buttons styling */
.btn-outline-secondary {
    border: 1px solid #6c757d;
    background-color: transparent;
    color: #6c757d;
    box-shadow: 0 2px 5px rgba(108, 117, 125, 0.1);
    transition: all 0.2s ease;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    border-radius: 0.375rem;
}

.btn-outline-secondary:hover {
    background-color: #f8f9fa;
    color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.15);
}

.btn-outline-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.1);
}

/* Filter form styles */
#filterForm .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.card-header h6 {
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* More space between buttons */
.d-flex.gap-2 {
    gap: 0.75rem !important;
}

/* Ensure select2 dropdown appears above other elements */
.select2-container--bootstrap-5 {
    z-index: 1040 !important;
}

/* Make sure dropdowns display properly */
.select2-dropdown {
    z-index: 1040 !important;
    position: relative;
}

/* Further styling for branch dropdown */
#branch-container .select2-selection {
    height: 42px;
    border-color: #dee2e6;
}

/* Override any conflicting styles */
.select2-container--bootstrap-5 .select2-selection--single {
    height: auto !important;
    min-height: 42px !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding-top: 5px;
    padding-bottom: 5px;
}

/* Add a subtle highlight to All Branch option */
.select2-results__option[data-select2-id="all-branches"] {
    font-weight: 600;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 4px;
    padding-bottom: 8px;
}

/* Mortality percentage styling */
.text-danger.fw-bold, .fw-bold {
    white-space: nowrap;
    display: inline-block;
    font-weight: 700 !important;
}

.text-danger.fw-bold {
    color: #dc3545 !important;
    animation: danger-pulse 2s ease-in-out 1;
}

@keyframes danger-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Make sure mortality column doesn't break line */
.table td.text-end {
    white-space: nowrap;
}

/* Make the mortality percentage stand out in the report table */
.table td .fw-bold {
    padding: 0.1rem 0.2rem;
    border-radius: 0.25rem;
}

.table td .text-danger {
    background-color: rgba(220, 53, 69, 0.1);
}

/* Better row separation */
.table tbody tr {
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    height: 60px; /* Fixed height rows */
}

/* Highlight current row on hover */
.table tbody tr:hover {
    border-left: 3px solid #0d6efd;
    transform: translateX(2px);
}

/* Consistent button spacing in action column */
.table .d-flex.justify-content-center.gap-1 {
    gap: 0.35rem !important;
}

/* Make numeric values more readable */
.table td.text-end {
    font-family: 'Consolas', monospace;
    letter-spacing: -0.02em;
    font-weight: 500;
}

/* Better color contrast for the table header */
.table-light {
    background-color: #f0f3f9 !important;
}

/* Custom scrollbar for table */
.table-responsive::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cfd8dc;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #b0bec5;
}

/* Footer styling */
footer {
    background: linear-gradient(to right, #f8f9fa, #f0f2f5) !important;
}

footer .container {
    max-width: 1280px;
}

footer .fw-semibold {
    color: #0d6efd;
    font-weight: 600;
}

/* Responsive footer adjustments */
@media (max-width: 767.98px) {
    footer .row > div {
        margin-bottom: 0.5rem;
    }
}

.nav-item.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    z-index: 1060 !important; /* Even higher z-index for dropdown */
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    min-width: 10rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

.dropdown-item i {
    width: 1.25rem;
    text-align: center;
}

/* Ensure header dropdown displays properly */
.site-header .dropdown-menu {
    display: block;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: visibility 0.2s, opacity 0.2s, transform 0.2s;
}

.site-header .dropdown.show .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

/* Special case for usernames dropdown */
.site-header .nav-link.dropdown-toggle::after {
    margin-left: 0.5rem;
}

/* Make sure select2 dropdowns display properly and above other elements */
.select2-dropdown {
    z-index: 1040 !important;
    position: relative;
}

/* Ensure select2 dropdown appears above other elements */
.select2-container--bootstrap-5 {
    z-index: 1040 !important;
}

/* Ensure the row and table have lower z-index */
.row.mb-4 {
    position: relative;
    z-index: 1030;
}

.table-responsive {
    position: relative;
    z-index: 1030;
}

/* Branch dropdown specific styles */
#branch-container {
    position: relative;
    z-index: 1035;  /* Higher than other elements but lower than site header */
}

#branch-container .select2-selection {
    height: 42px;
    border-color: #dee2e6;
}

/* Make sure the dropdown expands fully */
.select2-container--open {
    z-index: 1045 !important; /* Higher z-index when opened */
}

.select2-container--open .select2-dropdown {
    max-height: none;
    overflow: visible;
}

/* Override any conflicting styles */
.select2-container--bootstrap-5 .select2-selection--single {
    height: auto !important;
    min-height: 42px !important;
}

/* Select2 Dropdown Visibility Fix */
.select2-container {
    z-index: 1060 !important;
    position: relative;
}

.select2-dropdown {
    z-index: 1061 !important; 
    position: absolute;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    overflow: visible !important;
}

.select2-results {
    max-height: 300px;
    overflow-y: auto;
}

.select2-container--open {
    z-index: 1061 !important;
}

.select2-container--open .select2-dropdown {
    max-height: none;
    overflow: visible !important;
    margin-top: 2px;
}

/* Specific card containing filters and reports table */
.card.shadow-sm { 
    overflow: visible !important; 
    position: relative;
}

/* Ensure table-responsive inside the above card maintains its scrolling behavior */
/* This relies on the original .table-responsive styles (overflow-x: auto) not being overridden by a general visible rule */

/* Ensure dropdown button visibility and stacking context */
#branch-container {
    position: relative;
    z-index: 1059; /* Below select2 container/dropdown, but above normal page flow within its card context */
    overflow: visible !important; /* Allows select2 to overflow this specific container */
}

/* Fix dropdown positioning and z-index */
.select2-container--bootstrap-5 .select2-dropdown { /* More specific selector for Bootstrap 5 theme */
    border-radius: 0.5rem;
    overflow: visible !important;
    transform: none !important; /* Avoids creating new stacking context that traps z-index */
    z-index: 1061 !important; /* Ensure it's above other elements, including site header (1050) */
    position: absolute; /* Ensure it's positioned correctly relative to its Select2 container */
}

.select2-container--bootstrap-5.select2-container--open {
    z-index: 1061 !important; /* Ensure the container itself is also on top when open */
}

.select2-container--bootstrap-5 {
    z-index: 1060 !important; /* The base Select2 container */
    position: relative; /* For proper positioning of the absolute dropdown */
}


/* Ensure .select2-results (the list inside dropdown) is scrollable if needed */
.select2-results__options {
    max-height: 300px; /* Or any desired height */
    overflow-y: auto;
}

/* Ensure dropdown menus display properly */
.dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    position: absolute !important;
    z-index: 1000 !important;
}

/* Position the user dropdown menu properly */
.nav-item.dropdown .dropdown-menu {
    right: 0;
    left: auto;
    top: 100% !important; /* Position below the username element */
    margin-top: 0.5rem !important; /* Add some space between username and dropdown */
    transform: none !important; /* Prevent any transforms that might affect positioning */
}

.nav-item.dropdown {
    position: relative !important; /* Ensure relative positioning of the parent */
}

.nav-item.dropdown .dropdown-toggle {
    position: relative;
    z-index: 1050; /* Ensure username is above other elements */
}

/* ===== MODERN FILE INPUT STYLING (Copied from mobile.css for Desktop) ===== */
.modern-file-input-container {
    position: relative;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.modern-file-input-container label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.modern-file-input-wrapper {
    position: relative;
    width: 40%;
    display: flex;
    align-items: center;
}

.modern-file-input {
    position: relative;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px dashed #d0d0d0;
    background-color: #f8f9fa;
    font-size: 1rem;
    color: #333;
    transition: all 0.2s ease;
    outline: none;
    cursor: pointer;
    /* Ensure text for selected file is visible */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    padding-right: 100px; /* Space for the "Browse" button */
}

.modern-file-input:hover,
.modern-file-input:focus {
    border-color: #1a73e8;
    background-color: #f0f7ff;
}

/* Hide the default browser button */
.modern-file-input::-webkit-file-upload-button {
    visibility: hidden;
    width: 0;
    height: 0;
    position: absolute;
}
.modern-file-input::file-selector-button {
    visibility: hidden;
    width: 0;
    height: 0;
    position: absolute;
}

/* Custom "Browse" button overlay */
.modern-file-input::before {
    content: 'Browse';
    display: inline-block;
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    line-height: calc(2 * 12px + 1rem); /* Match padding + font-size approx */
    padding: 0 20px;
    background: linear-gradient(145deg, #1a73e8 0%, #1565c0 100%);
    color: white;
    font-weight: 500;
    border-top-right-radius: 8px; /* Adjusted to match input's border-radius minus border width */
    border-bottom-right-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
}

.modern-file-input:active::before {
    background: #1565c0;
}

.file-name-display {
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a73e8;
    display: flex;
    align-items: center;
    display: none; /* Hidden by default, shown by JS */
}

.file-name-display.visible {
    display: flex;
}

.file-name-display i {
    margin-right: 6px;
    font-size: 1.1rem;
}

/* Ensure button text logic from mobile.css is respected */
/* .mobile-text-short is display: none by default in mobile.css */
/* .mobile-text-full is display: inline by default in mobile.css */

/* Desktop specific button styling if needed, but for now, rely on existing styles. */
/* The primary concern was the file input and button text. */

/* Default display for button text (Desktop view) */
.mobile-text-full {
    display: inline !important; /* Ensure full text is shown on desktop */
}

.mobile-text-short {
    display: none !important;   /* Ensure short text is hidden on desktop */
}

/* Modern confirm dialog styling */
.modern-confirm-dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modern-confirm-dialog-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modern-confirm-dialog {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 420px;
    padding: 0;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modern-confirm-dialog-backdrop.show .modern-confirm-dialog {
    transform: translateY(0);
}

.modern-confirm-dialog-header {
    background-color: #f8f9fa;
    padding: 16px 20px;
    border-bottom: 1px solid #eaeaea;
}

.modern-confirm-dialog-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #212529;
}

.modern-confirm-dialog-body {
    padding: 20px;
}

.modern-confirm-dialog-message {
    font-size: 16px;
    line-height: 1.5;
    color: #495057;
}

.modern-confirm-dialog-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    gap: 10px;
}

.modern-confirm-dialog-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modern-confirm-dialog-btn-cancel {
    background-color: #f1f3f5;
    color: #495057;
}

.modern-confirm-dialog-btn-cancel:hover {
    background-color: #e9ecef;
}

.modern-confirm-dialog-btn-confirm {
    background-color: #dc3545;
    color: white;
}

.modern-confirm-dialog-btn-confirm:hover {
    background-color: #c82333;
}

/* Mobile-specific dialog styles */
@media (max-width: 576px) {
    .modern-confirm-dialog {
        width: 95%;
        max-width: 350px;
    }
    
    .modern-confirm-dialog-header {
        padding: 14px 16px;
    }
    
    .modern-confirm-dialog-title {
        font-size: 17px;
    }
    
    .modern-confirm-dialog-body {
        padding: 16px;
    }
    
    .modern-confirm-dialog-message {
        font-size: 15px;
    }
    
    .modern-confirm-dialog-footer {
        padding: 12px 16px;
    }
}