/* Common styles from gantt.html */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding-left: 2px;
    padding-bottom: 75px;
    overflow-x: auto;
    overflow-y: auto; /* Ensure vertical scrolling is enabled */
}

footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background: #333;
    color: white;
    text-align: center;
    padding: 10px 0;
    z-index: 1001;
}

.menu-bar {
    background-color: #333;
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    top: 0;
    width: 100%;
    max-width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    overflow-x: hidden;
    white-space: nowrap;
    padding-right: 20px;
    overflow: visible;
}

.menu-logo {
    display: block;
    flex: 0 0 auto;
    padding:10px;
}

.menu-logo a {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
}

.menu-items {
    list-style-type: none;
    margin: 0;
    padding: 10px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: calc(100vw - 120px);
    background-color: #333;
    border-bottom: 1px solid #444;
    position: fixed;
    overflow: visible;
    justify-content: flex-end;
    margin-right: 0;
}

.menu-items li a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 5px 8px;
    transition: color 0.3s;
    white-space: nowrap;
    display: inline-block;
    transition: background-color 0.3s;
}

.menu-items li a:hover {
    background-color: #444;
    transition: background-color 0.3s;
}

.table-wrapper {
    flex: 0 0 auto; /* Prevent table from shrinking or growing */
    position: sticky;
    left: 0;
    z-index: 70;
    overflow-y: visible; /* No vertical scrolling */
    overflow-x: visible; /* Prevent horizontal scrollbar */
}

.dropdown {
    display: inline-block;
    position: relative;
}

.dropdown > a {
    padding-right: 10px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #333;
    min-width: 240px;
    max-width: 300px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    right: auto;
    left: 0;
    list-style-type: none;
    padding: 0;
    margin: 0;
    overflow: visible;
    white-space: nowrap;
    top: calc(100% + 2px);
}

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

