body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
}

.mobile-header {
    display: none; /* Hidden by default */
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
}

.overlay.open {
    display: block;
}

/* for schedule.php */
.schedule-grid {
    display: grid;
    grid-template-columns: 113px repeat(14, 1fr);
    gap: 1px;
    background-color: #ddd;
}

.schedule-grid > div {
    background-color: #fff;
    padding: 8px;
    text-align: center;
    border: 1px solid #ddd;
}

.shift-cell-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 50px; /* Ensure empty cells are clickable */
}

.highlight-today {
    background-color: lightyellow !important;
}

.shift-entry {
    padding: 4px;
    border-radius: 4px;
    font-size: 0.75em; /* Made font size smaller */
    cursor: grab; /* Change cursor to indicate draggable */
    margin-bottom: 5px; /* Add margin to the bottom of each shift entry */
    background-color: #f5f5f5; /* Light grey background for all shifts */
}

.shift-entry:active {
    cursor: grabbing;
}

/* SortableJS Classes for visual feedback */
.sortable-ghost {
    opacity: 0.4;
    background: #c8ebfb;
}

.sortable-chosen {
    opacity: 0.8;
}

.sortable-drag {
    opacity: 1 !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: rotate(5deg);
}

.sortable-fallback {
    opacity: 0.8;
    background: #f0f0f0;
    border: 2px dashed #007bff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Prevent transitions during drag */
body.dragging * {
    transition: none !important;
    animation: none !important;
}

body.dragging .shift-entry {
    pointer-events: none;
}

.shift-entry.status-cancelled {
    text-decoration: line-through;
    color: #888 !important; /* Medium gray and important to override other styles */
    background-color: #f5f5f5 !important; /* Lighter gray background */
}

.recurring-icon {
    font-size: 0.8em;
    color: #007bff;
    margin-right: 2px;
    display: inline-block;
}

.new-indicator {
    background-color: #dc3545; /* Red background */
    color: white;
    font-size: 0.7em;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 2px; /* Adjusted margin */
    vertical-align: middle;
    display: inline-block;
    font-weight: bold;
}

.new-grid-indicator {
    background-color: #28a745; /* Green background */
    color: white;
    font-size: 0.6em;
    padding: 1px 3px;
    border-radius: 2px;
    margin-left: 3px;
    vertical-align: middle;
    display: inline-block;
    font-weight: bold;
}

.new-envelope-icon {
    background-color: #1d3a5a; /* Dark blue for envelope */
    color: white;
    font-size: 0.8em; /* Adjust size as needed */
    padding: 1px 3px;
    border-radius: 2px;
    margin-left: 3px;
    vertical-align: middle;
    display: inline-block;
    font-weight: bold;
}

.schedule-grid .header {
    background-color: #f0f0f0;
    font-weight: bold;
    color: black;
    padding: 4px; /* Adjust padding for two lines */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.2; /* Adjust line height */
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 00px; /* Position below the schedule controls with proper spacing */
    z-index: 999;
}
.schedule-grid .caregiver {
    background-color: #f9f9f9;
    font-weight: bold;
}
.schedule-grid .shift {
    background-color: #ffffff;
    color: #333;
    transition: background-color 0.3s ease;
    font-size: 10px; /* Adjusted font size for better readability with multiple shifts */
    padding: 3px; /* Reduced padding to fit more content */
    white-space: pre-wrap; /* Allow text to wrap and respect line breaks */
    display: flex;
    flex-direction: column;
}
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}
.modal-content {
    background-color: #fefefe;
    margin: 10% auto; /* Adjusted margin */
    padding: 0; /* Remove padding to use header/body structure */
    border: 1px solid #ddd;
    width: 90%;
    max-width: 700px; /* Increased max-width */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overflow: hidden; /* To contain the border-radius */
}

.modal-header {
    background-color: #f7f7f7;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1002;
    background-color: #f7f7f7;
    border-bottom: 2px solid #ddd;
}

.modal-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-right: 20px;
}

.modal-header-buttons {
    display: flex;
    gap: 8px;
}

.header-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2em;
}

.hours-display {
    font-weight: bold;
    color: #333;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    display: inline-block;
    min-width: 60px;
    text-align: left;
    font-family: Arial, sans-serif;
}

