/* Admin Panel CSS - Modern, Clean Design */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --danger-color: #dc2626;
    --success-color: #16a34a;
    --warning-color: #f59e0b;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-sidebar: #1e293b;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 2rem;
    margin-bottom: 3rem;
    color: white;
}

.logo i {
    font-size: 2rem;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-menu {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 2rem;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--primary-color);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

.content-section {
    display: none;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
}

/* Buttons */
.btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

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

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

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

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

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

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

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

.stat-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.stat-content h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    height: 380px;
}

.chart-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Zorg dat canvas de kaart volledig opvult en geen layout feedback-loop veroorzaakt */
.chart-card canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Forms */
.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.form-input,
.form-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-input {
    flex: 1;
    min-width: 200px;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tables */
.products-table {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

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

.products-table th {
    background-color: var(--bg-secondary);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.products-table td {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
}

.products-table tbody tr:hover {
    background-color: var(--bg-secondary);
}

/* Action Cards */
.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.action-card {
    background-color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.action-card.danger {
    border-top: 4px solid var(--danger-color);
}

.action-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Scrapers */
.scraper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.scraper-card {
    background-color: white;
    padding: 1.75rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.scraper-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.scraper-header img {
    height: 40px;
    margin-bottom: 0.5rem;
}

.scraper-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.scraper-card .btn {
    font-size: 0.9rem;
}

.scraper-card .btn.btn-primary {
    transform: translateZ(0);
}

.scraper-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Logs */
.logs-container {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.log-entry {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.log-entry:last-child {
    border-bottom: none;
}

/* Job Status Styling */
.job-entry {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.job-status {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

.status-running {
    background-color: #dbeafe;
    color: #1d4ed8;
    animation: pulse 2s infinite;
}

.status-completed {
    background-color: #dcfce7;
    color: #166534;
}

.status-failed {
    background-color: #fee2e2;
    color: #dc2626;
}

.job-progress {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.job-running {
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

#scraper-jobs {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

#scraper-jobs h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Results Container */
.results-container {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-top: 1.5rem;
    display: none;
}

.results-container.show {
    display: block;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Toast */
#toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1001;
}

.toast {
    background-color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.375rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

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

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}