.dropdown-content li a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    transition: background-color 0.3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-content li a:hover {
    background-color: #444;
}


    .menu-logo {
        display: block; /* Ensure the logo is visible and takes up space */
        flex: 0 0 auto;
    }
    /* Style for the menu logo (unchanged, but included for context) */
    .menu-logo a {
        color: #fff;
        font-size: 18px;
        font-weight: bold;
        text-decoration: none;
    }

    /* Style for menu items (li > a) */
    .menu-items li a {
        color: #fff;
        text-decoration: none;
        font-size: 14px;
        padding: 5px 8px; /* Further reduce padding for items */
        transition: color 0.3s;
        white-space: nowrap; /* Prevent text wrapping within links */
        display: inline-block; /* Ensure block-level behavior for hover/focus */
        transition: background-color 0.3s; /* Prevent movement on hover, add smooth transition only for submenus */
    }

    /* Hover effect for top-level menu items (no movement) */
    .menu-items li a:hover {
        background-color: #444; /* Darker background on hover */
        transition: background-color 0.3s; /* Smooth transition for hover effect, no movement */
    }

    /* Dropdown for overflow items on desktop */
    .menu-more {
        display: none;
        position: relative;
    }

    .menu-more.active .dropdown {
        display: block;
    }

    /* Style for the Manage dropdown container */
    .dropdown {
        display: inline-block;
        position: relative; /* Position for submenu */
    }

    /* Style for the Manage menu item (with dropdown arrow) */
    .dropdown > a {
        padding-right: 10px; /* Reduced padding since we’re using an inline arrow, adjust as needed */
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    }

    /* Style for the submenu (hidden by default, shown on hover) */
    .dropdown-content {
        display: none; /* Hide submenu by default */
        position: absolute; /* Position below the parent */
        background-color: #333; /* Match menu background */
        min-width: 240px; /* Increased width to fully accommodate longer items like "Change Orders" */
        max-width: 300px; /* Prevent excessive width */
        box-shadow: 0 8px 16px rgba(0,0,0,0.2); /* Optional: Add shadow for depth */
        z-index: 1001; /* Increased z-index to ensure it’s above other elements, including .header-container */
        right: auto; /* Reset to auto for dynamic positioning */
        left: 0; /* Align with the left edge of the dropdown by default */
        list-style-type: none; /* Remove bullets */
        padding: 0; /* Remove default padding */
        margin: 0; /* Remove default margin */
        overflow: visible; /* Ensure content isn’t clipped */
        white-space: nowrap; /* Prevent text wrapping */
        top: calc(100% + 2px); /* Position below the parent item (full height + 2px buffer for spacing) */
        z-index: 1001;
    }

    /* Show submenu on hover of the dropdown (Manage) */
    .dropdown:hover .dropdown-content {
        display: block; /* Show submenu on hover */
    }

    /* Dynamically adjust submenu position to prevent viewport cutoff and left-side appearance */
    .dropdown-content {
        /* Add this to handle right-edge overflow dynamically and prevent left-side appearance */
        position: absolute;
        left: 0; /* Default left alignment */
        right: auto; /* Prevent right overflow */
    }

    /* Ensure submenu doesn’t get cut off by viewport (dynamic positioning) */


    /* Adjust if submenu extends beyond viewport on the right or left */
    .dropdown-content {
        display: none; /* Hide submenu by default */
        position: absolute; /* Position below the parent */
        background-color: #333; /* Match menu background */
        min-width: 240px; /* Increased width to fully accommodate longer items like "Change Orders" */
        max-width: 300px; /* Prevent excessive width */
        box-shadow: 0 8px 16px rgba(0,0,0,0.2); /* Optional: Add shadow for depth */
        z-index: 1001; /* Increased z-index to ensure it’s above other elements, including .header-container */
        right: auto; /* Reset to auto for dynamic positioning */
        left: 0; /* Align with the left edge of the dropdown by default */
        list-style-type: none; /* Remove bullets */
        padding: 0; /* Remove default padding */
        margin: 0; /* Remove default margin */
        overflow: visible; /* Ensure content isn’t clipped */
        white-space: nowrap; /* Prevent text wrapping */
        top: calc(100% + 2px);
    }
        .dropdown:hover .dropdown-content {
        display: block; /* Show submenu on hover */
    }

    /* Style for submenu items */
    .dropdown-content li a {
        color: white; /* White text */
        padding: 12px 16px; /* Match or adjust padding */
        text-decoration: none; /* Remove underlines */
        display: block; /* Stack vertically */
        font-size: 14px; /* Match menu font size */
        transition: background-color 0.3s; /* Smooth transition for hover effect, no movement */
        white-space: nowrap; /* Prevent text wrapping */
        overflow: hidden; /* Hide overflow if text is too long */
        text-overflow: ellipsis; /* Add ellipsis if text overflows */
    }

    .dropdown-content li a:hover {
        background-color: #444; /* Darker background on hover */
    }

    /* Additional styling for dropdown list items */
    .dropdown li {
        list-style: none;
        padding: 5px 10px;
    }

    /* Menu toggle for mobile */
    .menu-toggle {
        display: none;
        color: #fff;
        font-size: 24px;
        cursor: pointer;
    }

    nav.menu-bar ul.menu-items {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    /* Style for the header container */
    .header-container {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin: 0; /* Remove all margins */
        padding: 0 10px; /* Minimal padding on sides */
        width: 100%;
        max-width: 100vw;
        border-bottom: 1px solid #ccc;
        z-index: 900;
    }

    /* Hide login/signup buttons for authenticated users (JavaScript will handle this) */
    #login-btn, #signup-btn {
        display: none; /* Initially hidden, shown based on user state */
    }

    /* Style for project dates */
    .project-dates {margin-top: 10px; padding: 0;}

    .project-date-label {
        font-size: 12px; /* Match or exceed start date size */
        width: 100%; /* Ensure full width for consistent alignment */
        line-height: 1; /* Tighten line height for precise alignment */
    }

    .project-date-label input[type="date"] {
        font-size: 12px; /* Match the label font size */
        border: 1px solid #ddd; /* Match other inputs */
        padding: 2px; /* Minimal padding for consistency */
        cursor: pointer; /* Indicate clickable */
        width: 150px;
    }

    /* Ensure project actions and selector stay aligned on wide screens */
    .project-selector-wrapper {
        display: flex;
        align-items: center;
        gap: 8px; /* Space between selector and actions */
        min-width: 300px; /* Match your current setting */
        padding:5px;
    }

    .project-selector {
        width: 300px;
        min-width: 300px;
    }

    #project-selector {
        width: 400px; /* Set a fixed width, adjust as needed (match your current setting) */
        max-width: 275px;
        box-sizing: border-box; /* Include padding and border in the width */
        padding: 2px; /* Minimal padding for consistency */
        font-size: 12px; /* Match other inputs */
        height: 24px; /* Match button height for alignment */
        border: 1px solid #ddd; /* Match other inputs */
        margin: 0; /* Remove default margins */
        vertical-align: middle; /* Align with action icons */
    }

    .project-actions {
        display: flex;
        gap: 8px; /* Space between action icons */
        padding-left: 5px;
    }

    .action-icon {
        font-size: 10px; /* Match button size */
        cursor: pointer; /* Indicate clickable */
        padding: 2px; /* Minimal padding for touch targets */
        background-color: transparent; /* Blend with background */
        border: none; /* Remove border */
        color: #000; /* Match text color */
    }

    .action-icon:hover {
        color: #333; /* Darken on hover for feedback */
    }

    /* Ensure tooltips are visible and styled */
    .action-icon[title]:hover:after {
        content: attr(title);
        position: absolute;
        z-index: 1000;
        background: #000;
        color: #fff;
        padding: 5px 10px;
        border-radius: 4px;
        font-size: 12px;
        white-space: nowrap;
        margin-left: -5px; /* Adjust for positioning */
        margin-top: 5px; /* Position below icon */
    }
    
    .project-controls {
        display: none; /* Hide the old controls */
    }
    
    h1 {
        margin: 10px 0; /* Remove excessive white space */
    }

    /* Ensure actions stay on the same line */
    .project-controls > .project-selector-wrapper {
        margin-bottom: 10px; /* Space before project dates */
    }

    .task-table {
        background-color: #f5f5f5;
        border-collapse: collapse;
    }

    .task-table tr {
        height: 20px; /* 2 Gantt rows per table row */
    }
    
    .task-table td {
        height: 20px;
        vertical-align: middle;
        padding: 1px;
    }

    .task-table th, .task-table td {
        border: 1px solid #ddd;
        border-bottom: 1px solid #ccc;
      /*  padding: 4px;  /*  */
        text-align: left;
        vertical-align: middle;
      /*  max-width: 200px; /* Cap max width */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        box-sizing: border-box; /* Include padding in width */
    }

    .task-table th.frozen, .task-table td.frozen {
        position: sticky;
        background: #fff;
        z-index: 10;
    }

    .task-table th:hover::after {
        content: attr(title);
        position: absolute;
        background: #000;
        color: #fff;
        padding: 5px;
        border-radius: 3px;
        z-index: 1000;
    }

    .color-picker-emoji {
        font-size: 0.8em !important;
        transform: scale(0.8) !important;
        display: inline-block;
        vertical-align: middle;
    }

    .task-number {
        text-overflow: clip !important;
        overflow: visible !important;
        white-space: nowrap !important;
    }
    
    .task-number::after {
        content: none !important;
    }

    .task-number { max-width: 70px; min-width: 70px; }
    .task-name { max-width: 200px; min-width: 200px; }
    .start-date, .end-date { max-width: 60px; min-width: 60px;}
    .duration-column { max-width: 150px; min-width: 150px; }
    .relationship-wrapper { max-width: 120px; min-width: 120px; }
    .resources-column { max-width: 150px; min-width: 150px; }
    .actions-column { max-width: 120px; min-width: 120px; }
    .phase-column { max-width: 100px; min-width: 100px; }
    .complete-column { max-width: 60px; min-width: 60px; }
    .progress-column { max-width: 80px; min-width: 80px; }
    .comments-column { max-width: 200px; min-width: 200px; text-align: center;}
    
    .task-table td.start-date, .task-table td.end-date {
        font-size: 10px;
    }

    .relationship-wrapper, .resources-column, .constraint-column { max-width: 100px; min-width: 100px; }

    .task-number input[type="color"] {
        width: 20px;
        height: 20px;
        vertical-align: middle;
        appearance: none;
        -webkit-appearance: none;
        border: none;
        background: none;
        cursor: pointer;
    }

    .duration-column input, .progress-column input {
        border: 1px solid #ddd;
        padding: 2px;
        background-color: #fff;
    }

    .duration-column select {
        width: 40px;
        text-align: center;
    }
    
    .duration-column select:hover::after {
        content: attr(title);
        position: absolute;
        background: #000;
        color: #fff;
        padding: 5px;
        border-radius: 3px;
        z-index: 1000;
    }

    .relationship-container {
        position: relative;
    }
    
    .relationship-container select {
        width: 100%;
        max-height: 24px;
        overflow-y: auto;
    }

    .rel-type-selector {
        position: absolute;
        background: #fff;
        border: 1px solid #ddd;
        z-index: 20;
    }
    
    .relationship-container select:focus + .rel-type-selector {
        display: block;
    }

    .task-table textarea, .task-table select, .task-table input[type="number"] {
        box-sizing: border-box;
        width: 100%;
    }

    .task-table input, .task-table select {
        border: 1px solid #ddd;
    }

    .constraint-column select, .constraint-column input[type="date"] {
        display: inline-block;
        vertical-align: middle;
    }

    .phases-list {
        margin-left: 20px;
        padding: 10px;
        background-color: #f0f0f0;
        border: 1px solid #ddd;
        border-radius: 4px;
        width: 200px;
    }
    
    .phases-list h3 {
        margin: 0 0 10px;
        font-size: 16px;
    }
    
    .phases-list ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .phases-list li {
        padding: 5px 0;
        font-size: 14px;
    }

    button {
        padding: 2px 5px;
        font-size: 12px;
        cursor: pointer;
        background-color: transparent; /* Remove button background to blend with heading */
        border: none; /* Remove button border to blend with heading */
        color: #000; /* Ensure button text color matches heading text */
    }

    button.add-task {
        color: black; /* Specific color for the add button */
      /*  font-weight: bold; /* Match original appearance */
    }

    .add-task {
        border-radius: 0;
        background-color: transparent;
        color: #4CAF50;
        border: none;
    }

    .summary {
        font-size: 14px;
    }

    .error {
        color: red;
        font-weight: bold;
        margin-top: 10px;
    }

    .button-group {
        display: flex;
        gap: 5px; /* Space between buttons */
        justify-content: center;
        align-items: center;
        padding: 2px;
    }

    .button-group button {
        width: 24px;
        height: 24px;
        font-size: 12px;
        padding: 0;
    }

    .button-group.top {
        margin-bottom: 10px; /* Add 10px space between the top and bottom button groups */
        align-items: center;
        padding: 8px;
    }

    .column-selector {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        background-color: #f9f9f9;
        border: 1px solid #ddd;
        border-radius: 5px;
        margin-bottom: 10px;
        position: relative;
        top: 0;
        left: 0;
        width: 100%; /* Ensure it takes the full width of its parent */
        min-height: 50px;
        height: auto !important; /* Ensure the height is not collapsed */
        visibility: visible;
        opacity: 1;
        z-index: 1000;
        overflow: visible !important; /* Ensure content isn’t clipped */
        box-sizing: border-box;
    }

    .column-selector label {
        display: flex;
        align-items: center;
        gap: 5px;
        font-size: 14px;
        visibility: visible;
        opacity: 1;
        overflow: visible !important;
        height: auto !important;
        min-height: 20px; /* Ensure each label has a minimum height */
        line-height: 1.5;
    }
    
    .column-selector input[type="checkbox"] {
        margin: 0;
        visibility: visible;
        opacity: 1;
        width: 16px;
        height: 16px;
        display: inline-block;
        flex-shrink: 0;
    }  

    #chartjs-tooltip {
        position: absolute;
        background: rgba(0, 0, 0, 0.8);
        color: #fff;
        border-radius: 10px;
        padding: 20px;
        pointer-events: none;
        z-index: 1000; /* Ensure it’s above all other elements */
        font-size: 12px; /* Match body font size from tooltip options */
        white-space: nowrap; /* Prevent text wrapping for clean display */
    }
    .login-container { 
        max-width: 400px;
        margin: 50px auto;
        padding: 40px;
        text-align: center;
        border: 1px solid #ccc;
        border-radius: 5px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        background-color: #fff;
    }
    .login-container h1 {
        color: #333;
        font-size: 24px;
        margin-bottom: 20px;
    }
    .login-container input {
        margin: 10px 0;
        padding: 10px;
        width: 100%;
        border: 1px solid #ccc;
        border-radius: 4px;
        font-size: 16px;
    }
    .login-container button {
        padding: 10px 20px;
        background-color: #007bff;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 16px;
    }
    .login-container button:hover {
        background-color: #0056b3;
    }
    .login-container p {
        margin-top: 15px;
        font-size: 14px;
    }
    .login-container a {
        color: #007bff;
        text-decoration: none;
    }
    .login-container a:hover {
        text-decoration: underline;
    }
    .logo {
        display: inline;
        margin: 0 auto 20px;
        width: 100px; /* Adjust size as needed */
    }
    input { 
        margin: 10px 0; 
        padding: 8px; 
        width: 100%; 
    }
    button { 
        padding: 10px; 
        margin: 5px; 
    }

    /* Add media queries and other styles as needed */
