@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* Global styling */
body, html {
    height: 100%; 
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Poppins', sans-serif;
    background: #f7f9fc;
    color: #333;
}

/* Force Bootstrap navbar styles */
.navbar {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background-color: #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    width: 100%;
}

.navbar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-item {
    margin: 0 2px;
    white-space: nowrap;
}

.nav-link {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    color: #333 !important;
    text-decoration: none;
    padding: 8px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 0.9rem;
}

.nav-link:hover {
    background-color: #f8f9fa;
    color: #007bff !important;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.3rem;
    color: #333 !important;
    text-decoration: none;
    flex-shrink: 0;
}

/* Mobile menu styles */
.navbar-toggler {
    padding: 0.25rem 0.5rem;
    font-size: 1.25rem;
    line-height: 1;
    background-color: transparent;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 0.25rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
    max-width: none;
}

header { 
    position: relative; 
    z-index: 1000; 
}

/* Force consistent font weight on nav links across all pages */
.navbar-nav .nav-link {
    font-weight: 500 !important;
}
/* Fix for Time Off link to prevent line break */
.nav-item a[href="time_off.php"] {
    white-space: nowrap;
}
/* Fix for Site Updates link to prevent line break */
.nav-item a[href="backlog"] {
    white-space: nowrap;
}
/* Getting Started link styling */
.nav-item a[href="gs.php"] {
    white-space: nowrap;
    color: #0066cc !important;
    font-weight: 600 !important;
}
/* Search result keyboard navigation styling */
.search-result-item.active,
.search-result-view-all.active {
    background-color: #007bff !important;
    color: white !important;
}
.search-result-view-all {
    cursor: pointer;
}
.search-result-view-all:hover {
    background-color: #e9ecef !important;
}
.search-result-view-all.active:hover {
    background-color: #0056b3 !important;
}

/* Desktop styles - navbar expanded */
@media (min-width: 992px) {
    .navbar-expand-lg .navbar-nav {
        flex-direction: row;
    }
    .navbar-expand-lg .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
    .navbar-expand-lg .navbar-toggler {
        display: none;
    }
    /* Enable hover dropdowns on desktop only */
    .dropdown:hover .dropdown-menu {
        display: block;
    }
}

/* Mobile styles - navbar collapsed */
@media (max-width: 991.98px) {
    /* Force navbar collapse behavior */
    .navbar-collapse {
        display: none !important;
        width: 100%;
        background-color: #fff;
        border-top: 1px solid #e9ecef;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    .navbar-collapse.show {
        display: block !important;
    }
    
    .navbar-collapse.collapsing {
        display: block !important;
        transition: height 0.35s ease;
        overflow: hidden;
    }
    
    /* Stack navigation items vertically */
    .navbar-nav {
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .nav-item {
        width: 100%;
        margin: 0;
        border-bottom: 1px solid #f8f9fa;
    }
    
    .nav-item:last-child {
        border-bottom: none;
    }
    
    /* Navigation links */
    .nav-link {
        padding: 0.75rem 1rem;
        display: block;
        width: 100%;
        color: #333 !important;
        font-weight: 500;
        border-bottom: none;
    }
    
    .nav-link:hover {
        background-color: #f8f9fa;
        color: #007bff !important;
    }
    
    /* Disable hover dropdowns on mobile */
    .dropdown:hover .dropdown-menu {
        display: none !important;
    }
    
    /* Mobile dropdown styling - this is the key fix */
    .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background-color: #e3f2fd !important; /* Light blue background like calendar.php */
        transform: none !important;
        display: none !important;
        padding: 0 !important;
    }
    
    /* Show dropdown when Bootstrap adds .show class */
    .dropdown-menu.show {
        display: block !important;
    }
    
    /* Dropdown items */
    .dropdown-item {
        padding: 0.75rem 1.5rem !important;
        color: #333 !important;
        font-size: 0.9rem !important;
        border-bottom: 1px solid rgba(255,255,255,0.3) !important;
        background-color: transparent !important;
        width: 100% !important;
        text-align: left !important;
        border: none !important;
        white-space: nowrap !important;
        display: block !important;
        text-decoration: none !important;
    }
    
    .dropdown-item:last-child {
        border-bottom: none !important;
    }
    
    .dropdown-item:hover,
    .dropdown-item:focus {
        background-color: rgba(255,255,255,0.2) !important;
        color: #333 !important;
    }
    
    .dropdown-item:active {
        background-color: rgba(255,255,255,0.3) !important;
        color: #333 !important;
    }
    
    /* Dropdown toggle styling when expanded */
    .dropdown.show > .nav-link {
        background-color: #e3f2fd !important;
        color: #333 !important;
    }
    
    /* Dropdown toggle arrow positioning */
    .dropdown-toggle::after {
        float: right;
        margin-top: 0.5rem;
        margin-left: auto;
    }
    
    /* Profile image adjustments for mobile */
    .nav-link img {
        width: 20px;
        height: 20px;
    }
    
    /* Search components - hide desktop search, show mobile search button */
    .position-relative.me-2.d-lg-block.d-none {
        display: none !important;
    }
    
    .d-lg-none.d-block {
        display: block !important;
    }
    
    /* Mobile search button positioning */
    .d-lg-none.d-block.ms-auto.me-2 {
        position: absolute;
        right: 60px;
        top: 8px;
    }
}

