/* Reset Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* General Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 10px;
    background-color: #f4f4f9;
    color: #333;
    line-height: 1.6;
}

img { max-width: 100%; height: auto; }


h1 {
    color: #333;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2rem;
}
p {
    color: #333;
    text-align: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

p.tight {
    color: #333;
    text-align: left;    
    font-size: 0.9rem;    
    margin-top: 3px;
    margin-bottom: 3px;
    line-height: 1.2;
}

a {
    all: unset; /* Resets most styles */
    color: #333; /* Set text color */
    font-size: 0.9rem; /* Set font size */
    text-decoration: none; /* Removes the underline */
    -webkit-tap-highlight-color: transparent; /* Removes tap highlight on mobile */
    cursor: pointer; /* Ensures it behaves like a clickable link */
}

a:hover {
    color: #555; /* Change color on hover */
}

a:active {
    color: #111; /* Darken the color when the link is clicked */
}

ul {
    padding: 0;
    margin: 20px auto;
    max-width: 600px;
    display: flex;
    justify-content: space-around;
}

ul li {
    list-style: none;
}

ul li a {
    text-decoration: none;
    font-size: 1rem;
    color: #007bff;
}

ul li a:hover {
    text-decoration: underline;
}

/* Center Content Layout */
.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    gap: 20px; 
}
/* Left Content Layout */
.left-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 100vh;
  width: 100%;
  max-width: 680px;  
  gap: 20px;
  padding: 10px;
}

.left-content ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
    }

/* Form Styling for Consistent Size */
form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    text-align: left;
}

form input {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

form input::placeholder {
    color: #aaa;
    font-style: italic;
}
form button {
    background: #007bff;
    color: #fff;
    border: none;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 1rem;
    text-align: center;
    transition: background-color 0.3s ease;
}

form button:hover {
    background: #0056b3;
}
form button:active {
    background: #004080;
    transform: scale(0.98);
}
/* Common Form (payment confirmation, shift form, etc */
.common-form {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: left; /* Default alignment for the entire form */
    box-sizing: border-box;
    font-family: Arial, sans-serif; /* Web-safe font for consistency */
    font-size: 16px; /* Comfortable font size */
    color: #333; /* High-contrast text color */
}

/* Labels */
.common-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 14px;
    text-align: left; /* Ensure labels are aligned left */
}

/* Paragraphs */
.common-form p {
    margin-bottom: 10px;
    line-height: 1.5;
    text-align: left; /* Explicitly align all paragraphs to the left */
}

/* Headings */
.common-form h1,
.common-form h2,
.common-form h3 {
    margin-bottom: 15px;
    font-weight: bold;
    text-align: left; /* Ensure all headings are aligned left */
}

/* Inputs and Textareas */
.common-form input, 
.common-form textarea {
    display: block;
    width: 100%; /* Full width within the form */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    text-align: left; /* Text inside inputs is aligned left */
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #f9f9f9;
}

.common-form input:focus, 
.common-form textarea:focus {
    border-color: #007BFF;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
    outline: none;
    background-color: #fff;
}

/* Buttons */
.common-form button {
    display: inline-block;
    padding: 10px 15px;
    font-size: 1rem;
    color: #fff;
    background-color: #007BFF;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center; /* Buttons are typically center-aligned */
}

.common-form button:hover {
    background-color: #0056b3;
}

.common-form button:active {
    transform: scale(0.98);
}

.common-form button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Signature Pad */
.common-form canvas {
    display: block;
    width: 100%;
    max-width: 400px;
    height: 200px;
    border: 1px solid #ccc;
    margin-bottom: 15px;
    border-radius: 5px;
    box-sizing: border-box;
}

/* Accessibility and Focus */
.common-form input:focus-visible,
.common-form textarea:focus-visible,
.common-form button:focus-visible {
    outline: 2px solid rgba(0, 123, 255, 0.5);
    outline-offset: 2px;
}

/* Buttons */
.action-button {
    display: inline-block;
    padding: 8px 12px;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    margin: 5px 5px;
    text-align: center;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.action-button:hover {
    background: #0056b3;
}

.action-button:active {
    background: #004080;
    transform: scale(0.98);
}

.action-button.disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    pointer-events: none; /* Prevent click events */
}