@media (max-width: 768px) {
    .menu-toggle { display: block; color: #fff; font-size: 24px; cursor: pointer; padding: 10px;}
    .menu-bar { padding: 5px 0; }
    .menu-items { display: none; }
    .menu-items.active { display: flex; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background-color: #333; padding: 10px; gap: 8px; z-index: 1002; }
    .menu-items li { width: 100%; text-align: center; }

    nav.menu-bar ul.menu-items {display: none; flex-direction: column; position: absolute; top: 60px; left: 0; width: 100%; background-color: #333; z-index: 1002;}
    nav.menu-bar ul.menu-items.active {display: flex; }
    nav.menu-bar ul.menu-items li { margin: 10px 0; text-align: center;}
    nav.menu-bar ul.menu-items li a { display: block; padding: 10px; color: #fff; text-decoration: none; }

    .dropdown {position: relative;}
    .dropdown > a::after{content: none;}
    .dropdown-content{display: block; position:static; background-color: #444; box-shadow: none; min-width: auto; max-width: none; padding: 0; margin: 0;}
    .dropdown-content li {width: 100%; text-align: center;}
    .dropdown-content li a { padding: 10px;}
    .header-container {display: flex; justify-content: space-between; align-items: flex-start; margin: 0; padding: 0 10px; width: 100%; max-width: 100vw; border-bottom: 1px solid #ccc; z-index: 900; }
    .project-dates { margin-top: 5px; align-items: center; }
    .project-controls { margin-top: 10px; display: none;}
    .project-date-label { font-size: 12px; width: 100%; line-height: 1; }
    .project-date-label input[type="date"] { font-size: 12px; width: 150px; }
    .table-gantt-container {flex-direction: column;}
    .table-wrapper, .gantt-wrapper {width: 100%;}
}

    /* Show dropdown if items overflow */
    @media (min-width: 769px) {
        .menu-items {
            position: relative;
        }

        .menu-items.overflow .menu-more {
            display: block;
        }

        .menu-items.overflow li:not(.menu-more) {
            display: none;
        }

        .menu-more {
            cursor: pointer;
        }

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