/* Standardize font for time and date inputs to match select dropdowns */
input[type="date"], 
input[type="time"] {
    font-family: Arial, sans-serif;
}

/* Standardize font sizes throughout the modal */
.modal-grid input,
.modal-grid select,
.modal-grid textarea,
.modal-grid label,
.modal-grid .hours-display {
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.modal-body {
    padding: 20px;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Messaging Styles */
#messages-container, #other-messages-container, #progress-notes-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.message-entry {
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.message-entry p {
    margin: 0;
}

.file-icon {
    text-decoration: none;
    font-size: 1.2em;
    margin-left: 10px;
}

.add-message-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.add-message-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.message-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.file-upload-input {
    display: none;
}

.file-upload-label {
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-upload-label svg {
    color: #555;
}

.button-primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.button-primary:hover {
    background-color: #0056b3;
}

.file-upload-label.file-selected svg {
    color: #28a745; /* Green when file is selected */
}

#file-selected-indicator {
    margin-left: 10px;
    font-style: italic;
    color: #555;
}

#other-messages-section h4 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.button-small {
    padding: 2px 8px;
    font-size: 0.8em;
}

/* Section toggle styles */
.section-header h3 {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-grow: 1; /* Allow h3 to take available space */
}

.new-indicator-group {
    display: flex;
    align-items: center;
    gap: 2px; /* Small gap between new indicator and arrow */
}

.section-toggle-arrow {
    transition: transform 0.3s ease;
    font-size: 0.8em;
    margin-left: 10px;
}

.section-toggle-arrow.expanded {
    transform: rotate(180deg);
}

.section-content {
    display: none;
    overflow: hidden;
}

.section-content.expanded {
    display: block;
}

.modal-grid .full-width {
    grid-column: 1 / -1;
}

.modal-grid textarea {
    width: 100%;
    box-sizing: border-box; /* Ensures padding is included in the width */
    font-family: Arial, sans-serif; /* Match body font */
}

.modal-grid fieldset {
    grid-column: 1 / -1;
    border: none;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.modal-grid fieldset legend {
    display: none;
}

.section-header {
    background-color: #6c757d;
    color: white;
    padding: 8px 15px;
    margin: 10px -20px; /* Extend to the edges of the modal-body padding */
}

.section-header h3 {
    margin: 0;
    font-size: 1em;
    background-color: transparent; /* Remove the double background */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.section-toggle-arrow {
    font-size: 0.8em;
    transition: transform 0.3s ease;
    user-select: none;
}

.section-toggle-arrow.expanded {
    transform: rotate(180deg);
}

.section-content {
    display: none;
    transition: all 0.3s ease;
}

.section-content.expanded {
    display: block;
}

.modal-grid label {
    font-weight: bold;
}

.clickable-label {
    cursor: pointer;
    color: #007bff;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.clickable-label:hover {
    color: #0056b3;
}

.display-only {
    display: none; /* Hidden by default */
    padding-top: 8px; /* Align with form inputs */
    word-wrap: break-word;
}

.input-with-button {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
}

.input-with-button div {
    display: flex;
    gap: 5px;
}

.input-with-button input[type="date"],
.input-with-button input[type="time"] {
    flex-grow: 1;
    width: 100%;
}

.clock-btn {
    padding: 8px 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    margin-top: 5px;
}

.edit-modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    grid-column: 1 / -1; /* Span full width in grid */
}

/* Sticky header for edit shift modal */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1002;
    background-color: #f7f7f7;
    border-bottom: 1px solid #ddd;
}

.modal-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.modal-header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: normal;
    min-width: 60px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn.button-primary {
    background-color: #007bff;
    color: white;
}

.header-btn.button-secondary {
    background-color: #6c757d;
    color: white;
}

.header-btn.button-warning {
    background-color: #f0ad4e;
    color: white;
}

.header-btn.button-danger {
    background-color: #d9534f;
    color: white;
}

.header-btn.button-success {
    background-color: #28a745;
    color: white;
}

.header-btn:hover {
    opacity: 0.9;
}

/* Hours display styling */
.hours-display {
    font-weight: bold;
    color: #333;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    display: inline-block;
    min-width: 60px;
    text-align: left;
}

.button-warning {
    background-color: #f0ad4e;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
}

.button-danger {
    background-color: #d9534f;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
}

.button-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
}