.button {
    display: inline-block;
    padding: 8px 12px;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    margin: 5px 5px;
    text-align: center;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.button:hover {
    background: #0056b3;
}

.button:active {
    background: #004080;
    transform: scale(0.98);
}

.button.disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    pointer-events: none; /* Prevent click events */
}

.dashboard-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.dashboard-buttons .action-button {
    width: calc(33.33% - 10px); /* Adjust width for a neat layout */
    text-align: center;
}

a.button {
    display: inline-block;
    padding: 10px 20px;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    margin: 10px 5px;
    text-align: center;
    transition: background-color 0.3s ease;
}

a.button:hover {
    background: #0056b3;
}

a.button:active {
    background: #004080;
    transform: scale(0.98);
}
.sos-button-ok,
.sos-button-alarm {
    width: 300px;
    height: 50px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    border-radius: 5px; /* Matches button corner radius */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2); /* Softer shadow */
    transition: transform 0.2s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

/* manage_sites collapsible */

.collapsible {
    display: inline-block;
    padding: 8px 12px;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    margin: 5px 5px;
    text-align: center;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.collapsible:hover {
    background: #0056b3;
}

.collapsible:active {
    background: #004080;
    transform: scale(0.98);
}

.collapsible .arrow {
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.3s ease;
}

/* Rotated state */
.collapsible .arrow.rotated {
    transform: rotate(90deg);
}


.site-content {
    padding: 10px 0;
}

/* Terror State */
.threat-container {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    width: 100%;
    max-width: 600px;
    margin: 10px auto;
    box-sizing: border-box;
}

@media (max-width: 400px) {
    .threat-container {
        max-width: 100%; /* Adjust for very small screens */
        padding: 5px; /* Reduce padding for tighter spaces */
    }
}

.threat-title {
    font-size: 1.8em;
    color: #333;
}

.threat-level {
    font-size: 1.8em;
    font-weight: bold;
    margin: 10px 0;
    color: #dc3545; /* A red shade to signify urgency */
}

.threat-description {
    font-size: 0.9em;
    color: #333;
}

.threat-image {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 10px;
}

.threat-link {
    text-decoration: none; /* Remove underline from link */
    color: inherit; /* Inherit text color to keep the design consistent */
    display: block; /* Ensure the link wraps the entire div */
}

.threat-link:hover .threat-container {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); /* Add a hover effect for interactivity */
    transform: translateY(-2px); /* Slight lift effect */
    transition: box-shadow 0.3s, transform 0.3s; /* Smooth transition */
}

/* SOS Button - OK State */
.sos-button-ok {
    background-color: #28a745; /* Light green for OK state */
    border: 2px solid #4caf50; /* Subtle border for depth */
}

.sos-button-ok:hover {
    transform: scale(1.1);
    background-color: #4caf50;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3); /* Larger shadow on hover */
}

/* SOS Button - Alarm State */
.sos-button-alarm {
    background-color: #E60000; /* Bright red for Alarm state */
    border: 2px solid #CC0000; /* Slightly darker border for contrast */
}

.sos-button-alarm:hover {
    transform: scale(1.1);
    background-color: #CC0000;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3); /* Larger shadow on hover */
}
.sos-button-ok:active,
.sos-button-alarm:active {
    transform: scale(0.95); /* Slight compression on click */
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
}
/* Fall Detection */
:root {
    --active-color-light: #28a745; /* Green */
    --inactive-color-light: #dc3545; /* Red */
    --error-color-light: #ffc107; /* Yellow */
    --text-color-light: #fff;

    --active-color-dark: #4caf50; /* Dark green */
    --inactive-color-dark: #e53935; /* Dark red */
    --error-color-dark: #ffca28; /* Lighter yellow */
    --text-color-dark: #ffffff;
}

body {
    --active-color: var(--active-color-light);
    --inactive-color: var(--inactive-color-light);
    --error-color: var(--error-color-light);
    --text-color: var(--text-color-light);
}

body.dark-mode {
    --active-color: var(--active-color-dark);
    --inactive-color: var(--inactive-color-dark);
    --error-color: var(--error-color-dark);
    --text-color: var(--text-color-dark);
}

