/* Search and Filter Section - now in header */
.search-and-filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.search-input {
    padding: 0.7rem 0.75rem;
    padding-right: 2rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.85rem;
    min-width: 200px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-clear {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.search-clear:hover {
    background: #f0f0f0;
    color: #666;
}


.status-filters {
    display: flex;
    gap: 0.1rem;
    align-items: center;
    flex-wrap: wrap;
}

.status-filter {
    padding: 0.4rem 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    color: #555;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.status-filter span {
    font-weight: 600;
    opacity: 0.8;
}

.status-filter:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.status-filter.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    position: relative;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.table-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.table-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.refresh-btn:hover {
    background: #5568d3;
}

.kill-btn {
    background: #dc3545;
    color: white;
    border: none;
    /* padding: 0.5rem 1rem; */
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
    font-weight: 500;
}

.kill-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.delete-btn {
    background: #fd7e14;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
    font-weight: 500;
}

.delete-btn:hover {
    background: #e66a00;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(253, 126, 20, 0.3);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
    table-layout: auto;
}

th, td {
    padding: 0.5rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}

th:last-child, td:last-child {
    border-right: none;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

th.filter-active {
    background: #e8f0ff;
    border-left: 3px solid #667eea;
    border-right: 3px solid #667eea;
    border-top: 3px solid #667eea;
    z-index: 1001;
}

.th-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.th-content > span {
    flex: 1;
}

.filter-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    color: #666;
    transition: all 0.2s;
    border-radius: 4px;
    min-width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-btn:hover {
    background: #e0e0e0;
    color: #333;
    transform: none;
    box-shadow: none;
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

.filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 3px solid #667eea;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    max-height: 300px;
    margin-top: -1px;
    overflow: hidden;
}

/* Ensure dropdown doesn't overflow table container */
/* Note: overflow-x: auto is set above for horizontal scrolling */
.table-container {
    position: relative;
    overflow-y: visible; /* Allow dropdowns to overflow vertically */
    overflow-x: auto; /* Enable horizontal scrolling for table */
}

.filter-search {
    padding: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.filter-search input {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.filter-search input:focus {
    outline: none;
    border-color: #667eea;
}

.filter-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-option:hover {
    background-color: #f0f0f0;
}

.filter-option input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.filter-option span {
    flex: 1;
    font-size: 0.85rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    border-top: 1px solid #e0e0e0;
    justify-content: flex-end;
}

.filter-actions button {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    min-width: auto;
    height: auto;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-actions button:hover {
    background: #5568d3;
    transform: none;
    box-shadow: none;
}

.filter-actions button:first-child {
    background: #6c757d;
}

.filter-actions button:first-child:hover {
    background: #5a6268;
}

tr:hover {
    background: #f8f9fa;
}



.date-group-header {
    background: #f0f4ff;
    border-top: 2px solid #667eea;
    border-bottom: 2px solid #667eea;
}

.date-group-header td {
    border-right: none;
}

.date-group-label {
    font-weight: 600;
    color: #667eea;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.status-PENDING { background: #fff3cd; color: #856404; }
.status-RUNNING { background: #d1ecf1; color: #0c5460; }
.status-COMPLETED { background: #d4edda; color: #155724; }
.status-FAILED { background: #f8d7da; color: #721c24; }
.status-CANCELLED { background: #e2e3e5; color: #383d41; }
.status-RETRY_PENDING { background: #ffeaa7; color: #6c5ce7; }

.priority-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.priority-0 { background: #dc3545; color: white; }
.priority-1 { background: #fd7e14; color: white; }
.priority-2 { background: #ffc107; color: #333; }
.priority-3 { background: #6c757d; color: white; }

.error-message {
    max-width: 400px;
    word-wrap: break-word;
    color: #721c24;
    font-size: 0.85rem;
    line-height: 1.4;
}

.error-message.clickable {
    cursor: pointer;
    transition: background-color 0.2s;
}

.error-message.clickable:hover {
    background-color: #fff5f5;
}

.error-message div {
    max-height: 60px;
    overflow: auto;
}

.clickable {
    cursor: pointer;
    transition: all 0.2s;
    color: #667eea;
    font-weight: 500;
}

.task-info{
    font-weight: 500;
    color: black;
}
.clickable:hover {
    background-color: #f8f9ff;
    text-decoration: underline;
}

button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
}

button:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button.secondary {
    background: #6c757d;
}

button.secondary:hover {
    background: #5a6268;
}

button.danger {
    background: #dc3545;
}

button.danger:hover {
    background: #c82333;
}

.action-buttons {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

/* Icon buttons - subtle design */
.action-buttons button {
    background: transparent;
    color: #666;
    border: 1px solid #e0e0e0;
    padding: 0.4rem;
    border-radius: 4px;
    min-width: 2rem;
    height: 2rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.action-buttons button:hover {
    background: #f8f9fa;
    border-color: #ccc;
    color: #333;
    transform: none;
    box-shadow: none;
}

.action-buttons button.danger {
    background: transparent;
    color: #dc3545;
    border-color: #f5c6cb;
}

.action-buttons button.danger:hover {
    background: #fff5f5;
    border-color: #dc3545;
    color: #c82333;
}

/* Rerun button specific styling */
.action-buttons button:not(.danger) {
    color: #667eea;
    border-color: #e0e7ff;
}

.action-buttons button:not(.danger):hover {
    background: #f0f4ff;
    border-color: #667eea;
    color: #5568d3;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    position: relative;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section h3 {
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.modal-section p,
.modal-section pre {
    margin: 0.5rem 0;
    color: #333;
    font-size: 0.95rem;
    line-height: 1.6;
}

.modal-section pre {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    border: 1px solid #e0e0e0;
}

.error-section {
    background: #fff5f5;
    border: 2px solid #f8d7da;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.error-section h3 {
    color: #721c24;
    margin-bottom: 0.75rem;
}

.error-pre {
    background: #fff;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 300px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #f5c6cb;
    font-family: 'Courier New', Courier, monospace;
}

.error-formatted {
    background: #fff;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.8;
}

.error-summary {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f5c6cb;
    color: #721c24;
}

.error-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.error-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f5c6cb;
}

.error-item:last-child {
    border-bottom: none;
}

.error-product-id {
    font-weight: 600;
    color: #721c24;
    margin-bottom: 0.25rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

.error-details {
    color: #721c24;
    font-size: 0.9rem;
    padding-left: 0;
}

/* .NET API Error Formatting */
.error-dotnet {
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 0.75rem;
    margin: 0.5rem 0;
}

.error-status {
    font-weight: 600;
    color: #721c24;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', Courier, monospace;
}

.error-client-msg {
    color: #721c24;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.error-stack-details {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f5c6cb;
}

.error-stack-details summary {
    cursor: pointer;
    color: #721c24;
    font-size: 0.85rem;
    font-weight: 500;
    user-select: none;
    padding: 0.25rem 0;
}

.error-stack-details summary:hover {
    text-decoration: underline;
}

.error-stack-trace {
    background: #fff;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #f5c6cb;
    font-family: 'Courier New', Courier, monospace;
    max-height: 300px;
    overflow-y: auto;
}

.modal-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.modal-row:last-child {
    border-bottom: none;
}

.modal-label {
    font-weight: 600;
    color: #666;
}

.modal-value {
    color: #333;
}

.modal-value code {
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: #667eea;
    border: 1px solid #e0e0e0;
    display: inline-block;
    margin: 0.25rem 0;
}

.modal-value code:first-child {
    margin-top: 0;
}

.modal-value code:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .search-and-filters {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper {
        width: 100%;
    }

    .search-input {
        width: 100%;
        min-width: unset;
    }

    .status-filters {
        width: 100%;
        margin-top: 0.5rem;
    }

    .status-filter {
        flex: 1;
        min-width: calc(50% - 0.25rem);
    }

    .table-container {
        padding: 1rem;
        margin: 0 auto;
        border-radius: 12px;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        /* Add visual indicator for scrollable content */
        position: relative;
    }

    /* Add scroll shadow indicators on mobile */
    .table-container::before,
    .table-container::after {
        content: '';
        position: absolute;
        top: 0;
        width: 20px;
        height: 100%;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s;
        z-index: 5;
    }

    .table-container::before {
        left: 0;
        background: linear-gradient(to right, rgba(255,255,255,0.9), transparent);
    }

    .table-container::after {
        right: 0;
        background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    }

    .table-container.scrollable::after {
        opacity: 1;
    }

    /* Show left indicator when scrolled */
    .table-container.scrollable.scrolled-left::before {
        opacity: 1;
    }

    table {
        font-size: 0.85rem;
        /* Ensure table is wide enough to show all columns */
        min-width: 800px;
        width: max-content;
    }

    th, td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }

    /* Show all columns on mobile - allow horizontal scrolling */
    .hide-mobile {
        display: table-cell !important;
    }

    .error-message {
        max-width: 250px;
        font-size: 0.75rem;
        white-space: normal;
        word-wrap: break-word;
    }

    .filter-dropdown {
        min-width: 180px;
        max-width: 250px;
    }

    .th-content {
        flex-wrap: nowrap;
        min-width: fit-content;
    }

    .filter-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    /* Ensure table header stays visible during scroll */
    thead {
        position: sticky;
        top: 0;
        z-index: 10;
    }
}

/* Context Menu */
.context-menu {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    min-width: 150px;
    padding: 0.25rem 0;
    overflow: hidden;
}

.context-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.context-menu-item.context-menu-danger {
    color: #dc3545;
}

.context-menu-item.context-menu-danger:hover {
    background-color: #fff5f5;
    color: #c82333;
}

@media (max-width: 480px) {
    .table-container {
        padding: 0.75rem;
    }

    table {
        min-width: 700px;
        font-size: 0.8rem;
    }

    th, td {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }

    .error-message {
        max-width: 200px;
        font-size: 0.7rem;
    }
}

/* Manual Fix Section */
.manual-fix-section {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.manual-fix-section h3 {
    margin-top: 0;
    color: #856404;
}

.manual-fix-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.manual-fix-form > div {
    display: flex;
    flex-direction: column;
}

.manual-fix-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.manual-fix-form input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.manual-fix-actions {
    text-align: right;
}

.manual-fix-actions button {
    padding: 8px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

.manual-fix-actions button:hover {
    background-color: #218838;
}

.product-link {
    color: #007bff;
    text-decoration: underline;
    font-weight: 500;
    word-break: break-all;
}

.product-link:hover {
    color: #0056b3;
}

