/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 0 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-highlight {
    color: var(--primary);
}

.nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.badge {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 50px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: white;
    padding: 60px 0 50px;
    text-align: center;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.hero-sub {
    opacity: 0.85;
    font-size: 1.05rem;
    margin-bottom: 32px;
}

/* ===== SEARCH BOX ===== */
.search-box {
    max-width: 540px;
    margin: 0 auto;
}

.search-input-wrap {
    display: flex;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.search-input-wrap input {
    flex: 1;
    border: none;
    padding: 16px 20px;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    outline: none;
    color: var(--text);
}

.search-input-wrap input::placeholder {
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
    color: #94a3b8;
}

.search-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== BUTTONS ===== */
.btn {
    border: none;
    padding: 14px 28px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 12px 26px;
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-loader {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== VEHICLE RESULT CARD ===== */
.vehicle-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin: 30px 0;
    animation: fadeUp 0.4s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.vehicle-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.reg-plate {
    background: #fcd34d;
    color: #1e293b;
    font-size: 1.5rem;
    font-weight: 800;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 2px solid #1e293b;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.vehicle-title {
    flex: 1;
}

.vehicle-title h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.vehicle-title .vehicle-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.vehicle-actions {
    display: flex;
    gap: 8px;
}

/* ===== VEHICLE DETAILS GRID ===== */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border);
}

.detail-item {
    background: var(--bg-white);
    padding: 16px 20px;
}

.detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
}

/* ===== MOT STATUS ===== */
.status-row {
    display: flex;
    flex-wrap: wrap;
}

.status-row .mot-status {
    flex: 1;
    min-width: 200px;
}

.source-banner {
    padding: 12px 24px;
    background: #e0f2fe;
    color: #075985;
    font-size: 0.85rem;
    border-bottom: 1px solid #bae6fd;
}

.mot-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.mot-status.pass {
    background: var(--success-light);
}

.mot-status.fail {
    background: var(--danger-light);
}

.mot-status.expired {
    background: var(--warning-light);
}

.status-icon {
    font-size: 2rem;
}

.status-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.status-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== WARNING FLAGS ===== */
.warning-flags {
    border-bottom: 1px solid var(--border);
}

.warning-flags-header {
    padding: 12px 24px;
    font-weight: 700;
    font-size: 0.95rem;
    background: #fef2f2;
    color: #991b1b;
    border-bottom: 1px solid #fecaca;
}

.warning-flag {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
}

.warning-flag:last-child {
    border-bottom: none;
}

.warning-flag.danger {
    background: #fef2f2;
}

.warning-flag.warning {
    background: #fffbeb;
}

.warning-flag-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-flag-content {
    flex: 1;
}

.warning-flag-content strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.warning-flag.danger .warning-flag-content strong {
    color: #991b1b;
}

.warning-flag.warning .warning-flag-content strong {
    color: #92400e;
}

.warning-flag-content p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* ===== SCORE RING ===== */
.score-section {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.score-ring {
    width: 140px;
    height: 140px;
    margin: 0 auto 12px;
}

.ring-progress {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring-inner {
    width: 116px;
    height: 116px;
    border-radius: 50%;
    background: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-value {
    font-size: 2rem;
    font-weight: 800;
}

.score-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.score-breakdown {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.score-stat {
    text-align: center;
}

.score-stat .num {
    font-size: 1.3rem;
    font-weight: 700;
}

.score-stat .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ===== MOT HISTORY TIMELINE ===== */
.mot-history-section {
    padding: 24px;
}

.mot-history-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.mot-timeline {
    position: relative;
}

.mot-entry {
    position: relative;
    padding: 16px 20px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    background: var(--bg);
    cursor: pointer;
    transition: background 0.2s;
}

.mot-entry:hover {
    background: var(--border);
}

.mot-entry.pass {
    border-color: var(--success);
}

.mot-entry.fail {
    border-color: var(--danger);
}

.mot-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mot-entry-result {
    font-weight: 700;
    font-size: 0.95rem;
}

.mot-entry.pass .mot-entry-result {
    color: var(--success);
}

.mot-entry.fail .mot-entry-result {
    color: var(--danger);
}

.mot-entry-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mot-entry-mileage {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.mot-entry-defects {
    margin-top: 10px;
    display: none;
}

.mot-entry.expanded .mot-entry-defects {
    display: block;
}

.defect-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.defect-item.dangerous {
    background: #fee2e2;
    color: #991b1b;
}

.defect-item.major {
    background: #fee2e2;
    color: #991b1b;
}

.defect-item.minor {
    background: var(--warning-light);
    color: #92400e;
}

.defect-item.advisory {
    background: #e0f2fe;
    color: #075985;
}

.defect-type {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    white-space: nowrap;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(0,0,0,.08);
}

.defect-text {
    flex: 1;
}

.mot-year-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.year-badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

.year-badge.pass {
    background: var(--success-light);
    color: var(--success);
}

.year-badge.fail {
    background: var(--danger-light);
    color: var(--danger);
}

/* ===== MILEAGE CHART ===== */
.mileage-section {
    padding: 24px;
    border-top: 1px solid var(--border);
}

.mileage-chart {
    height: 200px;
    position: relative;
    margin-top: 16px;
}

.mileage-chart canvas {
    width: 100%;
    height: 100%;
}

/* ===== DEFECT SUMMARY ===== */
.defect-summary {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.defect-count {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.defect-count.dangerous {
    background: #fee2e2;
    color: #991b1b;
}

.defect-count.major {
    background: #fee2e2;
    color: #dc2626;
}

.defect-count.minor {
    background: var(--warning-light);
    color: #92400e;
}

.defect-count.advisory {
    background: #e0f2fe;
    color: #075985;
}

/* ===== COMPARE VIEW ===== */
.compare-header {
    text-align: center;
    padding: 40px 0 20px;
}

.compare-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
}

.compare-sub {
    color: var(--text-muted);
}

.compare-empty {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.compare-empty h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.compare-empty p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ===== RECOMMENDATION BANNER ===== */
.recommendation-banner {
    background: linear-gradient(135deg, #065f46, #16a34a);
    color: white;
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.recommendation-banner h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recommendation-banner p {
    opacity: 0.9;
    font-size: 0.95rem;
    line-height: 1.6;
}

.recommendation-factors {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.rec-factor {
    background: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== COMPARE GRID ===== */
.compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.compare-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    transition: transform 0.2s;
}

.compare-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.compare-card.best {
    border: 2px solid var(--success);
}

.compare-card.best::after {
    content: '⭐ RECOMMENDED';
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--success);
    color: white;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.compare-card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.compare-card-header .reg-plate {
    font-size: 1.2rem;
    padding: 8px 16px;
    margin-bottom: 10px;
    display: inline-block;
}

.compare-card-header h4 {
    font-size: 1rem;
    margin-top: 8px;
}

.compare-card-header .vehicle-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.compare-card-body {
    padding: 20px;
}

.compare-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.compare-stat-row:last-child {
    border-bottom: none;
}

.compare-stat-label {
    color: var(--text-muted);
}

.compare-stat-value {
    font-weight: 600;
}

.compare-stat-value.good {
    color: var(--success);
}

.compare-stat-value.bad {
    color: var(--danger);
}

.compare-card-footer {
    padding: 12px 20px;
    background: var(--bg);
    display: flex;
    justify-content: flex-end;
}

/* ===== COMPARISON TABLE ===== */
.comparison-table-wrap {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    margin-bottom: 40px;
}

.comparison-table-wrap h3 {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 1.1rem;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.comparison-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table .winner {
    background: var(--success-light);
    font-weight: 700;
}

/* ===== RECENT SEARCHES ===== */
.recent-section {
    margin: 40px 0;
}

.recent-section h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-white);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.recent-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.recent-item .reg {
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.recent-item .make {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== SEO SECTIONS ===== */
.seo-section {
    padding: 48px 0 32px;
}

.seo-section h2 {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 28px;
    color: var(--text);
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.seo-item {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.seo-item h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.seo-item p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.seo-footer-section {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 48px 0;
}

.seo-footer-section h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.seo-footer-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 24px;
    margin-bottom: 10px;
}

.seo-footer-section p {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 0.95rem;
    max-width: 800px;
}

/* ===== FOOTER ===== */
.footer {
    margin-top: auto;
    padding: 24px 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.footer a {
    color: var(--primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.6rem;
    }

    .hero-sub {
        font-size: 0.9rem;
    }

    .search-input-wrap {
        flex-direction: column;
    }

    .search-input-wrap .btn {
        border-radius: 0 0 var(--radius) var(--radius);
        justify-content: center;
    }

    .vehicle-header {
        flex-direction: column;
        text-align: center;
    }

    .vehicle-actions {
        width: 100%;
        justify-content: center;
    }

    .compare-grid {
        grid-template-columns: 1fr;
    }

    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .score-breakdown {
        gap: 16px;
    }

    .defect-summary {
        justify-content: center;
    }

    .recommendation-banner {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .details-grid {
        grid-template-columns: 1fr;
    }

    .header .container {
        flex-direction: column;
        height: auto;
        padding: 12px 20px;
        gap: 8px;
    }
}
