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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    line-height: 1.6;
}

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

header {
    text-align: center;
    padding: 40px 0 20px;
}

header h1 {
    font-size: 2rem;
    color: #16213e;
}

.subtitle {
    color: #666;
    margin-top: 8px;
}

/* OEM-sökning */
.oem-search label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}

.oem-row { display: flex; gap: 10px; }

#oem-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1.05rem;
    transition: border-color 0.2s;
}

#oem-input:focus {
    outline: none;
    border-color: #2563eb;
}

.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

.divider span {
    background: #fff;
    padding: 0 16px;
    color: #999;
    font-size: 0.9rem;
    position: relative;
}

.oe-nums {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
    word-break: break-all;
}

/* Sökruta */
.search-box {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin: 20px 0 30px;
}

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

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}

.field select {
    width: 100%;
    padding: 12px 16px;
    min-height: 48px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
}

.field select:focus {
    outline: none;
    border-color: #2563eb;
}

.field select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    color: #999;
}

/* Resultat */
.results {
    margin-top: 10px;
}

.results h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
    color: #16213e;
}

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

a.part-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.part-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.part-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.part-image {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    overflow: hidden;
}

.part-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.no-image {
    color: #ccc;
    font-size: 0.9rem;
}

.part-info {
    padding: 16px;
}

.part-info h3 {
    font-size: 1.1rem;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.category {
    font-size: 0.85rem;
    color: #888;
}

.line {
    display: inline-block;
    font-size: 0.75rem;
    background: #e8f4fd;
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 6px;
}

.price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #16a34a;
    margin-top: 8px;
}

.ean {
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 4px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

/* Produktsida */
.back-link {
    display: inline-block;
    margin: 16px 0;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.product-gallery img#main-img {
    width: 100%;
    border-radius: 8px;
    object-fit: contain;
    max-height: 400px;
    background: #f9f9f9;
}

.thumbnails {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.thumb {
    width: 60px;
    height: 45px;
    object-fit: contain;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
}

.thumb:hover { border-color: #2563eb; }

.no-image-large {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    color: #ccc;
}

.product-info-detail h1 {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.price-box { margin: 16px 0; }

.price-large {
    font-size: 2rem;
    font-weight: 700;
    color: #16a34a;
}

.price-unavailable {
    font-size: 1.2rem;
    color: #999;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.info-table td {
    padding: 6px 12px 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-table td:first-child {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    width: 40%;
}

.product-info-detail h3 {
    margin-top: 20px;
    margin-bottom: 8px;
    color: #16213e;
}

/* Fordonstabell */
.vehicles-section {
    margin-top: 30px;
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.vehicles-section h2 { margin-bottom: 16px; }

.vehicles-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.vehicles-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 2px solid #e0e0e0;
    color: #555;
}

.vehicles-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
}

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

.pdf-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.pdf-link:hover { text-decoration: underline; }

.more-vehicles {
    text-align: center;
    color: #888;
    margin-top: 12px;
}

@media (max-width: 768px) {
    .product-detail { grid-template-columns: 1fr; }
}

footer {
    text-align: center;
    padding: 30px 0;
    color: #aaa;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    header h1 { font-size: 1.5rem; }
    .search-box { padding: 16px; }
    .dropdowns { grid-template-columns: 1fr; }
}
