/* --- Global Styles & Resets --- */
:root {
    --color-dark: #121212;
    --color-light: #f4f4f9;
    --color-primary: #007bff; /* Modern Blue */
    --color-secondary: #2a2a2a; /* Dark Gray for cards/surfaces */
    --color-text-light: #e0e0e0;
    --color-text-muted: #a0a0a0;
    --color-border: #333;
    --font-main: 'Inter', sans-serif;
    --shadow-elevation-1: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-elevation-2: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--color-dark);
    color: var(--color-text-light);
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #4da6ff;
}

/* --- Typography & Headings --- */
h1, h2, h3, h4 {
    font-weight: 700;
    margin-bottom: 0.5em;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
}
h2 {
    font-size: 2rem;
}
h3 {
    font-size: 1.5rem;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.8rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background-color: var(--color-primary);
    margin: 0.5rem auto 0;
    border-radius: 2px;
}

/* --- Buttons --- */
button, .btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center;
}

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

.btn-primary:hover {
    background-color: #0056b3;
    box-shadow: var(--shadow-elevation-2);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
    background-color: var(--color-primary);
    color: var(--color-light);
    box-shadow: var(--shadow-elevation-1);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 1.2rem;
    padding: 8px;
}

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

.btn-large {
    padding: 12px 30px;
    font-size: 1.1rem;
}

/* --- Header & Navigation --- */
.header {
    background-color: rgba(18, 18, 18, 0.95); /* Slightly transparent dark background */
    backdrop-filter: blur(5px);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo a {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-light);
}

.main-nav {
    display: flex;
    gap: 25px;
}

.nav-link {
    color: var(--color-text-muted);
    font-weight: 400;
    padding: 5px 0;
    position: relative;
}

.nav-link.active, .nav-link:hover {
    color: var(--color-light);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--color-primary);
    border-radius: 2px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Hero Section --- */
.hero {
    background: var(--color-secondary);
    padding: 80px 0;
    text-align: center;
    overflow: hidden;
    position: relative;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    text-align: center;
}

.hero h2 {
    font-size: 3.5rem;
    color: var(--color-light);
    max-width: 800px;
    margin-bottom: 0.3em;
}

.hero p {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    max-width: 700px;
    margin-bottom: 1.5rem;
}

.search-bar {
    display: flex;
    max-width: 600px;
    margin: 20px auto;
}

.search-bar input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid var(--color-border);
    background-color: var(--color-dark);
    color: var(--color-light);
    border-radius: 6px 0 0 6px;
    font-size: 1rem;
}

.search-bar input[type="text"]:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

.search-bar button {
    border-radius: 0 6px 6px 0;
    height: 46px;
}

.stats {
    margin-top: 20px;
    display: flex;
    gap: 30px;
    justify-content: center;
    color: var(--color-text-muted);
}

.graphic-element {
    font-size: 150px;
    color: var(--color-primary);
    opacity: 0.1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

/* --- Featured Categories --- */
.featured-categories {
    padding: 60px 0;
}

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

.category-card {
    background-color: var(--color-secondary);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--color-primary);
    box-shadow: var(--shadow-elevation-1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
    box-shadow: var(--shadow-elevation-2);
    transform: translateY(-5px);
}

.category-card h4 {
    margin-bottom: 5px;
    color: var(--color-primary);
}

.category-card p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* --- Vendor Showcase --- */
.vendor-showcase {
    padding: 80px 0;
    background-color: #1c1c1c;
}

.vendor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.vendor-card {
    background-color: var(--color-dark);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    text-align: center;
    transition: all 0.3s ease;
}

.vendor-logo {
    width: 60px;
    height: 60px;
    background-color: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 15px;
    font-size: 1.5rem;
    font-weight: 700;
}

.vendor-card h4 {
    color: var(--color-light);
    font-weight: 600;
}

.rating {
    color: gold;
    margin-bottom: 10px;
}

.vendor-card p {
    color: var(--color-text-muted);
    margin-bottom: 15px;
}

.text-center {
    text-align: center;
}

/* --- Browse Page Specific Styles --- */
.page-header {
    text-align: center;
    padding: 40px 0 30px;
}

.marketplace-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    padding-bottom: 60px;
}

.sidebar {
    background-color: var(--color-secondary);
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 100px; /* Below header */
}

.filter-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border);
}

.filter-group h5 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--color-primary);
}

.filter-select, .sort-by {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    background-color: var(--color-dark);
    color: var(--color-light);
    border: 1px solid var(--color-border);
    margin-bottom: 10px;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li a {
    display: block;
    padding: 4px 0;
    color: var(--color-text-muted);
}

.sidebar ul li a:hover {
    color: var(--color-light);
    padding-left: 5px;
}

.btn-apply-filter {
    width: 100%;
    margin-top: 10px;
}

.product-list {
    min-height: 60vh;
}

.sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--color-secondary);
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

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

