/* General Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    color: #333;
    overflow-x: hidden; /* Prevent horizontal overflow */
    overflow-y: auto; /* Allow vertical scrolling */
    box-sizing: border-box;
}

* {
    box-sizing: border-box;
}

h1 {
    text-align: center;
    color: #444;
    margin-top: 20px;
}

/* Form Styles */
form {
    margin: 10px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

form input,
form select,
form button {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

form button {
    background-color: #007bff;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

form button:disabled {
    background-color: #cccccc; /* Light gray background */
    color: #666666; /* Dark gray text */
    cursor: not-allowed; /* Show a "not allowed" cursor */
    opacity: 0.6; /* Make the button appear slightly transparent */
}

form button:hover {
    background-color: #0056b3;
}

/* Table Styles */
table {
    width: 90%;
    margin: 0px auto;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #007bff;
    color: #fff;
    font-weight: bold;
}

table tr:hover {
    background-color: #f1f1f1;
}

table tr:last-child td {
    border-bottom: none;
}

#routeStatsTable {
    border-collapse: collapse;
    overflow: auto;
}

.sticky-header th {
    position: sticky;
    top: 0;
    z-index: 1;

}

/* Button Styles */
button {
    padding: 10px 15px;
    font-size: 14px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button.cancelTaskButton {
    background-color: #dc3545;
    color: #fff;
}

button.cancelTaskButton:hover {
    background-color: #c82333;
}

button#confirmCancel {
    background-color: #28a745;
    color: #fff;
}

button#confirmCancel:hover {
    background-color: #218838;
}

button#cancelPopup {
    background-color: #6c757d;
    color: #fff;
}

button#cancelPopup:hover {
    background-color: #5a6268;
}

/* Popup Styles */
#confirmationPopup {
    max-width: 400px;
    text-align: center;
}

/* Input Styles */
input[type="number"] {
    width: auto;
    display: inline-block;
    margin-left: 10px;
}

/* Filter container styles */
#filterContainer {
    position: absolute;
    top: 35px;
    left: 10px;
    transition: all 0.3s ease-in-out;
    z-index: 10;
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    /* padding: 10px; */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Collapsed state */
.filter-collapsed {
    width: 40px;
    height: 40px;
    cursor: pointer;
    overflow: hidden;
}

/* Expanded state */
.filter-expanded {
    width: 300px;
    height: auto;
    cursor: default;
}

#filterContainer .filter-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

#filterContainer .filter-button img {
    width: 20px;
    height: 20px;
}

#files-panel h3 {
    margin-top: 0;
}

#files-list {
    list-style-type: none;
    padding: 0;
}

#files-list li {
    margin-bottom: 10px;
}

#files-list a {
    text-decoration: none;
    color: #007bff;
    cursor: pointer;
}

#result {
    width: 100%; /* Full width below the form and files panel */
    max-width: 100%;
    height: 30vh; /* Set a fixed height for the results section */
    overflow-y: auto; /* Add vertical scrollbar if content overflows */
    background-color: #fff; /* Optional: Add background for better visibility */
    padding: 10px; /* Optional: Add padding for better spacing */
    border: 1px solid #ddd; /* Optional: Add border for better separation */
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
#main-container{
    display:flex;
    flex-direction:column;
    height: calc(100vh - 25px);
    width:100%;
    max-width: 100%;
    overflow: hidden;
}
#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    min-height: 56px;
    width: 100%;
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    gap: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: rgba(255,255,255,0.96);
}
.header-nav,
.header-user,
.header-tools {
    flex-shrink: 0;
    font-size: 13px;
    white-space: nowrap;
}
.header-nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.header-title {
    flex: 1 1 auto;
    text-align: center;
    min-width: 0;
    padding: 0 .5rem;
    overflow: hidden;
}
.header-title h1 {
    margin: 0;
    font-size: 1.35rem;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.header-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-left: auto;
}
.header-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.25rem 0.35rem;
    background: #f8f9fa;
    border: 1px solid #dfe3e8;
    border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}