.button-success {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
}

.history-list {
    list-style-type: none;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.history-list li {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}

.history-list li:last-child {
    border-bottom: none;
}

.history-list li:nth-child(odd) {
    background-color: #f9f9f9;
}

.expense-entry {
    display: grid;
    grid-template-columns: 100px 1fr auto; /* Amount, Description, Actions */
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.expense-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.expense-actions .remove-expense-btn {
    padding: 5px 10px; /* Smaller padding */
    line-height: 1; /* Adjust line height for just the 'x' */
}

#add-expense-btn {
    justify-self: start;
}

.confirm-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}
.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Override close styling for buttons that also have button classes */
button.close.button-primary {
    color: white !important;
    font-size: 14px !important;
    font-weight: normal !important;
    float: none !important;
    background-color: #007bff !important;
    border: none !important;
    padding: 10px 15px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
}

button.close.button-primary:hover {
    background-color: #0056b3 !important;
    color: white !important;
}
/* end for schedule.php */

.sidebar {
    width: 113px; /* Set to 113px */
    background-color: #6c6c6c;
    padding: 20px;
    min-height: 100vh; /* Changed from height to min-height to extend with content */
    flex-shrink: 0; /* Prevent the sidebar from shrinking */
    transition: left 0.3s ease;
    z-index: 1000;
    text-align: center; /* Center logo and text */
    position: fixed;
    top: 0;
    left: 0;
}

.sidebar a {
    display: block;
    margin-bottom: 10px;
    text-decoration: none;
    color: #ffffff;
}

.sidebar hr {
    border: 0;
    border-top: 1px solid #1d3a5a;
    margin: 10px 0;
}

.sidebar h4 {
    color: #ffffff;
}

.sidebar a:hover {
    color: #1d3a5a;
}

.content {
    flex-grow: 1;
    padding: 0; /* Remove padding to make header flush */
    overflow-x: auto; /* Allow content to scroll horizontally if needed */
    min-width: 0; /* Flexbox fix for overflow */
    margin-left: 153px; /* Account for fixed sidebar width (113px + 40px padding) */
}

.header {
    background-color: #1d3a5a;
    color: white;
    padding: 10px 20px;
    margin-bottom: 0; /* Remove margin between header and toolbar */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    height: 40px;
    width: auto;
}

.schedule-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    background-color: #e8e8e8; /* Darker than the date headers (#f0f0f0) */
    padding: 10px;
    margin-top: 0; /* Ensure no gap on desktop */
    flex-wrap: nowrap; /* Prevent wrapping */
    overflow-x: auto; /* Allow horizontal scroll if needed */
    overflow-y: hidden; /* Hide vertical scrollbars */
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 40px; /* Set explicit height */
    box-sizing: border-box; /* Include padding in height calculation */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.schedule-controls::-webkit-scrollbar {
    display: none; /* WebKit browsers (Chrome, Safari, Edge) */
}

.schedule-scroll-container {
    overflow-x: auto;
    width: 100%;
    margin-top: 0;
    position: relative;
    height: calc(100vh - 160px); /* Set a fixed height to enable sticky within scrollable container */
    overflow-y: auto; /* Allow vertical scrolling */
}

.schedule-controls-inner {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: nowrap;
    min-width: max-content;
}

.schedule-controls button, .schedule-controls select {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background-color: white;
    color: #333; /* Dark color for desktop */
    cursor: pointer;
    border-radius: 4px;
}

.multi-select-container {
    position: relative;
    display: inline-block;
}

.multi-select-button {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
    width: 150px; /* Give it a fixed width */
    text-align: left;
}

