/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Login Styles */
.login-body {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.login-card h1 {
    margin-bottom: 10px;
    color: #333;
}

.login-card p {
    color: #666;
    margin-bottom: 30px;
}

/* Navigation */
.navbar {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-brand h2 {
    color: #333;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: #666;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #667eea;
    background-color: #f0f0f0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    margin: 5px;
}

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

.btn-primary:hover {
    background-color: #5a67d8;
}

.btn-success {
    background-color: #48bb78;
    color: white;
}

.btn-success:hover {
    background-color: #38a169;
}

.btn-info {
    background-color: #4299e1;
    color: white;
}

.btn-info:hover {
    background-color: #3182ce;
}

.btn-warning {
    background-color: #ed8936;
    color: white;
}

.btn-warning:hover {
    background-color: #dd6b20;
}

.btn-danger {
    background-color: #f56565;
    color: white;
}

.btn-danger:hover {
    background-color: #e53e3e;
}

.btn-secondary {
    background-color: #a0aec0;
    color: white;
}

.btn-secondary:hover {
    background-color: #718096;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 0 20px 0;
    border-bottom: 1px solid #ddd;
}

.page-header h1 {
    color: #333;
    font-size: 28px;
}

.page-actions {
    display: flex;
    gap: 10px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 40px;
    opacity: 0.8;
}

.stat-info h3 {
    font-size: 32px;
    color: #333;
    margin-bottom: 5px;
}

.stat-info p {
    color: #666;
    font-size: 14px;
}

/* Config Styles */
.config-section {
    margin-bottom: 40px;
}

.config-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

.config-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.config-header h3 {
    color: #333;
    font-size: 18px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #667eea;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Config Actions */
.config-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 20px 0;
}

/* Tables */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.tab-button {
    background: none;
    border: none;
    padding: 15px 25px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.manual-pull-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.manual-pull-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.manual-pull-input input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.manual-pull-input input:focus {
    border-color: #28a745;
    outline: none;
}

.search-box input {
    width: 300px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.filters {
    display: flex;
    gap: 10px;
}

.filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.table-container {
    background: white;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    min-width: 0; /* Allow shrinking */
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Better control over column widths */
    min-width: 800px; /* Ensure minimum width to prevent cramping */
}

.data-table th {
    background-color: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #ddd;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 0; /* Force equal column distribution */
}

/* Sortable columns */
.data-table th.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: background-color 0.2s;
}

.data-table th.sortable:hover {
    background-color: #e9ecef;
}

.data-table th.sortable::after {
    content: '↕';
    position: absolute;
    right: 10px;
    opacity: 0.3;
    font-size: 12px;
}

.data-table th.sortable.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.data-table th.sortable.sort-desc::after {
    content: '↓';
    opacity: 1;
}

/* Special handling for action columns */
.data-table td.actions,
.data-table th.actions {
    width: 150px;
    max-width: 150px;
    white-space: nowrap;
}

/* Special handling for ID columns */
.data-table td:first-child,
.data-table th:first-child {
    width: 80px;
    max-width: 80px;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.data-table .loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

/* Action Buttons */
.actions-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.actions-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Activity Log */
.recent-activity {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.recent-activity h2 {
    margin-bottom: 20px;
    color: #333;
}

.activity-log {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 15px;
    border-left: 3px solid #667eea;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 0 5px 5px 0;
}

.activity-time {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.activity-description {
    color: #333;
    font-weight: 500;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-content.large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.modal-header h3 {
    color: #333;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close-btn:hover {
    color: #333;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* Loading Spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Messages */
.error-message {
    background-color: #fed7d7;
    color: #c53030;
    padding: 12px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
}

.success-message {
    background-color: #c6f6d5;
    color: #2f855a;
    padding: 12px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    cursor: help;
}

.status-active {
    background-color: #c6f6d5;
    color: #2f855a;
}

.status-ready {
    background-color: #fef3c7;
    color: #92400e;
}

.status-inactive {
    background-color: #fed7d7;
    color: #c53030;
}

.status-processing {
    background-color: #ffd89b;
    color: #d69e2e;
}

/* ADP Status Badges */
.status-badge.success {
    background-color: #c6f6d5;
    color: #2f855a;
}

.status-badge.error {
    background-color: #fed7d7;
    color: #c53030;
}

.status-badge.warning {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.pending {
    background-color: #e2e8f0;
    color: #4a5568;
}

/* ADP Status Section in Modal */
.adp-status-section {
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
}

.adp-status-section h4 {
    margin-bottom: 12px;
    color: #2d3748;
}

.error-text {
    color: #c53030;
    font-size: 13px;
}

/* Job Requisition Specific Styles */
.pay-range {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #2196F3;
    background-color: #e3f2fd;
    padding: 2px 6px;
    border-radius: 4px;
}

.data-table code {
    background-color: #f5f5f5;
    color: #666;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h4 {
    margin-bottom: 8px;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
    font-size: 1.2em;
}

.detail-section h5 {
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px 20px;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: 15px;
        padding: 0 20px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .action-buttons {
        justify-content: center;
    }
    
    .config-actions {
        flex-direction: column;
        align-items: center;
    }
}

/* Test Results Modal Styles */
.test-summary {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.test-summary .success {
    color: #28a745;
    font-weight: bold;
}

.test-summary .error {
    color: #dc3545;
    font-weight: bold;
}

.test-steps {
    margin-bottom: 20px;
}

.test-steps h4 {
    margin-bottom: 10px;
    color: #333;
}

.step-item {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 5px;
    border-left: 4px solid #ccc;
}

.step-item.success {
    background-color: #d4edda;
    border-left-color: #28a745;
}

.step-item.failed {
    background-color: #f8d7da;
    border-left-color: #dc3545;
}

.step-item.starting {
    background-color: #fff3cd;
    border-left-color: #ffc107;
}

.step-status {
    margin-right: 10px;
    font-size: 18px;
}

.step-name {
    font-weight: bold;
    flex-grow: 1;
}

.step-error {
    margin-top: 5px;
    font-size: 12px;
    color: #dc3545;
    background-color: #f8f9fa;
    padding: 5px;
    border-radius: 3px;
}

.step-time {
    color: #666;
    font-size: 11px;
    margin-left: 10px;
    white-space: nowrap;
}

.test-details {
    margin-top: 20px;
}

.test-details h4 {
    margin-bottom: 10px;
    color: #333;
}

.test-details pre {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
}

.modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
}

/* Cron Status Styles */
#cronStatusCard {
    transition: background 0.3s ease;
}

#cronStatusCard small {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    opacity: 0.8;
}

.cron-execution-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.cron-execution-details {
    margin-top: 15px;
}

.execution-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #007bff;
}

.execution-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 10px;
}

.execution-header h3 {
    margin: 0;
    color: #333;
    flex-grow: 1;
}

.execution-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #666;
}

.execution-time {
    font-weight: 500;
}

.execution-duration {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
}

.execution-reason {
    margin-bottom: 10px;
    padding: 8px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 3px;
}

.execution-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.execution-stats .stat {
    display: flex;
    gap: 5px;
}

.execution-stats .label {
    font-weight: 500;
    color: #555;
}

.execution-stats .value {
    font-weight: bold;
}

.execution-stats .value.success {
    color: #28a745;
}

.execution-stats .value.error {
    color: #dc3545;
}

.execution-steps {
    margin-top: 15px;
}

.execution-steps h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.step-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s ease;
}

.step-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.step-item.completed {
    border-left: 4px solid #28a745;
    background: #f8fff9;
}

.step-item.failed {
    border-left: 4px solid #dc3545;
    background: #fff8f8;
}

.step-item.skipped {
    border-left: 4px solid #6c757d;
    background: #f8f9fa;
}

.step-item.partial {
    border-left: 4px solid #ffc107;
    background: #fffdf5;
}

.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.step-status {
    margin-right: 10px;
    font-size: 16px;
}

.step-name {
    font-weight: 600;
    color: #333;
    flex-grow: 1;
}

.step-message {
    color: #666;
    margin-bottom: 10px;
}

.job-details {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.job-item {
    padding: 8px;
    margin: 5px 0;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
}

.job-item.completed {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.job-item.failed {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.job-item.skipped {
    background: #e9ecef;
    border: 1px solid #dee2e6;
}

.job-item .error {
    color: #721c24;
    margin-top: 3px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .execution-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .execution-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .execution-meta {
        flex-direction: column;
        gap: 5px;
    }
}