/* EPREL Scraper Styles */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
}

/* Search Form */
.search-section .form-group {
    margin-bottom: 16px;
}

.search-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-row {
    display: flex;
    gap: 12px;
}

.input-row input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-row input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-row button {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.input-row button:hover {
    background: var(--primary-dark);
}

.input-row button:active {
    transform: scale(0.98);
}

.input-row button:disabled {
    background: var(--secondary);
    cursor: not-allowed;
}

.form-options {
    display: flex;
    gap: 20px;
    align-items: center;
}

.form-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-options input[type="number"] {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.form-options .checkbox-label {
    padding: 6px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.form-options .checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* Progress Section */
.progress-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
    border-radius: 12px;
    transition: width 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

#progressPercent {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
}

#progressPhase {
    color: var(--text-light);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.stat-box {
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
}

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

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

.top-brands {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.brand-tag {
    padding: 4px 12px;
    background: var(--bg);
    border-radius: 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.brand-tag:hover {
    background: var(--primary);
    color: white;
}

.brand-tag-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.brand-delete-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    border-radius: 50%;
}

.brand-delete-btn:hover {
    opacity: 1;
    background: var(--error);
    transform: scale(1.1);
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.results-header h2 {
    border: none;
    padding: 0;
    margin: 0;
}

.export-buttons {
    display: flex;
    gap: 8px;
}

.btn-export {
    padding: 8px 16px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

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

.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filters input,
.filters select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

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

/* Table */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 16px;
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
    position: sticky;
    top: 0;
}

tr:hover {
    background: var(--bg);
}

td a {
    color: var(--primary);
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

.energy-class {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.energy-class-a { background: #22c55e; color: white; }
.energy-class-b { background: #84cc16; color: white; }
.energy-class-c { background: #eab308; color: black; }
.energy-class-d { background: #f97316; color: white; }
.energy-class-e { background: #ef4444; color: white; }
.energy-class-f { background: #dc2626; color: white; }
.energy-class-g { background: #991b1b; color: white; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.pagination button {
    padding: 8px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* Footer */
footer {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .input-row {
        flex-direction: column;
    }

    .results-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .filters {
        flex-direction: column;
    }

    .filters input {
        width: 100%;
    }

    th, td {
        padding: 8px;
        font-size: 0.85rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.3s ease;
}

/* Loading state */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* EAN Column Styles */
.ean-cell {
    white-space: nowrap;
}

.ean-code {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #93c5fd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e40af;
    letter-spacing: 0.5px;
}

.no-ean {
    color: var(--text-light);
    font-style: italic;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

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

/* EAN Bridge Scrapers Section */
.ean-bridge-section {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 2px solid #fde047;
}

.ean-bridge-section h2 {
    color: #854d0e;
    border-bottom-color: #eab308;
}

.section-desc {
    color: #a16207;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.scraper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.scraper-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.scraper-card:hover:not(.scraper-disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.scraper-card.scraper-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f8fafc;
    border-style: dashed;
}

.scraper-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.scraper-icon {
    font-size: 1.5rem;
}

.scraper-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.scraper-stats {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
    padding: 8px;
    background: var(--bg);
    border-radius: 4px;
}

.scraper-stats .missing-count {
    color: var(--warning);
    font-weight: 600;
}

.placeholder-text {
    font-style: italic;
    color: var(--secondary);
}

.scraper-actions {
    margin-bottom: 8px;
}

.btn-scraper {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-scraper:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: scale(1.02);
}

.btn-scraper:disabled {
    background: var(--secondary);
    cursor: not-allowed;
    transform: none;
}

.scraper-status {
    font-size: 0.85rem;
    min-height: 20px;
    padding: 4px 0;
}

.scraper-status.success {
    color: var(--success);
}

.scraper-status.error {
    color: var(--error);
}

.scraper-status.running {
    color: var(--primary);
}