.multi-select-dropdown {
    display: none;
    position: fixed;
    background-color: #f9f9f9;
    min-width: 150px;
    box-shadow: 0px 8px 32px 0px rgba(0,0,0,0.3);
    z-index: 1001;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.multi-select-dropdown label {
    color: black;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    white-space: nowrap;
}

.multi-select-dropdown label:hover {
    background-color: #f1f1f1;
}

.multi-select-dropdown .apply-filters-btn {
    width: 100%;
    padding: 8px;
    background-color: #1d3a5a;
    color: white;
    border: none;
    cursor: pointer;
}

.multi-select-dropdown .apply-filters-btn:hover {
    background-color: #3d5a7a; /* Lighter shade for hover */
}

.multi-select-actions {
    display: flex;
    justify-content: space-around;
    padding: 5px;
    border-bottom: 1px solid #ddd;
}

.multi-select-actions button {
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    padding: 3px 8px;
    cursor: pointer;
    border-radius: 4px;
}

.view-toggle-buttons {
    display: flex;
    gap: 5px;
}

.view-btn {
    padding: 5px 10px;
    border: 2px solid #ccc;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.view-btn.active {
    border-color: #ffd700;
    background-color: #fffacd;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.view-btn:hover {
    background-color: #f5f5f5;
}

.view-btn.active:hover {
    background-color: #fffacd;
}

.view-toggle-buttons {
    display: flex;
    gap: 5px;
}

.view-btn {
    padding: 5px 10px;
    border: 2px solid #ccc;
    background-color: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.view-btn.active {
    border-color: #ffd700;
    background-color: #fffacd;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.view-btn:hover {
    background-color: #f5f5f5;
}

.view-btn.active:hover {
    background-color: #fffacd;
}

.sort-options {
    font-size: 0.8em;
    font-weight: normal;
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 2px;
}

.sort-option {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    transition: background-color 0.2s ease;
}

.sort-option:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.sort-arrow {
    margin-left: 2px;
    font-size: 0.9em;
}

#schedule-list-view .styled-table th {
    color: black;
    cursor: pointer;
    position: relative;
}

#schedule-list-view .styled-table th .sort-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    text-align: center;
}

#schedule-list-view {
    margin-top: 20px;
}

#schedule-list-view table {
    width: 100%;
    border-collapse: collapse;
}

#schedule-list-view th, #schedule-list-view td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

#schedule-list-view th {
    background-color: #f2f2f2;
}

#schedule-list-view tbody tr:hover {
    background-color: #f5f5f5;
    cursor: pointer;
}

#schedule-list-view tr.status-cancelled td {
    text-decoration: line-through;
    color: #888;
}

.schedule-controls button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.view-toggle label {
    margin: 0 5px;
}

.form-container {
    margin-top: 20px;
}

/* Default form styling */
.form-container form:not(.form-grid) {
    display: flex;
    flex-direction: column;
}

.form-container input, .form-container textarea {
    margin-bottom: 10px;
    padding: 8px;
}

.form-container button {
    padding: 10px;
    background-color: #1d3a5a;
    color: white;
    border: none;
    cursor: pointer;
}

.form-container button:hover {
    background-color: #1d3a5a;
}

/* Two-column form layout */
.form-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 0px 10px; /* row-gap column-gap - reduced for more compact layout */
    align-items: center;
}

.form-grid label {
    justify-self: right; /* Align label to the right within its grid cell */
    font-weight: bold;
    padding-right: 10px;
}

.form-grid input[type="text"],
.form-grid input[type="email"],
.form-grid input[type="password"],
.form-grid textarea,
.form-grid select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Important for padding and width */
    font-family: Arial, sans-serif; /* Ensure consistent font */
}

.form-grid .form-submit-row {
    grid-column: 2 / 3; /* Span the second column */
    text-align: left;
}

/* Emergency Contact Section Styling */
.emergency-contact-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.emergency-contact-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #1d3a5a;
    font-size: 1.1em;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}

.emergency-contact-section .form-grid {
    grid-template-columns: 150px 1fr; /* Keep the two-column layout for fields within this section */
    gap: 10px;
}

