/* Traktorkoll.se — Design System */

:root {
    --primary: #1B3A5C;
    --primary-light: #2A5580;
    --primary-dark: #0F2640;
    --accent: #E87C2A;
    --accent-light: #F5A623;
    --accent-hover: #D06820;
    --bg: #F4F6F8;
    --card: #FFFFFF;
    --border: #E2E8F0;
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --success: #16A34A;
    --error: #DC2626;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────── */

h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

/* ── Navbar ─────────────────────────────── */

.navbar {
    background: var(--primary);
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.02em;
}
.navbar-brand .accent { color: var(--accent); }

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}
.navbar-nav a {
    color: rgba(255,255,255,0.75);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    border-radius: 6px;
    transition: all 0.15s;
}
.navbar-nav a:hover,
.navbar-nav a.active {
    color: white;
    background: rgba(255,255,255,0.1);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.8125rem;
}
.navbar-user a {
    color: rgba(255,255,255,0.6);
    font-size: 0.8125rem;
}
.navbar-user a:hover { color: white; }

/* ── Container ──────────────────────────── */

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

/* ── Auth Pages ─────────────────────────── */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 1.5rem;
}

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo h1 {
    font-size: 1.75rem;
    color: var(--primary);
}
.auth-logo h1 .accent { color: var(--accent); }
.auth-logo p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.auth-card h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

/* ── Forms ──────────────────────────────── */

.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text);
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.1);
}
.form-group input::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* ── Buttons ────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 100%;
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 124, 42, 0.3);
}

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

.btn-outline {
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--primary);
    background: rgba(27, 58, 92, 0.04);
    color: var(--primary);
}

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

/* ── Alerts ─────────────────────────────── */

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.alert-error {
    background: #FEF2F2;
    color: var(--error);
    border: 1px solid #FECACA;
}
.alert-success {
    background: #F0FDF4;
    color: var(--success);
    border: 1px solid #BBF7D0;
}

/* ── Stats Cards ────────────────────────── */

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

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

/* ── Section Headers ────────────────────── */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.section-header h2 {
    font-size: 1.125rem;
}
.section-header a {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
}

/* ── Brand Pills ────────────────────────── */

.brand-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.brand-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #FFF7ED;
}
.brand-pill .count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ── Auction Cards ──────────────────────── */

.auction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}

.auction-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.auction-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: inherit;
}

.auction-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #E2E8F0;
    display: block;
}

.auction-card-body {
    padding: 1rem;
}
.auction-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.auction-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.auction-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.auction-card-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent);
}
.auction-card-price.no-price {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
}

.auction-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    background: #F8FAFC;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Search/Filter Bar ──────────────────── */

.search-panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.search-input-wrap {
    position: relative;
    margin-bottom: 1rem;
}
.search-input-wrap input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}
.search-input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 58, 92, 0.1);
}
.search-input-wrap svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}
.filter-grid select,
.filter-grid input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.8125rem;
    font-family: inherit;
    color: var(--text);
    background: white;
    outline: none;
}
.filter-grid select:focus,
.filter-grid input:focus {
    border-color: var(--primary);
}

.sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.sort-bar .result-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.sort-bar .result-count strong {
    color: var(--text);
}
.sort-bar select {
    padding: 0.375rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: inherit;
    background: white;
    color: var(--text);
    outline: none;
}

/* ── Quick Search (Dashboard) ───────────── */

.hero-search {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: white;
}
.hero-search h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.hero-search p {
    opacity: 0.8;
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}
.hero-search-input {
    display: flex;
    max-width: 520px;
    margin: 0 auto;
    gap: 0.5rem;
}
.hero-search-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}
.hero-search-input .btn {
    white-space: nowrap;
}

/* ── Detail Page ────────────────────────── */

.detail-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.detail-gallery {
    flex: 0 0 500px;
    max-width: 500px;
}
.detail-main-img {
    width: 100%;
    border-radius: var(--radius);
    aspect-ratio: 4/3;
    object-fit: cover;
    background: #E2E8F0;
}
.detail-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    overflow-x: auto;
}
.detail-thumbs img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}
.detail-thumbs img:hover,
.detail-thumbs img.active {
    border-color: var(--accent);
}

.detail-info {
    flex: 1;
}
.detail-info h1 {
    margin-bottom: 0.75rem;
}

.detail-price-badge {
    display: inline-block;
    background: var(--accent);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.detail-specs {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1.5rem;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}
.detail-specs dt {
    color: var(--text-secondary);
    font-weight: 500;
}
.detail-specs dd {
    color: var(--text);
}

.detail-source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 500;
}

/* ── Valuation / Price Report ───────────── */

.valuation-header {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.price-range-bar {
    position: relative;
    height: 48px;
    background: linear-gradient(90deg, #E2E8F0, var(--accent-light), var(--accent), var(--accent-hover));
    border-radius: 8px;
    margin: 1.5rem 0;
}
.price-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.price-range-labels .avg {
    font-weight: 700;
    color: var(--accent);
    font-size: 1rem;
}

.price-scatter {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

/* ── Pagination ─────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 2rem;
}
.pagination a,
.pagination span {
    padding: 0.5rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}
.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ── No Image Placeholder ───────────────── */

.no-image {
    background: #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ── Footer ─────────────────────────────── */

.footer {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ── Loading Spinner ────────────────────── */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ── Responsive ─────────────────────────── */

@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }
    .navbar-nav {
        display: none;
    }
    .container {
        padding: 1rem;
    }
    .hero-search {
        padding: 1.5rem 1rem;
    }
    .hero-search-input {
        flex-direction: column;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .auction-grid {
        grid-template-columns: 1fr;
    }
    .detail-header {
        flex-direction: column;
    }
    .detail-gallery {
        flex: auto;
        max-width: 100%;
    }
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .auth-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .filter-grid {
        grid-template-columns: 1fr;
    }
}
