/* Custom styles for the Construction Timesheet application */

/* Common elements & utilities */
.approved-badge {
    background-color: var(--bs-success);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.pending-badge {
    background-color: #3182ce;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.locked-badge {
    background-color: var(--bs-secondary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.missing-badge {
    background-color: var(--bs-danger);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Trade-specific color coding */
.trade-drywall {
    border-left: 4px solid var(--bs-primary);
}

.trade-electrical {
    border-left: 4px solid var(--bs-warning);
}

.trade-plumbing {
    border-left: 4px solid var(--bs-info);
}

.trade-carpentry {
    border-left: 4px solid var(--bs-success);
}

.trade-painting {
    border-left: 4px solid var(--bs-purple);
}

.trade-masonry {
    border-left: 4px solid var(--bs-orange);
}

.trade-other {
    border-left: 4px solid var(--bs-secondary);
}

/* Common page structures */
.page-title {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--bs-gray-300);
    padding-bottom: 1rem;
}

.section-title {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Worker timesheet styles */
.timesheet-form {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    background-color: rgba(33, 37, 41, 0.03);
}

.activity-entry {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
    background-color: rgba(255, 255, 255, 0.05);
}

.add-activity-btn {
    width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Foreman dashboard styles */
.approval-card {
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
}

.approval-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.approval-card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--bs-gray-300);
    font-weight: bold;
}

.approval-card-body {
    padding: 1rem;
}

/* Empty job state optimization */
.approval-card.empty-job {
    margin-bottom: 0.5rem;
    max-height: none;
    height: auto;
    border-left-width: 4px;
    background-color: rgba(13, 17, 21, 0.5);
    border-radius: 0.375rem;
    padding: 0;
}

.approval-card.empty-job .card-header {
    padding: 0.5rem 1rem;
    border-bottom: none;
}

.approval-card.empty-job .card-body {
    padding: 0;
}

/* Maximum card height and scrollable tables for better space utilization */
.approval-table-container {
    max-height: 400px;
    overflow-y: auto;
}

.approval-table {
    margin-bottom: 0;
}

/* Admin styles */
.dashboard-widget {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    background-color: rgba(33, 37, 41, 0.03);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-widget-title {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
}

.dashboard-widget-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: var(--bs-primary);
}

/* Dashboard Legend styling - Added to address the user request */
.dashboard-legend { /* Assumed class name for the legend container */
    background-color: #2C2C3E;
    color: #FFFFFF;
    padding: 1rem; /* Maintain existing padding */
    border-radius: 0.5rem; /* Maintain existing border-radius */
}

/* Admin job filter dropdown styling - using Bootstrap's built-in dark theme now */
#jobStatusFilter {
    margin-right: 10px;
}


/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .table-responsive {
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
    }

    .dashboard-widget-value {
        font-size: 2rem;
    }

    .dashboard-widget {
        padding: 1rem;
    }

    .activity-entry {
        padding: 0.75rem;
    }
}

/* High contrast mode for outdoor visibility */
.high-contrast {
    --bs-body-color: #000000;
    --bs-body-bg: #ffffff;
    --bs-primary: #0000ff;
    --bs-secondary: #292929;
    --bs-success: #008800;
    --bs-info: #0066cc;
    --bs-warning: #cc6600;
    --bs-danger: #cc0000;
    --bs-light: #f8f9fa;
    --bs-dark: #212529;

    font-weight: bold;
}

.card {
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Significant fixes for Bootstrap select dropdowns */

/* Make all dropdowns have higher z-index */
.dropdown-menu {
    z-index: 9999 !important;
    max-height: 300px;
    overflow-y: auto;
}

/* Fix for select elements to ensure proper dropdown display */
select.form-select {
    position: relative;
    z-index: 1000;
}

/* Job details panel styling */
#jobDetailsPanel {
    position: relative;
    z-index: 10;
    margin-top: 10px !important;
    clear: both;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#jobDetailsPanel .card-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#jobDetailsPanel .card-body {
    background-color: rgba(33, 37, 41, 0.9);
}

/* Override Bootstrap's hidden overflow setting that may be clipping dropdowns */
.card, .card-body, .container, .row, .col, .col-md-6 {
    overflow: visible !important;
}

/* Ensure the dropdowns in the clock form appear above other elements */
#clockInForm .form-select {
    z-index: 2000 !important;
}

/* Container for select elements with proper stacking context */
.select-container {
    position: relative;
    z-index: 1500;
}

/* Wider select elements on the clock in page */
#clockInForm .form-select-lg {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    width: 100%;
    margin-bottom: 5px;
}