.header-search input {
    width: min(220px, 32vw);
    padding: 0.5rem 0.75rem;
    margin: 0;
    border: 1px solid #ced4da;
    border-radius: 999px;
    font-size: 13px;
    background: #fff;
}
.header-search button {
    width: auto;
    padding: 0.45rem 0.75rem;
    margin: 0;
    border-radius: 999px;
    font-size: 13px;
    background: #007bff;
    color: #fff;
}
.header-user {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.user-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.user-menu-button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #f8f9fa;
    border: 1px solid #dfe3e8;
    border-radius: 999px;
    color: #212529;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: .45rem .75rem;
    transition: background-color .15s ease, border-color .15s ease;
}
.user-menu-button:hover {
    background: #eef2f6;
    border-color: #cfd8e3;
}
.user-menu-caret {
    font-size: 10px;
    color: #495057;
}
.user-menu-panel {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    padding: .35rem;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
    z-index: 2000;
}
.user-menu-panel.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.user-menu-item {
    margin: 0;
}
.user-menu-item form {
    margin: 0;
}
.user-menu-action {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    color: #212529;
    text-align: left;
    padding: .6rem .75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.user-menu-action:hover {
    background: #f1f3f5;
}
/* Main container for form and files panel */
#content-container {
    display: flex;
    flex-direction: row;
    gap: 20px; /* Add spacing between form and files panel */
    margin-bottom: 20px; /* Add spacing between this section and the results */
    height: 60vh; /* Set a fixed height for the main container */
    overflow-y: auto;
    max-width: 100%;
}

#body-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: calc(100vh - 5vh); /* Adjust height to fill the remaining space */
    width: calc(100% - 2rem);
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem 0 2rem;
    overflow-y: auto; 
}
/* Form container */
#form-container {
    flex: 4; /* Take up 4/5 of the horizontal space */
    overflow-y: auto; /* Add vertical scrollbar if content overflows */
    background-color: #fff; /* Optional: Add background for better visibility */
    padding: 10px; /* Optional: Add padding for better spacing */
    border: 1px solid #ddd; /* Optional: Add border for better separation */
    border-radius: 5px;
}

/* Files panel */
#files-panel {
    flex: 1; /* Take up 1/5 of the horizontal space */
    overflow-y: auto; /* Add vertical scrollbar if content overflows */
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

/* Task Info Container */
.task-info-container {
    display: flex;
    gap: 10px; /* Add spacing between task blocks */
    flex-direction: column;
}

/* Task Info Container */
.task-info {
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
    flex-grow: 1; /* Allow the task container to grow and take available space */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px; /* Add spacing between child elements */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Prevent content overflow */
}

/* Task ID and Slug */
.task-id,
.task-slug {
    flex-shrink: 0; /* Prevent shrinking */
    flex-grow: 1;
    white-space: nowrap; /* Prevent wrapping */
}

/* Task Description */
.task-description {
    flex-grow: 1; /* Allow the description to take up remaining space */
    overflow: hidden; /* Hide overflowing text */
    text-overflow: ellipsis; /* Add ellipsis for truncated text */
    white-space: nowrap; /* Prevent wrapping */
}

/* Task Status Line */
.task-status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 5px;
}

/* Inner Task Info */
.task-status-line .task-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: column;
    flex: 1;
    width: 100%;
    gap: 3px;
}

/* Task Info Text */
.task-info-text, .task-slug{
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    width: 100%;
}

/* Task Title */
.task-title {
    font-size: 0.9em;
    color: black;
    margin-bottom: 5px;
}

/* Task Status */
.task-status {
    flex-shrink: 0; /* Prevent shrinking */
    width: 120px; /* Fixed width for consistent size */
    text-align: center; /* Center-align the status text */
}

/* Pending task */
.task-info.pending {
    background-color: rgba(214, 214, 5, 0.3); /* Transparent yellow */
}

/* Running task */
.task-info.running {
    border: 2px solid green;
    background-color: rgba(0, 255, 0, 0.1); /* Extremely transparent light green */
}

/* Failed task */
.task-info.failed {
    background-color: #dc3545;
    color: #fff;
}

/* Completed task */
.task-info.completed {
    background-color: #198754;
    color: #fff;
}

/* Other task statuses */
.task-info.other {
    border: 2px solid yellow;
}

/* Highlighted */
.highlighted {
    background-color: #d1ecf1; /* Light blue background */
    border-left: 4px solid #007bff; /* Blue border */
    padding-left: 10px; /* Add padding for visual separation */
}

.api-link {
    color: #007bff;
    text-decoration: none;
    display: inline-block; /* Ensure the width applies */
    width: 100%; /* Make all links the same width */
    text-align: left; /* Align text to the left */
    padding: 5px 10px; /* Add some padding for better spacing */
    box-sizing: border-box; /* Include padding in the width */
}

.api-link:hover {
    text-decoration: underline;
    background-color: #f1f1f1; /* Optional: Add a hover background for better visibility */
}

.api-item {
    display: flex; /* Ensure consistent alignment */
    width: 100%; /* Ensure the list item takes up full width */
    align-items: center;
    gap: 1rem
}

.api-label {
    flex: 1;
}

.api-link {
    flex: 1;
    text-decoration: none;
    color: blue; /* Optional styling */
}

.api-description {
    flex: 6;
}