/* Extra small screens */
@media (max-width: 575.98px) {
    .navbar {
        padding: 0.25rem 0.5rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .nav-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .dropdown-item {
        padding: 0.4rem 1.2rem;
        font-size: 0.85rem;
    }
}

/* Calendar Page Specific Styles */
.calendar-container {
    position: relative;
    padding: 20px;
    height: calc(100vh - 70px);
    margin-top: 70px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
#calendar { 
    width: 100%; 
    height: 100%; 
}
.fc-event-title { 
    white-space: pre-line; 
}

/* Style buttons to match theme */
.fc-button-primary {
    background-color: #1a3a54 !important;
    border-color: #1a3a54 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.fc-button-primary:hover {
    background-color: #0f2942 !important;
    border-color: #0f2942 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.fc-button-primary:not(:disabled):active,
.fc-button-primary:not(:disabled).fc-button-active {
    background-color: #0f2942 !important;
    border-color: #0f2942 !important;
}

.fc-today-button {
    font-weight: 500 !important;
}

.fc .fc-toolbar-title {
    font-weight: 600;
    color: #1a3a54;
}

/* Button at the bottom */
.action-button {
    background: #f8a01b;
    border: none;
    color: #1a3a54;
    font-weight: 600;
    font-size: 1rem;
    padding: 10px 25px;
    border-radius: 30px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(248, 160, 27, 0.3);
}

.action-button:hover {
    background: #e89417;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(248, 160, 27, 0.4);
}

/* Card styling */
.card {
    border-radius: 12px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

/* Time off event styling */
.time-off-event {
    border-left: 3px solid rgba(0,0,0,0.3) !important;
    border-radius: 4px !important;
    opacity: 0.85 !important;
    font-weight: 500 !important;
}
.time-off-event:hover {
    opacity: 1 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
/* Make sure time off events stay at the top in month view */
.fc-daygrid-day-events {
    display: flex !important;
    flex-direction: column !important;
}
.time-off-event {
    order: -1 !important; /* Place at the top */
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.card-header {
    background-color: #1a3a54;
    color: white;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
}

/* Improved responsive styling */
@media (max-width: 991.98px) {
    .calendar-container {
        height: calc(100vh - 60px);
        margin-top: 60px;
        padding: 8px;
    }
    .fc-toolbar.fc-header-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .fc-toolbar.fc-header-toolbar .fc-toolbar-chunk {
        flex: 1 1 100%;
        text-align: center;
        margin-bottom: 8px;
    }
    .fc-header-toolbar .fc-prev-button,
    .fc-header-toolbar .fc-next-button,
    .fc-header-toolbar .fc-today-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    .fc-header-toolbar .fc-button-group {
        display: flex;
        justify-content: center;
    }
    .fc-event-title {
        font-size: 0.85rem;
    }
    /* Make time frames tighter */
    .fc-timegrid-slot {
        height: 2.5rem; /* Reduced from default */
    }
}

@media (max-width: 767.98px) {
    .calendar-container {
        height: calc(100vh - 55px);
        margin-top: 55px;
        padding: 5px;
    }
    .fc .fc-toolbar-title {
        font-size: 1.2rem;
    }
    .fc-header-toolbar .fc-button {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    .fc-daygrid-event {
        padding: 2px;
    }
    .fc .fc-daygrid-event .fc-event-title {
        font-size: 0.75rem;
    }
    .fc-timegrid-event {
        min-height: 1.5rem; /* Reduced event minimum height */
    }
    .fc-timegrid-slot {
        height: 1.75rem; /* Even smaller time slots on mobile */
    }
    /* More compact time axis labels */
    .fc-timegrid-axis {
        font-size: 0.7rem;
        width: 35px !important;
    }
}

@media (max-width: 575.98px) {
    .calendar-container {
        height: calc(100vh - 50px);
        margin-top: 50px;
        padding: 3px;
    }
    .fc-toolbar-chunk:first-child {
        order: 2;
        margin-bottom: 0;
    }
    .fc-toolbar-chunk:nth-child(2) {
        order: 1;
        margin-bottom: 0.5rem;
    }
    .fc-toolbar-chunk:last-child {
        order: 3;
    }
    .fc .fc-toolbar-title {
        font-size: 1rem;
    }
    .fc-timegrid-slot {
        height: 1.25rem; /* Very compact time slots for small screens */
    }
    .fc-event {
        margin: 0 !important; /* Remove event margins to save space */
    }
    .fc-timegrid-event {
        min-height: 1.2rem; /* Minimum event height even smaller */
    }
}

/* Improved styling for modal on mobile */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    .modal-body {
        padding: 1rem;
        font-size: 0.9rem;
    }
    .modal-footer .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Job details modal specific mobile styling */
    #jobDetailsModal h4 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    #jobDetailsModal h5 {
        font-size: 1rem;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid #eee;
        padding-bottom: 0.3rem;
    }
    
    #jobDetailsModal .row {
        margin-bottom: 0.5rem;
    }
    
    #jobDetailsModal p {
        margin-bottom: 0.3rem;
        font-size: 0.85rem;
    }
    
    #jobDetailsModal .modal-footer {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    #jobDetailsModal .modal-footer .btn {
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        font-size: 0.8rem;
    }
}

/* Fix for calendar day header links */
.fc a {
    color: inherit;
    text-decoration: none;
}
.fc-col-header-cell-cushion,
.fc-daygrid-day-number {
    pointer-events: none;
    cursor: default;
    color: inherit;
    text-decoration: none;
}

/* Style for the missing address tag */
.missing-address-tag {
    background-color: #f1c40f; /* Yellow color for warning */
    color: #34495e; /* Dark color for text */
    font-size: 0.7em;
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 4px; /* Space between tag and event title */
    font-weight: bold;
    display: inline-block; /* Ensures proper layout */
    line-height: 1.2;
    vertical-align: middle; /* Align with text if needed */
}

/* Touch-friendly improvements */
.fc-event {
    cursor: pointer;
    padding: 2px;
    border-width: 3px !important; /* Make outline thicker (set back to 3px) */
    /* Use CSS variable for background color to allow layering */
    background-color: var(--fc-event-bg-color, #3498db); /* Default blue if var not set */
    position: relative; /* Needed for absolute positioning of ::before */
    overflow: hidden; /* Keep pseudo-elements contained */
}

/* Styling for completed job events */
.fc-event.is-completed {
    opacity: 0.7;
     /* Layer completed stripes on top */
     background-image: linear-gradient(45deg, rgba(255,255,255,0.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.2) 75%, transparent 75%, transparent);
     background-size: 10px 10px;
    background-repeat: repeat;
}

/* Style for the COMPLETED badge inside the event */
.fc-event .completed-badge {
    text-align: center;
    font-weight: bold;
    font-size: 0.8em; /* Made slightly smaller */
    padding: 1px 0;
    background-color: rgba(255,255,255,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.4);
    margin-bottom: 2px;
    color: #000000; /* Solid black text */
    line-height: 1.2;
}

.fc-daygrid-day {
    min-height: 5rem;
}

/* Date picker styling */
.date-picker-container {
    margin-bottom: 10px;
    display: none; /* Hidden by default, shown on mobile */
}

@media (max-width: 991.98px) {
    .date-picker-container {
        display: block;
        text-align: center;
        padding: 0 0.5rem;
    }
}

.date-input {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
    width: 100%;
    max-width: 200px;
    background-color: white;
}

.date-select-btn {
    margin-left: 5px;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
}

/* Mobile optimizations for condensed header */
@media (max-width: 767.98px) {
    .calendar-container {
        height: calc(100vh - 30px);
        margin-top: 30px;
        padding: 0;
    }
    
    /* Super condensed date picker - single line */
    .date-picker-container {
        margin: 0;
        padding: 0;
        position: absolute;
        top: -30px;
        left: 0;
        right: 0;
        height: 30px;
        z-index: 2;
        background-color: white;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .date-picker-container .input-group {
        display: flex;
        align-items: center;
        margin: 0;
        height: 30px;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .date-input {
        height: 30px;
        padding: 2px 5px;
        font-size: 0.8rem;
    flex-grow: 1;
        border-radius: 0;
        border: none;
        border-right: 1px solid #e0e0e0;
        max-width: 45%;
    }
    
    .date-select-btn {
        height: 30px;
        line-height: 1;
        padding: 0 8px;
        font-size: 0.8rem;
        border-radius: 0;
        margin-left: 0;
    }
    
    .nav-arrow-btn {
        height: 30px;
        line-height: 1;
        padding: 0 8px;
        font-size: 0.8rem;
        border: none;
        background-color: #f8f9fa;
        border-left: 1px solid #e0e0e0;
        color: #0d6efd;
        min-width: 36px; /* Make buttons wider */
    }
    
    /* View toggle button styling */
    .view-toggle-btn {
        height: 30px;
        line-height: 1;
        padding: 0 8px;
        font-size: 0.8rem;
        border: none;
        background-color: #f8f9fa;
        border-left: 1px solid #e0e0e0;
        color: #0d6efd;
        min-width: 65px; /* Wide enough for text */
    }
    
    /* Ultra compact calendar header */
    .fc-header-toolbar {
        margin: 0 !important;
        padding: 2px 2px !important;
        border-bottom: 1px solid #e0e0e0;
        height: 28px;
    }
    
    .fc-toolbar-title {
        font-size: 0.9rem !important;
        margin: 0 !important;
        line-height: 1 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    
    .fc-header-toolbar .fc-toolbar-chunk {
        flex: none;
        display: flex;
        align-items: center;
        margin: 0 !important;
    }
    
    .fc-header-toolbar .fc-button {
        padding: 0px 4px !important;
        font-size: 0.7rem !important;
        height: 24px !important;
        line-height: 1 !important;
        border-width: 1px !important;
    }
    
    .fc-header-toolbar .fc-today-button {
        padding: 0 6px !important;
    }
    
    /* Right-align view buttons */
    .fc-header-toolbar .fc-toolbar-chunk:last-child {
        margin-left: auto !important;
    }
    
    /* Left-align left buttons */
    .fc-header-toolbar .fc-toolbar-chunk:first-child {
        margin-right: auto !important;
    }
    
    /* Extremely compact time grid slots */
    .fc-timegrid-slot {
        height: 0.75rem !important; /* Drastically reduced */
    }
    
    .fc-timegrid-axis {
        font-size: 0.65rem !important;
        width: 30px !important;
        padding: 0 2px !important;
    }
    
    .fc-timegrid-slot-label-cushion {
        padding: 0 !important;
    }
    
    .fc-timegrid-body {
        overflow-y: visible !important;
    }
    
    .fc-view-harness {
        background-color: white;
    }
    
    .fc-timegrid-event {
        min-height: 0.7rem !important;
        margin: 0 !important;
    }
    
    .fc-timegrid-event .fc-event-main {
        padding: 0 2px !important;
    }
    
    .fc-timegrid-event .fc-event-title {
        font-size: 0.65rem !important;
        line-height: 1 !important;
    }
    
    /* Adjust day header to be more compact */
    .fc-col-header-cell {
        padding: 0 !important;
    }
    
    .fc-col-header-cell-cushion {
        padding: 2px 0 !important;
        font-size: 0.8rem !important;
    }
    
    /* Hide standard view buttons on mobile - we're using 3-day view */
    .fc-timeGridDay-button,
    .fc-timeGridWeek-button,
    .fc-dayGridMonth-button {
        display: none !important;
    }
    
    /* Hide ALL buttons in the right toolbar section on mobile (fixes hidden black/grey buttons issue) */
    .fc-header-toolbar .fc-toolbar-chunk:last-child button {
        display: none !important;
    }
    
    /* Mobile optimizations for month view */
    .fc-dayGridMonth-view .fc-scrollgrid-sync-table {
        height: auto !important;
    }
    
    .fc-dayGridMonth-view .fc-daygrid-day-frame {
        min-height: 4em;
        padding: 2px !important;
    }
    
    .fc-dayGridMonth-view .fc-daygrid-day-top {
        justify-content: center;
        font-size: 0.8rem;
    }
    
    .fc-dayGridMonth-view .fc-daygrid-day-number {
        padding: 1px !important;
        text-align: center;
    }
    
    .fc-dayGridMonth-view .fc-daygrid-day-events {
        margin: 0 !important;
        min-height: 0 !important;
    position: relative;
}

    .fc-dayGridMonth-view .fc-daygrid-body-balanced .fc-daygrid-day-events {
        position: absolute;
        left: 0;
        right: 0;
    }
    
    .fc-dayGridMonth-view .fc-daygrid-event-harness {
        margin: 1px 0 !important;
        width: 100% !important; /* Make events use full width */
    }
    
    .fc-dayGridMonth-view .fc-event {
        border-radius: 2px !important;
        margin: 0 !important;
        width: 100% !important;
    }
    
    .fc-dayGridMonth-view .fc-daygrid-event {
        padding: 1px 2px !important;
        white-space: normal !important;
        overflow: visible !important;
        display: block !important;
        width: 100% !important;
    }
    
    .fc-dayGridMonth-view .fc-event-title {
        font-size: 0.65rem !important;
        width: 100% !important;
        white-space: normal !important;
    }
    
    /* Mobile day view optimizations */
    .fc-timeGridDay-view .fc-timegrid-slot {
        height: 1rem !important; /* Extra space for daily view */
    }
    
    .fc-timeGridDay-view .fc-timegrid-event {
        min-height: 0.9rem !important; /* Allow smaller events in daily view */
    }
    
    .fc-timeGridDay-view .fc-event-title {
        font-size: 0.75rem !important; /* Slightly larger text for daily view */
    }
    
    /* Make days in month view appear clickable */
    .fc-dayGridMonth-view .fc-daygrid-day {
        cursor: pointer;
    }
    
    .fc-dayGridMonth-view .fc-daygrid-day:active {
        background-color: rgba(0, 123, 255, 0.1);
    }
    
    /* Styling for view toggle badge */
    .view-name-badge {
        background-color: rgba(0, 123, 255, 0.1);
        padding: 1px 4px;
        border-radius: 3px;
        margin-left: 3px;
        font-size: 0.7rem;
    }
}

/* Form styling */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid rgba(26, 58, 84, 0.2);
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #1a3a54;
    box-shadow: 0 0 0 0.25rem rgba(26, 58, 84, 0.25);
}

.form-label {
    font-weight: 500;
    color: #1a3a54;
    margin-bottom: 0.5rem;
}

/* Button styling */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #1a3a54;
    border-color: #1a3a54;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #0f2942;
    border-color: #0f2942;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-warning {
    background-color: #f8a01b;
    border-color: #f8a01b;
    color: #1a3a54;
}

.btn-warning:hover, .btn-warning:focus {
    background-color: #e89417;
    border-color: #e89417;
    color: #1a3a54;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(248, 160, 27, 0.3);
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: #5a6268;
    border-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Modal styling */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

.modal-header {
    background-color: #1a3a54;
    color: white;
    border-bottom: none;
    padding: 1.25rem 1.5rem;
}

.modal-header .btn-close {
    color: white;
    opacity: 0.8;
    filter: brightness(2);
}

.modal-header .modal-title {
    font-weight: 600;
}

.modal-footer {
    border-top: 1px solid rgba(0,0,0,0.1);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

/* Date select button styling */
.date-select-btn {
    background: #f8a01b;
    border: none;
    color: #1a3a54;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(248, 160, 27, 0.3);
}

.date-select-btn:hover, .date-select-btn:focus {
    background: #e89417;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(248, 160, 27, 0.4);
    color: #1a3a54;
}

/* Vertical bar on the left for events with an assigned tech */
.fc-event.has-tech-bar::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px; /* Width of the tech bar */
    background-color: var(--tech-bar-color, transparent); /* Use CSS variable */
    z-index: 1; /* Ensure bar is above background but below text/badge */
}

/* Desktop-only: make month view auto-height */
@media (min-width: 992px) {
    .fc-dayGridMonth-view {
        height: auto !important;
    }
}

/* ===== CALENDAR EVENT CARD STYLES ===== */

/* Base event card container */
.calendar-event-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 4px;
    overflow: hidden;
    height: 100%;
    font-size: 0.8rem;
    line-height: 1.2;
}

/* Customer name - primary text */
.calendar-event-card .event-customer-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
}

/* Job type display */
.calendar-event-card .event-job-type {
    font-size: 0.75rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Job type badge (for compact views) */
.calendar-event-card .event-job-type-badge {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.25);
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    white-space: nowrap;
}

/* Location text */
.calendar-event-card .event-location {
    font-size: 0.7rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Surface type text */
.calendar-event-card .event-surface-type {
    font-size: 0.65rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

/* Crew avatars container */
.calendar-event-card .event-crew {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-wrap: nowrap;
    margin-top: 2px;
}

/* Individual avatar */
.calendar-event-card .event-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.calendar-event-card .event-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Avatar placeholder with initials */
.calendar-event-card .event-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

/* Full desktop view */
.calendar-event-card.full {
    gap: 3px;
}

.calendar-event-card.full .event-customer-name {
    font-size: 0.85rem;
}

.calendar-event-card.full .event-crew {
    margin-top: 4px;
}

.calendar-event-card.full .event-avatar {
    width: 24px;
    height: 24px;
}

.calendar-event-card.full .event-avatar-placeholder {
    font-size: 0.6rem;
}

/* Compact mobile view - stacked layout for readability */
.calendar-event-card.compact {
    gap: 2px;
}

.calendar-event-card.compact .event-customer-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.calendar-event-card.compact .event-job-type {
    font-size: 0.7rem;
    opacity: 0.95;
}

.calendar-event-card.compact .event-location {
    font-size: 0.65rem;
}

.calendar-event-card.compact .event-surface-type {
    font-size: 0.6rem;
}

.calendar-event-card.compact .event-crew {
    margin-top: 2px;
}

.calendar-event-card.compact .event-avatar {
    width: 18px;
    height: 18px;
}

.calendar-event-card.compact .event-avatar-placeholder {
    font-size: 0.5rem;
}

/* Month view - show full content, allow wrapping */
.calendar-event-card.month-view {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 2px 4px;
    white-space: normal;
    word-wrap: break-word;
    overflow: visible;
    line-height: 1.2;
}

.calendar-event-card.month-view .event-month-name {
    font-size: 0.7rem;
    font-weight: 600;
}

.calendar-event-card.month-view .event-month-location {
    font-size: 0.65rem;
    opacity: 0.9;
}

.calendar-event-card.month-view .event-surface-type {
    font-size: 0.6rem;
    opacity: 0.85;
    font-style: italic;
}

.calendar-event-card.month-view .event-month-time {
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.95;
}

.calendar-event-card.month-view .event-month-jobtype {
    font-size: 0.65rem;
    opacity: 0.9;
}

/* Responsive adjustments for small events */
@media (max-width: 767.98px) {
    .calendar-event-card {
        font-size: 0.75rem;
    }
    
    .calendar-event-card .event-customer-name {
        font-size: 0.75rem;
    }
    
    .calendar-event-card .event-job-type {
        font-size: 0.65rem;
    }
    
    .calendar-event-card .event-location {
        font-size: 0.6rem;
    }
    
    .calendar-event-card .event-surface-type {
        font-size: 0.55rem;
    }
    
    .calendar-event-card .event-avatar {
        width: 16px;
        height: 16px;
    }
    
    .calendar-event-card .event-avatar-placeholder {
        font-size: 0.45rem;
    }
}

/* Ensure event content doesn't overflow */
.fc-event .fc-event-main {
    overflow: hidden;
}

/* Fix for FullCalendar event title container */
.fc-event-title-container {
    overflow: hidden;
}

/* Default event title styling - ensure visibility */
.fc-event .fc-event-title {
    white-space: pre-line;
}

/* Default title for non-job events (estimates, time off) */
.fc-event-title-default {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    padding: 2px 4px;
    white-space: normal;
    word-wrap: break-word;
}

/* Time off events - ensure title is always visible */
.time-off-event .fc-event-title,
.time-off-event .fc-event-title-default {
    display: block !important;
    white-space: normal;
    font-size: 0.75rem;
    line-height: 1.2;
}

/* ===== END CALENDAR EVENT CARD STYLES ===== */

/* Leads Board Page Specific Styles */
.header-container {
    background: linear-gradient(135deg, #0066cc 0%, #004999 100%);
    color: #FFFFFF;
    padding: 15px 0;
    margin-bottom: 15px;
}

/* Main container styles */
.container-fluid {
    height: calc(100vh - 130px); /* Subtract header height + margins */
    padding-bottom: 0 !important;
    display: flex;
    flex-direction: column;
}

/* CONSISTENT BUTTON STYLING */
.header-container .btn {
    border-radius: 30px !important;
    padding: 8px 20px !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    font-family: 'Poppins', sans-serif !important;
    letter-spacing: 0.5px !important;
    text-transform: none !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
    margin-left: 10px !important;
    border: none !important;
    height: auto !important;
    line-height: 1.5 !important;
}

/* Blue button style */
.header-container .filter-button {
    background-color: #0099ff !important;
    color: white !important;
}

.header-container .filter-button:hover {
    background-color: #0080e6 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 153, 255, 0.3) !important;
}

/* Yellow button style */
.header-container .btn-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
    border: none !important;
}

.header-container .btn-warning:hover {
    background-color: #ffca2c !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3) !important;
}

/* Swimlanes container */
.swimlanes-container {
    display: flex;
    gap: 10px;
    width: 100%;
    height: 100%; /* Take full height of container */
    align-items: stretch; /* Make all swimlanes stretch to full height */
    padding-bottom: 15px;
}

/* A single column (swimlane) */
.swimlane {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 0; /* Remove padding from swimlane */
    height: 100%; /* Take full height */
    max-height: none; /* Remove max-height limitation */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    flex: 0 0 180px; /* Make empty lanes very narrow by default */
    min-width: 180px; /* Reduce minimum width */
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative; /* For proper stacking context */
}

/* Make lanes with cards wider */
.swimlane:has(.lead-card:not([style*="display: none"])) {
    flex: 1 1 300px; /* Give more space to lanes with cards */
}

/* Not Qualified section should always be wider due to sub-lanes */
.swimlane[data-status="not qualified"] {
    flex: 1.2 1 350px; /* Give even more space to Not Qualified section */
    padding: 0;
}

/* Content containers */
.swimlane-content, .sub-lane-content {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Lead card styling */
.lead-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
    margin: 0;
    cursor: pointer;
    border-left: 4px solid var(--update-age-color, #ccc);
}

.lead-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.lead-card:active {
    cursor: grabbing;
}

.lead-card--perimeter {
    background-color: #e0f0ff;
}

/* Left border color is driven by --update-age-color (stale-lead green→red gradient).
   Status classes no longer override it; won/lost force green/red via the var in PHP. */
.lead-card--follow-up-overdue {
    background-color: #ffebee;
}

.lead-card .text-muted-light {
    color: #777;
}

.lead-card .text-muted-light-updated {
    color: grey;
    font-style: italic;
}

.lead-card__notes-divider {
    border-top: 1px dashed #ccc;
    padding-top: 8px;
    margin-top: 8px;
}

.status-badge {
    float: right;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
}

.status-badge--won {
    background-color: #d4edda;
    color: #155724;
}

.status-badge--lost {
    background-color: #f8d7da;
    color: #721c24;
}

.status-badge--not-qualified {
    background-color: #e2e3e5;
    color: #383d41;
}

.status-badge--estimate-scheduled {
    background-color: #cfe2ff;
    color: #084298;
}

.status-badge--estimate-sent {
    background-color: #cfe2ff;
    color: #084298;
}

.status-badge--estimate-created {
    background-color: #cfe2ff;
    color: #084298;
}

.status-badge--job-status {
    background-color: #0066cc;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status-badge--job-status i {
    font-size: 0.7rem;
}

.follow-up-info {
    margin: 5px 0;
    padding: 5px;
    background-color: rgba(0,0,0,0.03);
    border-radius: 4px;
}

.follow-up-info__text {
    font-weight: bold;
    color: #17a2b8;
}

.btn-add-note {
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
}

.status-separator {
    border-top: 2px dashed #dee2e6;
    margin: 20px 0;
    text-align: center;
    position: relative;
}

.status-separator__text {
    position: relative;
    top: -12px;
    background: #f8f9fa;
    padding: 0 12px;
    color: #6c757d;
    font-size: 0.85rem;
}

.status-heading__badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-heading__badge--won {
    background: #d4edda;
    color: #155724;
}

.status-heading__badge--lost {
    background: #f8d7da;
    color: #721c24;
}

.status-heading__badge--not-qualified {
    background: #e2e3e5;
    color: #383d41;
}

/* Empty lane styling */
.empty-lane {
    color: #6c757d;
    text-align: center;
    padding: 20px;
    font-style: italic;
    background: rgba(0,0,0,0.02);
    border-radius: 6px;
    margin: 0;
}

/* Not Qualified section */
.swimlane[data-status="not qualified"] .swimlane-content {
    padding: 10px;
    gap: 10px;
    display: flex;
    flex-direction: column;
}

/* Sub-lanes in Not Qualified section */
.sub-lane {
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    margin: 0;
    background-color: #f8f9fa;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sub-lane-content {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.swimlane-title, .sub-lane-title {
    position: sticky;
    top: 0;
    background: inherit;
    padding: 15px;
    font-weight: 600;
    color: #0066cc;
    border-bottom: 1px solid #e0e6ed;
    z-index: 10;
    border-radius: 8px 8px 0 0;
    margin: 0;
}

.sub-lane-title {
    background: #f8f9fa;
    font-size: 0.95em;
}

.dragging {
    opacity: 0.7;
    transform: scale(0.95);
}
/* For inline note editing */
.note-editor {
    margin-top: 5px;
}
.note-editor textarea {
    width: 100%;
    height: 80px;
    margin-bottom: 5px;
}

/* Filter button styling */
.filter-button {
    color: white;
    background-color: #0099ff;
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-button:hover {
    background-color: #0080e6;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 153, 255, 0.3);
}

/* Add Lead button */
.btn-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
    border: none !important;
    padding: 12px 25px !important;
    border-radius: 30px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
}

.btn-warning:hover {
    background-color: #ffca2c !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3) !important;
}

/* MEDIA QUERIES */
@media (max-width: 991.98px) {
    .swimlanes-container {
        overflow-x: auto;
        flex-wrap: nowrap;
        margin: 0 -10px;
    }
    .swimlane {
        flex: 0 0 66.6667%;
        min-width: 260px;
    }
    .swimlane-title {
        font-size: 1.1rem;
    }
    .lead-card {
        font-size: 0.95rem;
        min-width: 200px;
    }
    .header-container h1 {
        font-size: 1.5rem;
    }
}

@media (min-width: 992px) {
    .swimlanes-container {
        overflow-x: hidden;
        flex-wrap: nowrap;
        margin: 0 -10px;
    }
    .swimlane {
        flex: 1 1 auto;
        min-width: 0;
    }
    .swimlane-title {
        font-size: 1rem;
    }
    .lead-card {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .swimlane {
        min-width: 240px;
    }
    .controls-row {
        flex-direction: column;
        align-items: stretch !important;
    }
    .controls-row > div {
        margin-bottom: 10px;
    }
}

.swimlane[data-status="results"] .results-section {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
    flex: 1;
    min-height: calc(33.33% - 20px); /* 1/3 height minus margins */
    max-height: 33.33%; /* 1/3 of container */
    overflow: auto;
}

.swimlane[data-status="results"] .swimlane-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.swimlane[data-status="results"] .won-section {
    background-color: rgba(40, 167, 69, 0.05);
    border: 1px dashed rgba(40, 167, 69, 0.3);
}

.swimlane[data-status="results"] .lost-section {
    background-color: rgba(220, 53, 69, 0.05);
    border: 1px dashed rgba(220, 53, 69, 0.3);
}

.swimlane[data-status="results"] .not-qualified-section {
    background-color: rgba(108, 117, 125, 0.05);
    border: 1px dashed rgba(108, 117, 125, 0.3);
}

/* Section headings for results column */
.status-heading {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* Container for cards in results sections */
.section-content {
    padding-top: 5px;
}

/* Make all lead cards have consistent spacing regardless of column */
.lead-card {
    margin-bottom: 10px;
}

/* Last lead card in any container should have no bottom margin */
.lead-card:last-child {
    margin-bottom: 0;
}

.swimlane[data-status="results"] .won-section:after,
.swimlane[data-status="results"] .lost-section:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none; /* Allow clicks to pass through */
    z-index: 0;
}

.swimlane[data-status="results"] .won-section.drag-over,
.swimlane[data-status="results"] .lost-section.drag-over {
    background-color: rgba(40, 167, 69, 0.1);
}

/* Add highlight for section-content when dragging over */
.section-content.drag-over {
    background-color: rgba(40, 167, 69, 0.05);
    border-radius: 6px;
}

/* Styling for the combined estimates column */
.swimlane[data-status="estimates"] .estimates-section {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
    flex: 1;
    min-height: calc(50% - 20px); /* 1/2 height minus margins */
    overflow: auto;
}

.swimlane[data-status="estimates"] .swimlane-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.swimlane[data-status="estimates"] .scheduled-section {
    background-color: rgba(0, 123, 255, 0.05);
    border: 1px dashed rgba(0, 123, 255, 0.3);
}

.swimlane[data-status="estimates"] .sent-section {
    background-color: rgba(40, 167, 69, 0.05);
    border: 1px dashed rgba(40, 167, 69, 0.3);
}

/* Styles moved from calendar.php for better separation */
.fc-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
}

.fc-context-menu div {
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.2s; /* Added for smoothness */
}

.fc-context-menu div:hover {
    background-color: #f0f0f0;
}

/* Time off events were styled via JS, now via this class from the start */
.time-off-event {
    font-weight: bold !important;
    z-index: 5 !important;
}

@media (max-width: 767.98px) {
    .fc-toolbar {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Ultra-compact buttons, moved from JS */
    .fc-button,
    .fc-header-toolbar .fc-button { /* More specific selector to override defaults */
        padding: 0 4px !important;
        font-size: 0.7rem !important;
        height: 24px !important;
        line-height: 1 !important;
    }

    /* Month view optimization for mobile, moved from JS */
    .fc-dayGridMonth-view .fc-daygrid-day-events {
        min-height: 0 !important;
    }
    
    /* Replaces JS-based text truncation for cleaner implementation */
    .fc-timeGrid3Day-view .fc-event-title,
    .fc-timeGridDay-view .fc-event-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}