/* Status Box Styling */
.status-box {
    display: inline-block;
    padding: 10px 15px; /* Matches button padding */
    font-size: 0.9rem;
    text-align: center;
    border-radius: 5px; /* Matches button corner radius */
    color: var(--text-color);
    font-weight: bold;
    margin: 5px 0; /* Add spacing similar to buttons */
    transition: background-color 0.3s ease, color 0.3s ease;
}

.status-active {
    background-color: var(--active-color);
}

.status-inactive {
    background-color: var(--inactive-color);
}

.status-error {
    background-color: var(--error-color);
    color: #212529; /* Override for better readability if needed */
}

.align-logoutandmandown {
    display: flex;
    align-items: center; /* Vertically align items */
    gap: 10px; /* Space between the elements */
}

/* Profile Page Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc; /* Default background for slider */
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #007bff; /* Active state background */
}

input:checked + .slider:before {
    transform: translateX(26px);
}
/* Headings Inside Forms */
form h2 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    color: #333;
    text-align: center;
}

/* Spacing for Success/Error Messages in Forms */
form p {
    text-align: center;
    margin-top: 10px;
    font-size: 0.9rem;
}

/* Feedback Messages */
.success-message {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    padding: 10px;
    text-align: center;
    font-size: 1rem;
    margin-bottom: 10px;
}

.error-message {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    padding: 10px;
    text-align: center;
    font-size: 1rem;
    margin-bottom: 10px;
}

.password-hint {
    color: red;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

/*Message badge*/
.badge {
    background-color: red;
    color: white;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 12px;
    position: relative;
    top: -10px;
    left: 10px;
}

/* Spinner */
#loadingSpinner {
    display: none;
    text-align: center;
    margin-bottom: 20px;
}

#loadingSpinner img {
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 20px;
}

#progressBar {
    width: 100%;
    background-color: #f3f3f3;
    border-radius: 5px;
    overflow: hidden;
}

#progress {
    height: 20px;
    background-color: #4caf50;
    width: 0%;
}

/* Scanner Area */
#scannerArea {
    margin: 20px auto;
    padding: 20px;
    background: #e9ecef;
    border: 1px solid #ccc;
    border-radius: 8px;
    text-align: center;
    max-width: 350px; /* Matches scanner window width */
}

#scannerArea #reader {
    width: 300px;
    height: 300px;
    margin: 20px auto;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Modal */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 400px;
}

.modal-content h2 {
    margin: 0 0 10px;
    font-size: 1.5em;
}
.modal-content p {
    margin: 0 0 20px;
    font-size: 1em;
}
.modal-content label {
    display: block;
    margin-bottom: 10px;
    font-size: 1rem;
    color: #555;
    text-align: left;
}

