* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Navbar */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: #34495e;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

h3 {
    color: #34495e;
    margin-bottom: 1rem;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.stat-status {
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.status-success {
    background-color: #d4edda;
    color: #155724;
}

.status-failed {
    background-color: #f8d7da;
    color: #721c24;
}

/* Actions */
.actions {
    margin: 2rem 0;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

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

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

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

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

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Tables */
table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

thead {
    background-color: #34495e;
    color: white;
}

th, td {
    padding: 1rem;
    text-align: left;
}

tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

tbody tr:hover {
    background-color: #e9ecef;
}

/* Jobs Grid */
.jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.job-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.job-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.job-card h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.job-card .company {
    color: #7f8c8d;
    font-weight: 500;
    margin-bottom: 1rem;
}

.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.job-meta span {
    background-color: #ecf0f1;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.salary {
    color: #27ae60;
    font-weight: 500;
}

.location {
    color: #3498db;
}

.closing-date {
    color: #e67e22;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.job-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 2rem;
    border-radius: 8px;
    max-width: 800px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.job-description {
    margin: 1rem 0;
    line-height: 1.8;
}

.job-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Schedule Form */
.schedule-form-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.schedule-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.85rem;
}

.cron-helper {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.cron-table {
    font-size: 0.9rem;
}

.cron-table code {
    background-color: #e9ecef;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

/* Schedules List */
.schedules-list {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.schedule-actions {
    display: flex;
    gap: 0.5rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

/* Per-source run statuses (scraper health + activity log) */
.status-partial {
    background-color: #fff3cd;
    color: #856404;
}

.status-running {
    background-color: #cce5ff;
    color: #004085;
}

.status-skipped,
.status-stopped,
.status-disabled,
.status-pending,
.status-never {
    background-color: #e9ecef;
    color: #495057;
}

/* Scraper Health */
.scraper-health {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.health-next-run {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.health-table {
    font-size: 0.9rem;
}

.health-error {
    color: #721c24;
    word-break: break-word;
}

/* Scrape Sources settings */
.sources-help {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.sources-table {
    font-size: 0.9rem;
}

.sources-table small {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.sources-table input[type="number"] {
    width: 140px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Recent Logs */
.recent-logs {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.logs-table {
    font-size: 0.9rem;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .jobs-grid {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
    }

    .job-links {
        flex-direction: column;
    }

    .schedule-actions {
        flex-direction: column;
    }
}

/* Scraper Status Box */
.scraper-status-container {
    margin: 2rem 0;
}

.status-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.status-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.status-header h3 {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    font-size: 1.3rem;
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.status-body {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 1.5rem;
}

.status-progress {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.status-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.status-stat {
    background: rgba(255,255,255,0.1);
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
}

.status-stat strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.status-stat span {
    font-size: 1.5rem;
    font-weight: bold;
}

.status-time {
    text-align: center;
    font-size: 0.95rem;
    opacity: 0.9;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .status-stats {
        grid-template-columns: 1fr;
    }
}

/* Status Logs */
.status-logs {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.status-logs h4 {
    color: white;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.log-container {
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 1rem;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.log-entry {
    padding: 0.4rem;
    margin-bottom: 0.3rem;
    border-left: 3px solid transparent;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.log-info {
    border-left-color: #3498db;
}

.log-success {
    border-left-color: #2ecc71;
}

.log-error {
    border-left-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.log-time {
    color: rgba(255,255,255,0.6);
    font-weight: bold;
    min-width: 65px;
}

.log-message {
    color: white;
    flex: 1;
    word-break: break-word;
}

/* Scrollbar styling for logs */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* Stop Button in Status Header */
.status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.status-header button {
    background: rgba(231, 76, 60, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
}

.status-header button:hover:not(:disabled) {
    background: rgba(231, 76, 60, 1);
    border-color: white;
    transform: scale(1.05);
}

.status-header button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