/* Manager Assignments Section Styling */
.assignment-container {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Responsive Styles */
.modal-grid .form-field-group,
.modal-grid .form-field-group.full-width {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-grid .form-field-group label {
    flex-basis: 100px;
    flex-shrink: 0;
}

.modal-grid .form-field-value {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-field-group-horizontal {
    display: flex;
    gap: 20px;
    align-items: center;
}

.form-field-group-horizontal .form-field-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0; /* Remove default margin if any */
}

.modal-grid .form-field-group textarea,
.modal-grid .expense-group {
    flex-direction: column;
    align-items: flex-start;
}

.modal-grid .expense-group .form-field-value {
    width: 100%;
}

.modal-grid .input-with-button {
    flex-direction: row;
    align-items: center;
}

.modal-grid .input-with-button input {
    flex-grow: 1;
}

.modal-grid .input-with-button .clock-btn {
    flex-shrink: 0;
    width: auto;
    margin-top: 0;
}

@media (max-width: 768px) {
    body {
        display: block; /* Change flex to block */
    }

    .sidebar {
        position: fixed;
        left: -270px; /* (width + padding*2) */
        top: 0;
        height: 100%;
        width: 150px; /* Keep original width for mobile */
    }

    .sidebar.open {
        left: 0;
    }

    .content {
        width: 100%;
        box-sizing: border-box;
        padding: 0; /* Remove padding on mobile to allow grid to extend to edges */
        margin-left: 0; /* Reset margin for mobile */
    }

    .header {
        display: none; /* Hide the desktop header on mobile */
    }

    .schedule-controls {
        position: sticky;
        top: 0; /* Stick to top of content area, not offset */
        z-index: 899; /* Below the main mobile header but above content */
        justify-content: space-between;
        background-color: #e8e8e8; /* Match desktop - darker than date headers */
        margin-top: 0; /* No gap */
        overflow-x: auto; /* Allow horizontal scrolling */
        white-space: nowrap; /* Prevent wrapping */
    }

    .schedule-grid {
        margin-top: 0; /* Remove gap - controls are sticky so no need for margin */
        overflow-x: auto; /* Allow horizontal scrolling */
        display: grid; /* Ensure it's a grid */
        grid-template-columns: 100px repeat(14, 80px); /* Fixed width columns for mobile */
        min-width: max-content; /* Ensure grid doesn't shrink */
        min-height: 200px; /* Prevent layout shift during grid population */
    }

    /* Create a scroll container to sync both elements */
.schedule-scroll-container {
        overflow-x: auto;
        width: 100%;
        margin-top: 0; /* Ensure no gap */
        position: relative; /* Establish positioning context */
        height: calc(100vh - 60px); /* Adjust height to account for mobile header */
        overflow-y: auto; /* Allow vertical scrolling */
    }

    .schedule-controls-inner {
        display: flex;
        gap: 15px;
        align-items: center;
        min-width: max-content;
        padding: 10px;
    }

    .schedule-grid > div {
        min-width: 80px; /* Set minimum width for readability */
        box-sizing: border-box;
        padding: 4px;
        font-size: 0.8em;
    }

    .schedule-grid .header {
        font-size: 0.75em;
        padding: 4px;
        line-height: 1.2;
        min-width: 80px; /* Ensure headers are visible */
        background-color: #f0f0f0 !important; /* Force background color */
        font-weight: bold !important; /* Force bold text */
        color: black !important; /* Force text color */
        display: flex !important; /* Force display */
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        border-bottom: 1px solid #ddd !important;
        position: sticky !important;
        top: 0px !important; /* Stick to top of scroll container */
        z-index: 898 !important; /* Below schedule controls but above content */
    }

    .schedule-grid .caregiver {
        min-width: 100px; /* Slightly wider for caregiver names */
    }

    .shift-entry {
        cursor: pointer;
    }

.schedule-controls button, .schedule-controls label, .schedule-controls select {
    color: #1d3a5a; /* Make text visible on white background */
}

.schedule-controls button, .schedule-controls select {
    border-color: #1d3a5a;
    padding: 5px;
    border-radius: 4px;
    background-color: white;
}

    .mobile-header {
        display: flex;
        align-items: center;
        background-color: #1d3a5a;
        color: white;
        padding: 10px;
        position: sticky;
        top: 0;
        z-index: 900;
    }

    #menu-toggle {
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        cursor: pointer;
        margin-right: 15px;
    }

    #page-title {
        font-size: 1.2em;
        font-weight: bold;
        margin-right: auto; /* Pushes logo to the right */
    }

    .mobile-logo {
        height: 30px; /* Control logo size in header */
        width: auto;
    }

    .form-grid {
        grid-template-columns: 1fr; /* Stack to a single column */
    }

    .form-grid label {
        justify-self: left; /* Align labels to the left */
        text-align: left;
        padding-right: 0;
    }

    .form-grid .form-submit-row {
        grid-column: 1 / 2; /* Reset column span */
    }

    /* Keep timesheet table as desktop-style table on mobile */
    #schedule-list-view .styled-table {
        display: table;
        width: 100%;
        overflow-x: auto;
        min-width: 800px; /* Ensure minimum width for horizontal scrolling */
    }

    #schedule-list-view .styled-table thead {
        display: table-header-group;
    }

    #schedule-list-view .styled-table tbody {
        display: table-row-group;
    }

    #schedule-list-view .styled-table tr {
        display: table-row;
        margin-bottom: 0;
        border: none;
    }

    #schedule-list-view .styled-table td,
    .styled-table th {
        display: table-cell;
        padding: 8px;
        border-bottom: 1px solid #ddd;
        white-space: nowrap; /* Prevent text wrapping */
        font-size: 0.9em; /* Slightly smaller font for mobile */
    }

    #schedule-list-view .styled-table th {
        background-color: #f2f2f2;
        font-weight: bold;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    /* Add horizontal scroll container for timesheet */
    #schedule-list-view {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    /* Make approve icon green on mobile timesheet */
    #schedule-list-view .approve-icon {
        color: green !important;
    }

    /* For other tables (not timesheet), keep the card layout */
    .styled-table:not(#schedule-list-view .styled-table) thead {
        display: none; /* Hide table headers */
    }

    .styled-table:not(#schedule-list-view .styled-table), 
    .styled-table:not(#schedule-list-view .styled-table) tbody, 
    .styled-table:not(#schedule-list-view .styled-table) tr, 
    .styled-table:not(#schedule-list-view .styled-table) td {
        display: block;
        width: 100%;
    }

    .styled-table:not(#schedule-list-view .styled-table) tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
    }

    .styled-table:not(#schedule-list-view .styled-table) td {
        text-align: left;
        padding-left: 10px;
        position: relative;
        border-bottom: 1px solid #eee;
    }

    /* Remove the general label */
    .styled-table:not(#schedule-list-view .styled-table) td::before {
        content: "";
        display: none;
    }

    /* Add a specific label ONLY for the notes field */
    .styled-table:not(#schedule-list-view .styled-table) td[data-label="Notes"]::before {
        content: "Notes:";
        display: block;
        font-weight: bold;
        margin-bottom: 5px;
    }

    .styled-table:not(#schedule-list-view .styled-table) .table-cell-name {
        font-weight: bold;
        font-size: 1.1em;
    }

    .styled-table:not(#schedule-list-view .styled-table) .table-cell-contact,
    .styled-table:not(#schedule-list-view .styled-table) .table-cell-address {
        color: #555;
        font-size: 0.9em;
    }

    .styled-table:not(#schedule-list-view .styled-table) .table-cell-actions a {
        display: inline-block;
        padding: 5px 10px;
        background-color: #1d3a5a;
        color: white;
        text-decoration: none;
        border-radius: 4px;
        margin-right: 5px;
    }

    .modal-content {
        width: 90%;
        margin: 10% auto;
    }

    .modal-grid label, .modal-grid input, .modal-grid select, .modal-grid textarea, .modal-grid legend, .modal-grid button {
        font-size: 16px; /* Increase font size for better readability on mobile */
        box-sizing: border-box;
    }

    .modal-body {
        padding: 10px;
    }

    .modal-grid {
        grid-template-columns: 1fr; /* Stack everything in a single column */
        gap: 10px;
    }
    
    .modal-grid fieldset {
        grid-template-columns: 1fr;
        gap: 15px;
    }


    .modal-grid .form-field-group,
    .modal-grid .form-field-group.full-width {
        display: flex;
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
    }

    .modal-grid .input-with-button {
        flex-direction: row;
        align-items: center;
        width: 100%;
    }

    .edit-modal-actions button[type="submit"] {
        font-size: 16px;
    }

    .caregiver-view .display-only {
        display: block;
    }

    .caregiver-view .form-control,
    .caregiver-view #editDate,
    .caregiver-view #editStartTime,
    .caregiver-view #editEndDate,
    .caregiver-view #editEndTime,
    .caregiver-view #editShiftForm textarea {
        display: none;
    }

    .add-message-form textarea {
        display: block !important;
    }

    .expense-entry .form-control {
        display: block !important;
    }

    .expense-entry {
        grid-template-columns: 1fr; /* Stack everything */
        gap: 5px;
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
        margin-bottom: 15px;
    }

.expense-entry .expense-actions {
    flex-direction: row; /* Override the column direction for actions on mobile */
}

.expense-entry div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
    .expense-entry .remove-expense-btn {
        width: auto;
    }

    .expense-entry a {
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .modal-grid .input-with-button {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-grid .input-with-button .clock-btn {
        width: 100%;
        margin-top: 5px;
    }

    .modal-header-content {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .modal-header-buttons {
        justify-content: space-between;
        width: 100%;
    }

    .header-btn {
        flex: 1;
        padding: 8px 4px;
        font-size: 0.8em;
    }
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 14px; /* Made font size smaller */
    text-align: left;
}

.styled-table th,
.styled-table td {
    padding: 12px 15px;
}

.styled-table thead tr {
    background-color: #1d3a5a; /* Changed header to blue */
    color: white;
    text-align: left;
}

.styled-table th,
.styled-table td {
    border-bottom: 1px solid #dddddd;
}

.styled-table tbody tr:nth-of-type(even) {
    background-color: #f3f3f3;
}

.styled-table tbody tr:last-of-type {
    border-bottom: 2px solid #009879;
}

.styled-table tbody tr.active-row {
    font-weight: bold;
    color: #009879;
}

/* Caregiver List View Styles */
#list-view-container {
    padding: 10px;
}

.list-view-controls {
    padding: 10px;
    text-align: center;
}

#toggle-older-shifts-btn {
    padding: 10px 20px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    cursor: pointer;
    border-radius: 4px;
}

.list-view-day-header {
    font-size: 1.2em;
    color: #333;
    border-bottom: 2px solid #1d3a5a;
    padding-bottom: 5px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.list-view-day-header.today-header {
    background-color: lightyellow;
    padding-left: 10px;
    padding-right: 10px;
}

.shift-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-left: 5px solid #1d3a5a;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    cursor: pointer;
    transition: box-shadow 0.2s ease-in-out;
}

.shift-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.shift-card.today-shift {
    background-color: lightyellow;
}

.shift-card.no-shifts-today {
    background-color: lightyellow;
    text-align: center;
    font-style: italic;
    cursor: default;
}

.shift-card.status-cancelled {
    background-color: #f5f5f5; /* Light grey background */
    border-left-color: #ccc; /* Muted border color */
}

.shift-card.status-cancelled .shift-card-info,
.shift-card.status-cancelled .shift-card-time,
.shift-card.status-cancelled .shift-card-location {
    text-decoration: line-through;
    color: #888;
}

.shift-card-time {
    flex-basis: 150px; /* Increased from 120px to accommodate longer time strings */
    font-weight: bold;
    font-size: 1.1em;
    color: #1d3a5a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.shift-card-info {
    flex-grow: 1;
    display: flex; /* Make it a flex container */
    flex-direction: row; /* Arrange children horizontally */
    align-items: center; /* Align items vertically in the middle */
    flex-wrap: wrap; /* Allow content to wrap if needed */
    gap: 5px; /* Small gap between elements */
}

.shift-card-info > div:first-child {
    margin-right: 10px; /* Add space to the right of the text content */
}

.shift-card-info p {
    margin: 0; /* Remove default paragraph margin */
    line-height: 1.2; /* Adjust line height for better spacing */
}

.shift-card-info p:first-of-type {
    margin-bottom: 0; /* Remove margin below the first paragraph */
}

.shift-card-info .new-grid-indicator {
    margin-left: 0; /* Remove auto margin */
    align-self: center; /* Center vertically within the flex container */
}

.shift-card-location {
    flex-basis: 150px;
    text-align: right;
}

.shift-card-location p {
    margin: 5px 0 0 0;
    font-size: 0.9em;
    color: #555;
}

.map-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-image: url('https://maps.google.com/mapfiles/ms/icons/red-dot.png'); /* Simple map icon */
    background-size: contain;
    background-repeat: no-repeat;
}

/* Client Schedule View Toggle */
.view-toggle {
    margin-bottom: 20px;
}

.view-toggle button {
    padding: 10px 15px;
    border: 1px solid #1d3a5a;
    background-color: #f0f0f0;
    cursor: pointer;
    border-radius: 4px;
}

.view-toggle button:hover {
    background-color: #e0e0e0;
}

/* View toggle buttons styling */
.view-toggle-buttons {
    display: flex;
    gap: 5px;
}

.view-btn {
    padding: 8px 15px;
    border: 2px solid #1d3a5a;
    background-color: #f0f0f0;
    color: #1d3a5a;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background-color: #e0e0e0;
}

.view-btn.active {
    background-color: #1d3a5a;
    color: white;
    border-color: #ffd700;
    box-shadow: 0 0 0 2px #ffd700;
}

/* Caregiver sorting styles */
.caregiver-sort-header {
    font-size: 0.8em;
    line-height: 1.2;
}

.sort-options {
    display: block;
    margin-top: 5px;
}

.sort-option {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    transition: background-color 0.2s;
}

.sort-option:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.sort-arrow {
    font-size: 0.8em;
    margin-left: 2px;
}

#calendar-view {
    margin-top: 20px;
}

.print-header {
    display: none;
}

@media print {
    body {
        display: block; /* Override flex display for printing */
    }
    .sidebar, .header, .view-toggle, .mobile-header, .overlay, #list-view-container, .modal {
        display: none !important;
    }
    .print-header {
        display: block;
        text-align: right;
        padding: 10px;
    }
    .print-header img {
        max-height: 50px;
    }
    .content {
        padding: 0;
        margin: 0;
    }
    #calendar-view {
        display: block !important; /* Ensure calendar is visible for printing */
        margin-top: 0;
    }
    .fc-toolbar .fc-right, .fc-toolbar .fc-left {
        display: none; /* Hide calendar navigation buttons */
    }
    .fc-toolbar .fc-center {
        text-align: center;
        width: 100%;
    }
    .fc-day-grid-event, .fc-event {
        font-size: 8px !important; /* Even smaller font for events */
        padding: 0 !important;
        margin: 1px 2px !important;
        line-height: 1.2;
    }
    .fc-day-top {
        padding: 1px !important; /* Reduce padding for the day number */
        font-size: 9px;
    }
    .fc-row {
        min-height: 1em !important; /* Remove minimum height */
        height: 12vh !important; /* Force row height to a fraction of viewport height */
    }
    .fc-content-skeleton {
        padding-bottom: 0 !important;
    }
}