.part-card {
    background-color: var(--color-secondary);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-elevation-1);
    transition: all 0.3s ease;
}

.part-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #333;
}

.part-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.part-info h5 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: var(--color-light);
    font-weight: 600;
}

.vendor-name {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 5px;
}

.price {
    font-size: 1.4rem;
    color: var(--color-primary);
    font-weight: 700;
    margin-top: auto;
    margin-bottom: 10px;
}

.part-card .btn-add-to-cart {
    width: 100%;
    padding: 8px;
}

.pagination {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.btn-page-nav {
    background-color: var(--color-secondary);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-page-nav.active {
    background-color: var(--color-primary);
    color: var(--color-light);
    border-color: var(--color-primary);
}

.btn-page-nav:hover:not(.active):not(.disabled) {
    background-color: #2e2e2e;
}

.btn-page-nav.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Vendor Directory Page Specific Styles --- */
.vendor-directory {
    padding-bottom: 60px;
}

.vendor-grid-full {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.vendor-card-full {
    background-color: var(--color-secondary);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow-elevation-1);
    border-left: 5px solid var(--color-primary);
    transition: all 0.3s ease;
}

.vendor-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 20px;
}

.vendor-logo.large {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

.vendor-card-full h3 {
    margin-bottom: 5px;
}

.vendor-tags {
    margin: 15px 0;
}

.vendor-tags span {
    display: inline-block;
    background-color: #282828;
    color: var(--color-text-muted);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-right: 5px;
    margin-bottom: 5px;
}

.margin-top-lg { margin-top: 40px; }

/* --- Footer --- */
.footer {
    background-color: #0d0d0d;
    padding: 40px 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #222;
}

.footer h4 {
    color: var(--color-light);
    margin-bottom: 10px;
}

.footer ul {
    list-style: none;
}

.footer ul li {
    margin-bottom: 5px;
}

.footer ul a {
    color: var(--color-text-muted);
}

.copyright {
    text-align: center;
    padding-top: 20px;
    font-size: 0.85rem;
}

/* --- Animations (Figma-Level Polish) --- */

/* Fade In Up */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

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

/* Fade In */
.fade-in {
    opacity: 0;
    animation: fadeIn 1s forwards;
}

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

/* Fade In Left */
.fade-in-left {
    opacity: 0;
    transform: translateX(-20px);
    animation: fadeInLeft 0.6s forwards;
}

@keyframes fadeInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hover Effects */
.hover-scale:hover {
    transform: scale(1.03);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 6px 6px rgba(0, 123, 255, 0.1);
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .hero h2 {
        font-size: 2.5rem;
    }

    .marketplace-layout {
        grid-template-columns: 1fr; /* Stack sidebar above content */
        gap: 30px;
    }

    .sidebar {
        position: static; /* Remove sticky behavior on smaller screens */
    }

    .vendor-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
        justify-content: center;
    }
    .logo {
        flex-basis: 100%;
        text-align: center;
        margin-bottom: 15px;
    }
    .main-nav {
        flex-basis: 100%;
        justify-content: center;
        margin-bottom: 15px;
        gap: 15px;
    }
    .user-actions {
        width: 100%;
        justify-content: center;
    }
    
    .hero-content {
        padding: 40px 0;
    }
    .hero h2 {
        font-size: 2rem;
    }
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .category-grid {
        grid-template-columns: 1fr 1fr;
    }

    .vendor-card-full {
        padding: 20px;
    }
    .vendor-header {
        flex-direction: column;
        text-align: center;
    }
    .vendor-logo.large {
        margin: 0 auto 10px;
    }
}

@media (max-width: 576px) {
    .search-bar {
        flex-direction: column;
    }
    .search-bar input[type="text"] {
        border-radius: 6px 6px 0 0;
    }
    .search-bar button {
        border-radius: 0 0 6px 6px;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .part-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .footer ul {
        padding: 0;
    }
    .main-nav {
        gap: 10px;
        flex-wrap: wrap;
    }
    .nav-link { 
        padding: 5px 3px;
        font-size: 0.9rem;
    }
}


/* Karbon Sites Branding */

  #karbon-promo-banner {
      position: fixed;
      bottom: 10px;
      right: 10px;
      background-color: rgba(0, 0, 0, 0.8);
      color: white;
      padding: 8px 16px;
      border-radius: 8px;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
      font-size: 14px;
      z-index: 10000;
      display: flex;
      align-items: center;
      gap: 10px;
      text-decoration: none;
      box-shadow: 0 4px 6px rgba(0,0,0,0.1);
      transition: transform 0.2s ease-in-out;
  }
  #karbon-promo-banner:hover {
      transform: scale(1.05);
  }
