/* ============================================
   CSS DESIGN SYSTEM — AUTOMOTIVE DARK THEME
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #161616;
    --bg-card-hover: #1c1c1c;
    --accent-red: #e63946;
    --accent-red-light: #ff4d5a;
    --accent-red-glow: rgba(230, 57, 70, 0.25);
    --accent-gold: #f4a261;
    --accent-gold-glow: rgba(244, 162, 97, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #9a9a9a;
    --text-muted: #555555;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-card: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.6);

    /* Typography */
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --container-padding: 16px;
    --section-gap: 48px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent-red);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-red-light);
}

/* ============================================
   TOP BAR
   ============================================ */

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    height: 56px;
}

.top-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 20px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent-red);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-toggle {
    display: flex;
    background: var(--glass-bg);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    overflow: hidden;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-btn.active {
    background: var(--accent-red);
    color: white;
}

.lang-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   LOADING SCREEN
   ============================================ */

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader {
    text-align: center;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-red);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

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

.loader-text {
    font-family: var(--font-heading);
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ============================================
   CAR LIST VIEW (Multi-car Landing)
   ============================================ */

.car-list-view {
    padding-top: 56px;
    min-height: 100vh;
}

.car-list-hero {
    text-align: center;
    padding: 60px var(--container-padding) 40px;
    background: linear-gradient(180deg, rgba(230, 57, 70, 0.08) 0%, transparent 100%);
}

.car-list-title {
    font-family: var(--font-heading);
    font-size: clamp(24px, 5vw, 40px);
    font-weight: 800;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.car-list-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.car-list-grid {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--container-padding) 60px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.car-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-smooth);
    text-decoration: none;
    color: inherit;
    display: block;
}

.car-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--accent-red);
}

.car-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.car-card-img-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #1a1a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    opacity: 0.3;
}

.car-card-body {
    padding: 20px;
}

.car-card-name {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.car-card-owner {
    font-size: 13px;
    color: var(--text-secondary);
}

.car-card-arrow {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-red);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    position: relative;
    height: 55vh;
    min-height: 350px;
    max-height: 500px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
    transition: transform 0.6s ease;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(10, 10, 10, 0.3) 0%,
        rgba(10, 10, 10, 0.6) 50%,
        rgba(10, 10, 10, 0.95) 85%,
        var(--bg-primary) 100%
    );
}

.hero-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 0 var(--container-padding) 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.back-link {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--accent-red);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(230, 57, 70, 0.15);
    border: 1px solid rgba(230, 57, 70, 0.3);
    border-radius: 20px;
    padding: 5px 14px;
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 3px;
    color: var(--accent-red-light);
    margin-bottom: 12px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-red);
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(28px, 7vw, 52px);
    font-weight: 900;
    letter-spacing: 3px;
    line-height: 1.1;
    margin-bottom: 10px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.hero-separator {
    color: var(--text-muted);
}

.hero-ig {
    color: var(--accent-gold);
}

.hero-ig-link {
    color: var(--accent-gold);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-bottom: 1px solid transparent;
}

.hero-ig-link:hover {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
    text-shadow: 0 0 8px var(--accent-gold-glow);
}

.hero-stripe {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent-red) 20%,
        var(--accent-gold) 50%,
        var(--accent-red) 80%,
        transparent 100%
    );
    z-index: 3;
}

/* ============================================
   CATEGORY NAVIGATION
   ============================================ */

.category-nav {
    position: sticky;
    top: 56px;
    z-index: 100;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 var(--container-padding);
}

.category-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 8px 0;
}

.category-nav-inner::-webkit-scrollbar {
    display: none;
}

.cat-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    cursor: pointer;
    background: none;
}

.cat-tab:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

.cat-tab.active {
    color: var(--accent-red-light);
    background: rgba(230, 57, 70, 0.1);
    border-color: rgba(230, 57, 70, 0.25);
}

.cat-icon {
    font-size: 16px;
}

/* ============================================
   PARTS CONTAINER
   ============================================ */

.parts-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--container-padding) var(--section-gap);
}

/* Category Section */
.category-section {
    padding-top: 40px;
    scroll-margin-top: 130px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.category-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-red) 0%, transparent 100%);
}

.category-line:last-child {
    background: linear-gradient(90deg, transparent 0%, var(--accent-red) 100%);
}

.category-header h2 {
    font-family: var(--font-heading);
    font-size: clamp(16px, 3vw, 22px);
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-primary);
    white-space: nowrap;
}

.category-count {
    font-family: var(--font-heading);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Parts Grid */
.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Part Card */
.part-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    overflow: hidden;
    transition: all var(--transition-smooth);
    animation: fadeInUp 0.5s ease both;
}

.part-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(230, 57, 70, 0.3);
}

.part-card.highlighted {
    border-color: var(--accent-red);
    box-shadow: 0 0 20px var(--accent-red-glow), 0 0 40px rgba(230, 57, 70, 0.1);
    animation: highlightPulse 2s ease-in-out;
}

@keyframes highlightPulse {
    0% { box-shadow: 0 0 0 rgba(230, 57, 70, 0); }
    30% { box-shadow: 0 0 30px var(--accent-red-glow), 0 0 60px rgba(230, 57, 70, 0.15); }
    100% { box-shadow: 0 0 20px var(--accent-red-glow), 0 0 40px rgba(230, 57, 70, 0.1); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.part-card-img-wrap {
    position: relative;
    width: 100%;
    padding-top: 60%;
    background: var(--bg-secondary);
    overflow: hidden;
}

.part-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-smooth);
}

.part-card:hover .part-card-img {
    transform: scale(1.05);
}

.part-card-img-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
}

.placeholder-icon {
    font-size: 32px;
    opacity: 0.2;
}

.placeholder-text {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.5;
}

.part-card-body {
    padding: 16px 18px;
}

.part-card-number {
    font-family: var(--font-heading);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.part-card-name {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.part-card-spec {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-gold);
    background: var(--accent-gold-glow);
    padding: 4px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.part-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 8px;
}

/* No image variant - compact card */
.part-card.no-image .part-card-img-wrap {
    display: none;
}

.part-card.no-image .part-card-body {
    padding: 14px 18px;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    margin-top: var(--section-gap);
    border-top: 1px solid var(--border-subtle);
}

.footer-stripe {
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent-red) 30%,
        var(--accent-gold) 50%,
        var(--accent-red) 70%,
        transparent 100%
    );
}

.footer-content {
    text-align: center;
    padding: 28px var(--container-padding);
}

.footer-powered {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.footer-powered strong {
    color: var(--text-secondary);
}

.footer-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================
   ERROR STATE
   ============================================ */

.error-state {
    text-align: center;
    padding: 80px var(--container-padding);
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.error-msg {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto 20px;
}

.error-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 24px;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.error-btn:hover {
    background: var(--accent-red-light);
    transform: translateY(-1px);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    :root {
        --container-padding: 14px;
    }

    .hero {
        height: 45vh;
        min-height: 300px;
    }

    .parts-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .part-card-body {
        padding: 12px 14px;
    }

    .part-card-name {
        font-size: 12px;
    }

    .part-card-spec {
        font-size: 11px;
        padding: 3px 8px;
    }

    .part-card-number {
        font-size: 9px;
    }

    .category-header h2 {
        font-size: 14px;
        letter-spacing: 3px;
    }
}

@media (max-width: 380px) {
    .parts-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1024px) {
    .parts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */

.fade-in {
    animation: fadeIn 0.6s ease both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.6s ease both;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