/* Floating button */
.floating-button {
    position: fixed;
    right: 20px;
    bottom: 30px;
    top: auto;
    z-index: 1000;
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media (max-width: 640px) {
    .floating-button {
        left: 20px;
        right: 20px;
        width: auto;
    }
}

.floating-button:hover {
    background-color: #0056b3;
}

/* Floating debug output */
.floating-debug {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
    width: calc(100% - 40px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-family: monospace;
    white-space: pre-wrap;
}

.form-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 2rem;
}

/* Black magic to make checkboxes and labels align properly */
input[type="checkbox"] + label,
input[type="checkbox"]
{
    width:inherit;
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px; /* Optional: Add spacing between the label and checkbox */
}

/* Endpoint Detail Page Styles */
.search-section {
    margin: 0;
    padding: 1rem 1.25rem 1.1rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(19, 29, 38, 0.04);
}

.search-section h3 {
    margin: 0 0 0.75rem;
    font-size: 1.1em;
    color: #495057;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.search-form input {
    flex: 1;
    max-width: 240px;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    margin: 0;
}

.search-form button {
    width: auto;
    padding: 0.6rem 1rem;
    background-color: #007bff;
    color: white;
    border: 1px solid #007bff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin: 0;
}

.search-results {
    display: none;
    margin-top: 0.75rem;
}

.info-section {
    margin: 0;
    padding: 1rem 1.25rem 1.25rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.endpoint-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.85fr);
    gap: 1rem;
    align-items: start;
}

.endpoint-details {
    display: grid;
    gap: 0.5rem;
    align-content: start;
}

.endpoint-details p {
    margin: 0;
    padding: 0.4rem 0.5rem;
    background: #f8f9fa;
    border: 1px solid #eef2f6;
    border-radius: 6px;
}

.location-map {
    min-height: 280px;
    height: 100%;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    overflow: hidden;
    background: #edf3f8;
}

.tabs-container {
    margin: 0;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid #ddd;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tab-button {
    background: none;
    border: none;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s, background-color 0.2s ease;
    border-radius: 8px 8px 0 0;
}

.tab-button.active {
    border-bottom-color: #007bff;
    color: #007bff;
    background: #f5f9ff;
}

.tab-button:hover {
    background-color: #f0f0f0;
}

.tab-content {
    display: none;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.tab-content.active {
    display: block;
}

@media (max-width: 800px) {
    #header {
        flex-wrap: wrap;
        justify-content: center;
        padding-bottom: 0.9rem;
    }

    .header-nav {
        width: 100%;
        justify-content: flex-start;
    }

    .header-title {
        width: 100%;
    }

    .header-tools {
        width: 100%;
        justify-content: center;
    }

    .header-search {
        width: min(100%, 360px);
        justify-content: center;
    }

    .header-search input {
        width: auto;
        max-width: none;
        flex: 1;
    }

    .endpoint-layout {
        grid-template-columns: 1fr;
    }
}

.meter-item,
.request-item,
.read-item {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #fafafa;
}

.request-item.completed {
    background: #e8f5e8;
    border-color: #4caf50;
}

.request-item.pending {
    background: #fff3cd;
    border-color: #ffc107;
}

.error {
    color: black;
    /* background: #ffebee; */
    padding: 10px;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    margin: 10px 0;
}

/* Cycles Scrollable Container */
.cycles-scrollable {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 10px 0;
}

.cycles-header {
    font-size: 1.2em;
    margin: 10px 0 5px 0;
    font-weight: bold;
}

.cycles-table .current-cycle {
    background-color: #e3f2fd;
    font-weight: bold;
}

.progress-container {
    margin-top: 5px;
    width: calc(100% - 10px);
}

.progress-item {
    display: grid;
    grid-template-columns: fit-content(250px) 1fr;
    gap: 5px;
    align-items: center;
    margin-bottom: 2px;
}

.progress-name {
    font-size: 0.8em;
    color: #666;
    white-space: nowrap;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #4caf50;
    width: 0%;
    transition: width 0.3s;
}

/* ── Mobile overrides ─────────────────────────────────────────── */
@media (max-width: 768px) {
    #main-container {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }
    #body-container {
        height: auto;
        overflow: visible;
        padding-bottom: 56px; /* clear the fixed footer */
    }
    #header {
        flex-wrap: wrap;
        min-height: auto;
        padding: .4rem .75rem;
        gap: .25rem;
    }
    .header-nav {
        order: 1;
        width: 100%;
        padding-bottom: .25rem;
        border-bottom: 1px solid #e9ecef;
    }
    .header-title {
        order: 2;
        width: 100%;
        padding: .15rem 0;
    }
    .header-title h1 {
        font-size: 1rem;
        white-space: normal;
    }
    .header-user {
        order: 3;
        width: 100%;
        text-align: right;
        font-size: 12px;
    }
    .task-description {
        white-space: normal;
        overflow-wrap: break-word;
    }
}
