/* Scraper-specific styles */

/* Main scraper layout */
.scraper-main {
    max-width: 1200px;
    margin: 0 auto;
}

.scraper-form-section {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.scraper-form-section h2 {
    color: var(--text-color);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.section-description {
    color: var(--text-color-light);
    margin-bottom: 25px;
    font-size: 1rem;
}

/* Form styles */
.scraper-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input[type="url"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    min-height: 80px;
    line-height: 1.5;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-color-light);
    font-style: italic;
}

.checkbox-group {
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.form-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Button styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background-color: var(--card-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

.btn-accent {
    background-color: var(--accent-color);
    color: white;
}

.btn-accent:hover:not(:disabled) {
    background-color: #8e44ad;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Job Status Section */
.job-status-section {
    margin-bottom: 30px;
}

.job-status-section h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.status-card {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.status-header h3 {
    color: var(--text-color);
    font-size: 1.3rem;
    margin: 0;
}

.status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.queued {
    background-color: #f39c12;
    color: white;
}

.status-badge.processing {
    background-color: #3498db;
    color: white;
}

.status-badge.completed {
    background-color: #2ecc71;
    color: white;
}

.status-badge.failed {
    background-color: #e74c3c;
    color: white;
}

.status-details {
    display: grid;
    gap: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-label {
    font-weight: 600;
    color: var(--text-color-light);
    min-width: 150px;
}

.status-value {
    color: var(--text-color);
    font-size: 1rem;
}

/* Progress bar */
.progress-container {
    flex: 1;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    height: 24px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    width: 0%;
}

.progress-text {
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.status-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Job History Section */
.job-history-section {
    margin-bottom: 30px;
}

.job-history-section h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.jobs-table-container {
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.jobs-table {
    width: 100%;
    border-collapse: collapse;
}

.jobs-table thead {
    background-color: var(--primary-color);
    color: white;
}

.jobs-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.jobs-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.jobs-table tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

.jobs-table .no-jobs {
    text-align: center;
    color: var(--text-color-light);
    padding: 30px;
}

.jobs-table .action-buttons {
    display: flex;
    gap: 8px;
}

.jobs-table .btn-xs {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Results Section */
.results-section {
    margin-bottom: 30px;
}

.results-section h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.results-summary {
    margin-bottom: 20px;
}

.summary-card {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.summary-card h3 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: var(--background-color);
    border-radius: 8px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-color-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.3s;
}

.modal-large {
    max-width: 900px;
}

.modal-body {
    margin-top: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-color-light);
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--text-color);
}

/* Toast notification */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--card-background);
    color: var(--text-color);
    text-align: center;
    border-radius: 8px;
    padding: 16px;
    position: fixed;
    z-index: 1001;
    right: 30px;
    bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--primary-color);
}

.toast.show {
    visibility: visible;
    animation: toastIn 0.3s, toastOut 0.3s 2.7s;
}

.toast.error {
    border-left-color: var(--accent-color);
}

.toast.success {
    border-left-color: var(--secondary-color);
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .scraper-form-section {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

    .form-actions .btn {
        width: 100%;
    }

    .status-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .status-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .status-label {
        min-width: auto;
    }

    .jobs-table {
        font-size: 0.85rem;
    }

    .jobs-table th,
    .jobs-table td {
        padding: 10px;
    }

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

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

    .results-actions .btn {
        width: 100%;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 20px;
    }
}

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

    .scraper-form-section h2,
    .job-status-section h2,
    .job-history-section h2,
    .results-section h2 {
        font-size: 1.5rem;
    }

    .status-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
}

/* Dark mode adjustments */
.dark-mode .jobs-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dark-mode .progress-bar {
    background: linear-gradient(90deg, #5dade2, #af7ac5);
}

.dark-mode .btn-secondary:hover:not(:disabled) {
    background-color: #444;
}