.modal-content textarea {
    width: 100%;
    height: 150px; /* Adjust the height as needed */
    font-size: 1rem;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 20px;
    box-sizing: border-box;
    resize: vertical; /* Allows resizing vertically only */
}
.close-modal {
    background: #007BFF;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
}
.close-modal:hover {
    background: #0056b3;
}
.primary-button {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.primary-button:hover {
    background-color: #0056b3;
}

.secondary-button {
    background-color: #f4f4f4;
    color: #333;
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.secondary-button:hover {
    background-color: #e6e6e6;
}

.close-button {
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 10px;
    color: #333;
}

.close-button:hover {
    color: #007bff;
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
}

/* Separator Line */
hr {
    border: 1px solid #333;
    margin: 20px 0;
}

/*message area and recipient in messages admin*/
.message-textarea {
    width: 100%;
    height: 150px; /* Adjust the height as needed */
    font-size: 1rem;    
    
}
.recipient-dropdown{
    width: 100%;    
    font-size: 1rem;
}

/* Completed, Missed Rows and locked rows */
.completed {
    background-color: #d4edda; /* Light green */
    color: #6c757d; /* Neutral text color */
}

.missed {
    background-color: #f8d7da; /* Light red */
    color: #6c757d; /* Neutral text color */
}

.completed .action-button,
.missed .action-button {
    background: #ccc;
    color: #666;
    pointer-events: none; /* Disable interaction */
    cursor: not-allowed;
}

.locked {
    background-color: #f3f3f3; /* Light grey */
    color: #aaa; /* Greyed-out text */
}

.locked .action-button {
    background: #ddd;
    color: #999;
    pointer-events: none;
    cursor: not-allowed;
}

/* Iframes */
 
  .pdf-container {
    position: relative;
    width: 50%;                /* Set desired width */
    height: 80vh;              /* Set desired height */
    margin: 0 auto;
    overflow: hidden;
    background: #fff;          /* Optional: Add a background to distinguish the PDF container */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Optional: Add shadow for better aesthetics */
  }
  
  .pdf-viewer {
    width: 100%;
    height: 100%;
    border: none;
    background: #f4f4f4;
  }
  
  @media (max-width: 768px) {
    .pdf-container {
      width: 95%;              /* Increase width on smaller screens */
      height: 90vh;            /* Increase height for better fit */
    }
  }
  
/* Table Styles */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border: 1px solid #ddd;
    font-size: 0.9rem;
    word-wrap: break-word;
}

table th {
    background: #007bff;
    color: #fff;
    text-transform: uppercase;
}

table tbody tr:hover {
    background-color: #e9ecef; /* Light gray */
    cursor: pointer;
}

table textarea {
    text-align: left;
}

/* Fix for Date and Time columns ONLY in view_messages */
.view-messages-table {
    table-layout: fixed; /* Prevent columns from shrinking unevenly */
}

.view-messages-table th:nth-child(1),
.view-messages-table td:nth-child(1) {
    width: 90px; /* Fix Date column width */
    white-space: nowrap; /* Prevent wrapping */
}

.view-messages-table th:nth-child(2),
.view-messages-table td:nth-child(2) {
    width: 70px; /* Fix Time column width */
    white-space: nowrap; /* Prevent wrapping */
}

.view-messages-table th:nth-child(3),
.view-messages-table td:nth-child(3) {
    width: auto; 
    max-width: 500px; /* Prevent messages from stretching table too wide */
    word-break: break-word; /* Wrap long words if needed */
}


.current-shift {
    background-color: #dff0d8; /* Highlight current shift with a light green background */
}

/* Offline Message */
.offline-message {
    display: none;
    background-color: #ffcc00;
    color: #000;
    padding: 10px;
    text-align: center;
}

.offline-message.active {
    display: block;
}

/* Pagination Styles */
.pagination {
    text-align: center;
    margin-top: 20px;
}

.pagination a {
    display: inline-block;
    margin: 0 5px;
    padding: 10px 15px;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.pagination a:hover {
    background: #0056b3;
}

.pagination a:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* Spinner Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .button {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    form {
        padding: 10px;
    }

    table th,
    table td {
        font-size: 0.8rem;
    }

    .action-button {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
        font-size: 0.9rem;
        padding-left: min(5vw, 16px);
        padding-right: min(5vw, 16px);
    }

    .left-content {
        padding-left: min(5vw, 16px);
        padding-right: min(5vw, 16px);
    }

    h1 {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }

    h2 {
        font-size: 1.2rem;
    }

    p {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }

    .center-content {
        padding: 10px;
        gap: 15px;
    }

    .dashboard-buttons .action-button {
        width: 100%;
    }

    .align-logoutandmandown {
        width: 100%;
    }

    .align-logoutandmandown .button {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    form {
        padding: 10px;
        box-shadow: none;
    }

    form button {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    ul {
        flex-direction: column;
        align-items: center;
    }

    ul li {
        margin-bottom: 10px;
    }

    table {
        font-size: 0.8rem;
        word-break: break-word;
    }

    table th, table td {
        padding: 10px;
    }

    table th:nth-child(1),
    table td:nth-child(1),
    table th:nth-child(2),
    table td:nth-child(2) {
        white-space: normal; /* Allow wrapping only on very small screens */
    }

    .pagination a {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .modal-content {
        padding: 15px;
        font-size: 0.85rem;
    }

    .close-button {
        font-size: 1rem;
    }

    /* General Styling for Theme Toggle */
    .theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: var(--text-color, #333);
    }

    .theme-toggle select {
    appearance: none;
    background-color: var(--background-color, #f4f4f9);
    color: var(--text-color, #333);
    border: 1px solid var(--border-color, #ccc);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .theme-toggle select:focus,
    .theme-toggle select:hover {
    outline: none;
    border-color: var(--primary-color, #007bff);
    background-color: var(--hover-bg-color, #e9f5ff);
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.4);
    }
    
    .theme-toggle select {
    min-width: 150px;
    text-align: center;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Light Mode */
.light-mode {
    background-color: #f4f4f9;
    color: #333;
}
.light-mode .modal-content {
    border: 1px solid #ddd;
}
.light-mode form {
    background: #fff;
    border-color: #ddd;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}

.light-mode form input, .light-mode form button, .light-mode form textarea {
    background: #fff;
    color: #333;
    border-color: #ccc;
}
.light-mode form input::placeholder {
    color: #aaa; /* Subtle gray for light mode */
}
.light-mode .action-button:active {
    background-color: #004080;
    color: #ffffff;
}
.light-mode .button, .light-mode .action-button, .light-mode .primary-button, .light-mode .secondary-button {
    background: #007bff;
    color: #fff;
}

.light-mode .button.disabled, .light-mode .action-button.disabled {
    background: #e9ecef; /* Light grey background */
    color: #6c757d; /* Muted grey text */
}

.light-mode button:focus,
.light-mode .primary-button:focus,
.light-mode .secondary-button:focus,
.light-mode .action-button:focus,
.light-mode a:focus,
.light-mode input:focus {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}
.light-mode .sos-button-ok {
    background-color: #28a745; /* Bright blue for light mode */
    border: 2px solid #4caf50;
    color: #ffffff;
}

.light-mode .sos-button-ok:hover {
    background-color: #4caf50;
}

.light-mode .sos-button-alarm {
    background-color: #E60000;
    border: 2px solid #CC0000;
    color: #ffffff;
}

.light-mode .sos-button-alarm:hover {
    background-color: #CC0000;
}
/* Profile Page Toggle Switch */
.light-mode .slider {
    background-color: #ddd; /* Slider background for light mode when unchecked */
}

.light-mode input:checked + .slider {
    background-color: #007bff; /* Slider background for light mode when checked */
}
.light-mode .success-message {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.light-mode .error-message {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.light-mode #scannerArea {
    margin: 20px auto;
    padding: 20px;
    background: #e9ecef;
    border: 1px solid #ccc;
    border-radius: 8px;
    text-align: center;
    max-width: 350px; /* Matches scanner window width */
}

.light-mode #scannerArea #reader {
    width: 300px;
    height: 300px;
    margin: 20px auto;
    background: #fff; /* White background for light mode */
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.light-mode #scannerArea {
    color: inherit;
}
.light-mode .pagination a:hover {
    background: #0056b3;
    color: #fff;
}
.light-mode .progress-container {
    margin-bottom: 20px;
}

.light-mode #progressBar {
    width: 100%;
    background-color: #f3f3f3; /* Light gray background */
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #ddd; /* Subtle border for light mode */
}

.light-mode #progress {
    height: 20px;
    background-color: #4caf50; /* Green progress */
    width: 0%; /* Controlled dynamically */
    transition: width 0.3s ease; /* Smooth transition */
}
.light-mode .badge {
    background-color: #ff0000; /* Bright red */
    color: #ffffff; /* White text */
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 12px;
    position: relative;
    top: -10px;
    left: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
}
.light-mode table tbody tr:hover {
    background-color: #f0f0f0;
}
.light-mode input::placeholder {
    color: #888;
}
/* Dark Mode */
.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}
.dark-mode input::placeholder {
    color: #aaa;
}
.dark-mode form {
    background: #1e1e1e;
    border-color: #333;
    box-shadow: none;
}

.dark-mode form input, .dark-mode form button, .dark-mode form textarea {
    background: #2a2a2a;
    color: #ddd;
    border-color: #444;
}

.dark-mode form input:focus,
.dark-mode form textarea:focus {
    border-color: #007bff; /* Blue border on focus */
    background-color: #2a2a2a; /* Darker background */
    color: #e0e0e0; /* Light text color */
    outline: none; /* Remove default outline */
}

.dark-mode form input::placeholder {
    color: #777; /* Slightly lighter placeholder text for contrast */
}

.dark-mode .button,
.dark-mode .action-button,
.dark-mode .primary-button,
.dark-mode .secondary-button {
    background: #3a3a3a;
    color: #fff;
}

.dark-mode .button.disabled, .dark-mode .action-button.disabled {
    background: #555; /* Darker background for disabled buttons */
    color: #777; /* Subtle muted text color */
}

.dark-mode .button:hover,
.dark-mode .action-button:hover,
.dark-mode .primary-button:hover,
.dark-mode .secondary-button:hover {
    background-color: #555; /* A lighter shade for hover in dark mode */
    color: #e0e0e0; /* Adjust text color for contrast */
}

.dark-mode button:focus,
.dark-mode .primary-button:focus,
.dark-mode .secondary-button:focus,
.dark-mode .action-button:focus,
.dark-mode a:focus,
.dark-mode input:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}
.dark-mode .action-button:active {
    background-color: #2a78c7;
    color: #ffffff;
}
.dark-mode .sos-button-ok {
    background-color: #3a3a3a; 
    border: 2px solid #ffffff; 
    color: #ffffff;
}

.dark-mode .sos-button-ok:hover {
    background-color: #555;
    box-shadow: 0px 4px 8px rgba(255, 255, 255, 0.3); /* Subtle light shadow */
}

.dark-mode .sos-button-alarm {
    background-color: #FF5C5C; /* Softer red for dark mode */
    border: 2px solid #CC4C4C; /* Darker red border */
    color: #ffffff;
}

.dark-mode .sos-button-alarm:hover {
    background-color: #CC4C4C;
    box-shadow: 0px 4px 8px rgba(255, 255, 255, 0.3); /* Subtle light shadow */
}
/* Profile Page Toggle Switch */
.dark-mode .slider {
    background-color: #3a3a3a; /* Slider background for dark mode when unchecked */
}

.dark-mode input:checked + .slider {
    background-color: #4a90e2; /* Slider background for dark mode when checked */
}
.dark-mode table th, .dark-mode table td {
    background: #1b1b1b;
    color: #bbb;
}

.dark-mode table th {
    background: #333;
    border-bottom: 1px solid #444; /* Subtle borders for headers */
}

.dark-mode table tbody tr:hover {
    background-color: #333; /* Darker hover background for rows */
    border-left: 3px solid #555; /* Highlight the row on hover */
}
.dark-mode table .action-button {
    background: #3a3a3a;
    color: #fff;
}

.dark-mode table .action-button:hover {
    background-color: #555;
    color: #e0e0e0;
}

.dark-mode table .action-button.disabled {
    background: #555;
    color: #777;
    pointer-events: none;
}
.dark-mode a.action-button {
    background: #3a3a3a;
    color: #fff;
    text-decoration: none;
}

.dark-mode a.action-button:hover {
    background-color: #555;
    color: #e0e0e0;
}

.dark-mode .modal-content {
    background: #2a2a2a;
    color: #ddd;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); /* Subtle shadow */
}
.dark-mode #scannerArea {
    background: #1e1e1e;
    border: 1px solid #444;
    color: #e0e0e0;
}

.dark-mode #scannerArea #reader {
    background: #2a2a2a;
    border: 1px solid #555;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.dark-mode #scannerArea {
    color: inherit;
}
.dark-mode .progress-container {
    margin-bottom: 20px;
}

.dark-mode #progressBar {
    width: 100%;
    background-color: #1e1e1e; /* Dark gray background */
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #444; /* Subtle border for dark mode */
}

.dark-mode #progress {
    height: 20px;
    background-color: #3cb371; /* Slightly softer green for dark mode */
    width: 0%; /* Controlled dynamically */
    transition: width 0.3s ease; /* Smooth transition */
}
.dark-mode #loadingSpinner img {
    filter: invert(1);
}

.dark-mode .success-message {
    color: #a5d6a7; /* Softer green text */
    background-color: #2e7d32; /* Dark green background */
    border-color: #1b5e20; /* Darker green border */
}

.dark-mode .error-message {
    color: #e57373; /* Softer red text */
    background-color: #c62828; /* Dark red background */
    border-color: #8e0000; /* Darker red border */
}
.dark-mode .badge {
    background-color: #e57373; /* Softer red for dark mode */
    color: #000000; /* Black text for better contrast */
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 12px;
    position: relative;
    top: -10px;
    left: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5); /* Stronger shadow for dark mode */
}
/* Dark Mode Styling for Theme Toggle */
.dark-mode .theme-toggle select {
    background-color: var(--dark-bg-color, #333);
    color: var(--dark-text-color, #fff);
    border: 1px solid var(--dark-border-color, #555);
}

.dark-mode .theme-toggle label {
    color: #ddd;
}

.dark-mode .theme-toggle select:focus,
.dark-mode .theme-toggle select:hover {
    background-color: var(--dark-hover-bg-color, #444);
    border-color: var(--dark-primary-color, #4a90e2);
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.4);
}

.dark-mode .pagination a {
    background-color: #333;
    color: #ccc;
}

.dark-mode .pagination a:hover {
    background-color: #555;
    color: #fff;
}

.dark-mode .pagination a:disabled {
    background-color: #222;
    color: #666;
}

.dark-mode .offline-message {
    background-color: #555; /* Darker yellow */
    color: #fff; /* White text for contrast */
}

.dark-mode ::-webkit-scrollbar-track {
    background: #1e1e1e; /* Darker track background */
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: #444; /* Darker scrollbar thumb */
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #555; /* Lighter hover thumb */
}
.dark-mode ::-webkit-scrollbar {
    width: 8px;
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: #555;
}

.dark-mode a {
    color: #4a90e2; /* Lighter blue for links in dark mode */
}

.dark-mode a:hover {
    color: #78b6f2; /* Slightly lighter blue for hover state */
}

.dark-mode a:active {
    color: #2a78c7; /* Slightly darker blue for active state */
}

.dark-mode .close-button {
    color: #aaa;
}

.dark-mode .close-button:hover {
    color: #fff; /* Make the close button hover color distinct */
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212; /* True dark background */
        color: #e0e0e0; /* Slightly muted text color for better contrast */
    }

    form {
        background: #1e1e1e;
        border-color: #333;
    }

    form input, form button, form textarea {
        background: #2a2a2a;
        color: #ddd;
        border-color: #444;
    }

    form input::placeholder {
        color: #777; /* Subtle placeholder text */
    }

    .button, .action-button {
        background: #3a3a3a;
        color: #fff;
    }

    .button:hover, .action-button:hover {
        background: #555;
    }

    table th, table td {
        background: #1b1b1b;
        color: #bbb;
    }

    table th {
        background: #333;
    }

    .modal-content {
        background: #2a2a2a;
        color: #ddd;
    }

    .pagination a {
        background: #444;
        color: #ddd;
    }

    .pagination a:hover {
        background: #555;
    }

    .pagination a:disabled {
        background: #2a2a2a;
        color: #888;
    }

    .offline-message {
        background-color: #444;
        color: #ddd;
    }

    .close-button {
        color: #aaa;
    }

    .close-button:hover {
        color: #fff;
    }
}

/* --- Enhanced Mobile Responsiveness & Accessibility --- */

/* Ensure safe viewport height on mobile browsers */
.center-content {
    min-height: 100svh; /* Safe Viewport Height (iOS Safari fix) */
}

/* Improve tap target sizing for buttons */
button,
.button,
.action-button,
.collapsible {
    min-width: 44px;
    min-height: 44px;
}

/* Make SOS buttons responsive */
.sos-button-ok,
.sos-button-alarm {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

/* Wrap tables for safer overflow on mobile */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table-wrapper table {
    width: 100%;
    min-width: 600px; /* Prevent squashing on small screens */
}

/* Modal adjustments for very small screens */
@media (max-width: 360px) {
    .modal-content {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* Responsive font scaling */
body {
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
}

@media (max-width: 320px) {
  body {
    font-size: 0.85rem;
  }

  .sos-button-ok,
  .sos-button-alarm {
    font-size: 0.85rem;
    height: 44px;
  }
}