.approvals-cell {
    text-align: center;
}

.approve-icon, .unapprove-icon {
    cursor: pointer;
    font-size: 1.2em;
    margin: 0 5px;
}

.approve-icon {
    color: green;
}

.unapprove-icon {
    color: #f0ad4e;
}

@media (max-width: 480px) {
    #toggle-older-shifts-btn {
        font-size: 16px; /* Larger text for mobile */
    }
}

/* Family Members Section Styles */
.family-members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1d3a5a;
}

/* Left justify checkboxes in the main client edit form */
.form-container .form-grid input[type="checkbox"] {
    justify-self: start;
}

.family-members-header h2 {
    margin: 0;
    color: #1d3a5a;
}

.btn-primary {
    background-color: #1d3a5a;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    background-color: #2c4a6b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    color: #dc3545;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: #f8f9fa;
    color: #c82333;
}

.family-member-form {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.family-member-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1d3a5a;
    font-size: 1.1em;
}

.family-member-card {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.family-member-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.family-member-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

.family-member-avatar {
    width: 40px;
    height: 40px;
    background-color: #e9ecef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    flex-shrink: 0;
}

.family-member-details h4 {
    margin: 0 0 4px 0;
    color: #1d3a5a;
    font-size: 1.1em;
    font-weight: 600;
}

.family-member-email {
    margin: 0 0 2px 0;
    color: #495057;
    font-size: 0.9em;
}

.family-member-phone {
    margin: 0;
    color: #6c757d;
    font-size: 0.85em;
}

.family-member-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.no-family-members {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    margin: 20px 0;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background-color: #28a745;
}

.notification-error {
    background-color: #dc3545;
}

.notification-warning {
    background-color: #ffc107;
    color: #212529;
}

.notification-info {
    background-color: #17a2b8;
}

/* Mobile responsiveness for family members */
@media (max-width: 768px) {
    .family-members-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .family-member-card {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .family-member-info {
        justify-content: flex-start;
    }
    
    .family-member-actions {
        justify-content: center;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}