/* Larger labels for form elements */
#clockInForm .form-label {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Enhanced flex container for job/activity dropdowns */
#clockInForm .d-flex.flex-wrap {
    width: 100%;
}

/* Set minimum width for flex items in the dropdown container */
#clockInForm .d-flex.flex-wrap > .flex-grow-1 {
    min-width: 200px;
}

/* Gap spacing for the flex items */
#clockInForm .gap-3 {
    gap: 1rem !important;
}

/* Responsive adjustments for small screens */
@media (max-width: 767.98px) {
    #clockInForm .d-flex.flex-wrap > .flex-grow-1 {
        width: 100% !important;
        min-width: 100% !important;
    }
}

/* Adjust positioning of dropdown elements */
.bootstrap-select .dropdown-menu {
    transform: translate3d(0px, 38px, 0px) !important;
}

/* Ensure dropdown toggle buttons work properly */
.dropdown-toggle {
    z-index: 1500;
}

/* Force proper rendering of select dropdowns */
.form-select:focus {
    z-index: 2000 !important;
}

/* Empty job card spacing fix */
.approval-card.empty-job {
    height: auto;          /* stop the stretch */
    margin-bottom: .5rem;  /* tighten the gap */
}

/* Fix for hamburger menu icon visibility */
.navbar-toggler {
    border: 2px solid white !important;
    padding: 0.5rem !important;
    background-color: rgba(60, 60, 60, 0.8) !important;
}

/* Make the hamburger icon more visible */
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='3' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Fix navbar collapse for mobile view */
@media (max-width: 991.98px) {
    .collapse.navbar-collapse {
        background-color: #343a40;
        padding: 1rem;
        border-radius: 0 0 0.25rem 0.25rem;
        margin-top: 0.5rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
        border-radius: 0.25rem;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

/* Fixed Navigation and Week Nav Styles */

/* 1) Fix the top navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1055;
}

/* 2) Pin the week nav directly under it */
#week-nav {
  position: fixed;
  top: 56px;              /* adjust if your navbar is taller/shorter */
  left: 0;
  width: 100%;
  z-index: 1045;
  background: rgba(15,23,42,0.95);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid #374151;
  padding: 8px 0;
  transition: top 0.3s ease-in-out;
}

/* 3) Push page content down so nothing is hidden */
#main-content, .container-fluid {
  margin-top: calc(56px + 48px); /* navbar (56px) + week-nav height (~48px) */
}

/* Additional top margin for worker pages */
body.worker-view .container > .row:first-child {
  margin-top: 80px; /* Extra margin only for worker pages */
}

body.worker-view .page-title {
  padding-top: 15px; /* Add padding to the top of page titles on worker pages */
}

/* Additional spacing for worker clock page */
body.worker-view .container > div.clock-container {
  margin-top: 80px;
}

/* Admin dashboard navigation spacing fix */
.admin-dashboard .row:first-child {
  margin-top: 70px; /* Extra margin for admin dashboard navigation buttons */
}

/* Activities page header spacing fix */
body.activities-page {
  padding-top: 80px !important;
}

body.activities-page .container {
  padding-top: 0 !important;
}

/* GPS Compliance Report spacing fixes */
.executive-summary { 
  margin-bottom: 20px; 
}

.violations-container { 
  margin-top: 10px; 
}

/* Reduce spacing between summary and violations */
.card.mb-2:last-of-type {
  margin-bottom: 8px !important;
}

.card.mt-2:first-of-type {
  margin-top: 8px !important;
}

/* GPS Compliance specific card spacing override */
#gps-compliance .card { 
  margin-bottom: 0 !important; 
}

#gps-compliance .row {
  flex-grow: 0 !important;
  min-height: auto !important;
  margin-bottom: 0 !important;
}

#gps-compliance .card {
  margin-bottom: 0 !important;
  height: auto !important;
}

#gps-compliance .col-lg-8 > * {
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

#gps-compliance .card + .card {
  margin-top: -1px !important;
}

/* Ultra-aggressive spacing removal for GPS compliance */
#gps-compliance .col-lg-8 {
  padding: 0 !important;
  margin: 0 !important;
}

#gps-compliance .card.shadow-sm {
  margin: 0 !important;
  border-radius: 0 !important;
}

#gps-compliance .card.shadow-sm:first-child {
  border-bottom: none !important;
}

#gps-compliance .card.shadow-sm + .card.shadow-sm {
  border-top: none !important;
  margin-top: -2px !important;
}