/* FreightParts.com — Main Stylesheet */

/* ============================================================
   Variables
   ============================================================ */
:root {
    --color-primary:   #1a4b8c;
    --color-primary-d: #123566;
    --color-accent:    #e8a020;
    --color-text:      #1c1c1c;
    --color-muted:     #666;
    --color-border:    #d0d5dd;
    --color-bg:        #f5f7fa;
    --color-white:     #fff;
    --color-success:   #1a7a3a;
    --color-error:     #c0392b;
    --color-error-bg:  #fdf0ef;

    --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;

    --radius: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,.08);
    --transition: 150ms ease;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: 2rem; margin-bottom: .75rem; }
h2 { font-size: 1.4rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1.1rem; margin: 1rem 0 .4rem; }

p { margin-bottom: .75rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: .75rem; }

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

/* ============================================================
   Layout
   ============================================================ */
.container       { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow{ max-width: 680px;  margin: 0 auto; padding: 0 1.5rem; }
.container-wide  { max-width: 1600px; margin: 0 auto; padding: 0 1.5rem; }

.site-main { flex: 1; padding: 2rem 0 4rem; }

/* ============================================================
   Header / Nav
   ============================================================ */
.site-header {
    background: var(--color-primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.site-header .container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding-top: .75rem;
    padding-bottom: .75rem;
}
.site-logo img { height: 40px; width: auto; filter: brightness(0) invert(1); }
.site-logo:hover { opacity: .85; }

.site-nav { flex: 1; }
.site-nav ul { list-style: none; padding: 0; margin: 0; display: flex; gap: .25rem; }
.site-nav a {
    display: block;
    padding: .4rem .8rem;
    color: rgba(255,255,255,.88);
    border-radius: var(--radius);
    font-size: .92rem;
    transition: background var(--transition);
}
.site-nav a:hover, .site-nav a.active { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }

.has-dropdown { position: relative; }
.has-dropdown .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-primary-d);
    border-radius: var(--radius);
    min-width: 180px;
    padding: .4rem 0;
    box-shadow: var(--shadow);
    list-style: none;
}
.has-dropdown:hover .dropdown { display: block; }
.has-dropdown .dropdown a { border-radius: 0; padding: .4rem 1rem; white-space: nowrap; }

.site-auth { display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.auth-name { color: rgba(255,255,255,.8); font-size: .88rem; }

.nav-toggle { display: none; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    background: #1a1a2e;
    color: rgba(255,255,255,.75);
    padding: 2.5rem 0 1.5rem;
    margin-top: auto;
    font-size: .9rem;
}
.site-footer a { color: rgba(255,255,255,.8); }
.site-footer a:hover { color: #fff; }

.footer-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-cols strong { display: block; color: #fff; margin-bottom: .5rem; }
.footer-cols ul { list-style: none; padding: 0; }
.footer-cols li { margin-bottom: .3rem; }
.footer-copy { border-top: 1px solid rgba(255,255,255,.1); padding-top: 1rem; font-size: .8rem; color: rgba(255,255,255,.5); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .55rem 1.2rem;
    border-radius: var(--radius);
    font-size: .95rem; font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    text-decoration: none !important;
    line-height: 1.3;
}
.btn-primary   { background: var(--color-accent); color: #1a1a2e; border-color: var(--color-accent); }
.btn-primary:hover { background: #d08c10; border-color: #d08c10; }
.btn-outline   { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.btn-outline:hover { background: rgba(255,255,255,.12); }
.btn-sm        { padding: .3rem .8rem; font-size: .85rem; }
.btn-lg        { padding: .75rem 1.75rem; font-size: 1.05rem; }
.btn-full      { width: 100%; }

/* On white backgrounds */
.btn-outline.on-light { color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline.on-light:hover { background: var(--color-primary); color: #fff; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
    position: relative;
    color: #fff;
    padding: 5rem 0 4.5rem;
    text-align: center;
    margin-bottom: 3rem;
    overflow: hidden;
}
/* Background image layers — each fades in/out in sequence */
.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    animation: heroCycle 32s infinite;
    opacity: 0;
}
.hero-bg:nth-child(1) { background-image: url('/assets/img/hero/truck.webp');                   animation-delay: 0s; }
.hero-bg:nth-child(2) { background-image: url('/assets/img/hero/WheelGarden.webp');             animation-delay: 8s; }
.hero-bg:nth-child(3) { background-image: url('/assets/img/hero/DraftSill.webp');               animation-delay: 16s; }
.hero-bg:nth-child(4) { background-image: url('/assets/img/hero/TruckMountedBrakeRigging.webp'); animation-delay: 24s; }
@keyframes heroCycle {
    0%       { opacity: 0; }
    5%       { opacity: 1; }
    25%      { opacity: 1; }
    30%      { opacity: 0; }
    100%     { opacity: 0; }
}
/* Dark overlay for legibility */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15,40,80,.72) 0%, rgba(10,30,65,.65) 100%);
    pointer-events: none;
}
.hero > .container {
    position: relative;
    z-index: 1;
}
.hero h1 { font-size: 2.25rem; color: #fff; margin-bottom: 1rem; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.hero-lead { font-size: 1.15rem; opacity: .92; max-width: 600px; margin: 0 auto 2rem; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   Feature / Tool Cards
   ============================================================ */
.feature-cards, .tool-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}
.feature-card, .tool-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none !important;
    color: var(--color-text);
    display: block;
    transition: box-shadow var(--transition), transform var(--transition);
}
.feature-card:hover, .tool-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.feature-card h2, .tool-card h2 { font-size: 1.1rem; color: var(--color-primary); margin-bottom: .4rem; }
.feature-card p, .tool-card p { font-size: .9rem; color: var(--color-muted); margin: 0; }
.feature-icon { font-size: 2rem; margin-bottom: .75rem; }

/* ============================================================
   CTA Register
   ============================================================ */
.cta-register {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    max-width: 560px;
    margin: 0 auto;
}
.cta-register h2 { margin-top: 0; }
.cta-or { margin: 0 .5rem; color: var(--color-muted); font-size: .9rem; }

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb { font-size: .88rem; color: var(--color-muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-primary); }

/* ============================================================
   Catalog Layout
   ============================================================ */
.catalog-layout { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; }

.catalog-sidebar { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.25rem; height: fit-content; }
.catalog-sidebar h2 { font-size: 1rem; margin-top: 0; }
.catalog-sidebar h3 { font-size: .9rem; margin-top: 1.25rem; }

fieldset { border: none; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: .5rem; }
fieldset ul { list-style: none; padding: 0; }
fieldset li { margin-bottom: .25rem; }
fieldset a { font-size: .9rem; color: var(--color-muted); }
fieldset a:hover, fieldset a.active { color: var(--color-primary); font-weight: 600; }

.input-group { display: flex; gap: .5rem; }
.input-group input { flex: 1; }

.results-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.results-header h1 { margin: 0; }
.results-count { color: var(--color-muted); font-size: .9rem; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.product-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none !important;
    color: var(--color-text);
    transition: box-shadow var(--transition);
}
.product-card:hover { box-shadow: var(--shadow); }
.product-image { aspect-ratio: 1; overflow: hidden; background: #f0f0f0; }
.product-image img { width: 100%; height: 100%; object-fit: contain; }
.product-info { padding: .75rem; }
.product-info h3 { font-size: .9rem; margin: 0 0 .3rem; }
.product-sku, .product-mfr { font-size: .8rem; color: var(--color-muted); }

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.category-card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.category-card > a { display: block; padding: 1.25rem; text-decoration: none; color: inherit; }
.category-card > a:hover h2 { color: var(--color-primary); }
.category-card-img { margin: -1.25rem -1.25rem .9rem; background: #f0f3f7; height: 140px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.category-card-img img { max-height: 120px; max-width: 90%; object-fit: contain; }
.category-card h2 { font-size: 1.05rem; margin-top: 0; }
.subcategory-list { list-style: none; padding: 0; margin-top: .5rem; }
.subcategory-list li { margin-bottom: .2rem; }
.subcategory-list a { font-size: .88rem; color: var(--color-muted); }

.subcategory-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .75rem;
    margin-bottom: 1.75rem;
}
.subcategory-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: .875rem 1rem;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--color-primary);
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.3;
    transition: background .15s, border-color .15s, color .15s;
}
.subcategory-tile:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* ============================================================
   Part Detail
   ============================================================ */
.part-detail .part-main { display: grid; grid-template-columns: 360px 1fr; gap: 2rem; }
.part-image { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: #fafafa; }
.part-meta, .attr-list { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .9rem; }
.part-meta dt, .attr-list dt { font-weight: 600; color: var(--color-muted); }
.retailer-list { list-style: none; padding: 0; }
.retailer-list li { margin-bottom: .35rem; }

/* ============================================================
   Tables
   ============================================================ */
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    background: var(--color-white);
}
.data-table th, .data-table td {
    padding: .55rem .75rem;
    border: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
}
.data-table th { background: #f0f4f8; font-weight: 600; white-space: nowrap; }
.data-table tbody tr:hover { background: #f8fafc; }
.dfc-code { font-family: var(--font-mono); font-size: 1rem; }

/* ============================================================
   Pairing Matrix
   ============================================================ */
.matrix-legend { margin-bottom: 1rem; font-size: .88rem; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.compat { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem; border-radius: 3px; font-weight: 700; font-size: .8rem; }
.compat-y { background: #d4edda; color: #155724; }
.compat-n { background: #f8d7da; color: #721c24; }
.compat-c { background: #fff3cd; color: #856404; }
.compat-x { background: #e9ecef; color: #6c757d; }

.matrix-scroll { overflow: auto; max-height: 80vh; }
.pairing-matrix { border-collapse: collapse; font-size: .78rem; }
.pairing-matrix th, .pairing-matrix td { border: 1px solid var(--color-border); padding: .3rem .4rem; }
.pairing-matrix .matrix-corner { background: #e9ecef; min-width: 80px; }
.pairing-matrix .matrix-col-head { background: #f0f4f8; text-align: center; font-family: var(--font-mono); font-size: .75rem; writing-mode: vertical-lr; white-space: nowrap; }
.pairing-matrix .matrix-row-head { background: #f0f4f8; font-family: var(--font-mono); font-size: .75rem; white-space: nowrap; }
.pairing-matrix .matrix-cell { text-align: center; cursor: default; }

.pairing-matrix td.compat-y { background: #d4edda; color: #155724; font-weight: 700; }
.pairing-matrix td.compat-n { background: #f8d7da; color: #721c24; font-weight: 700; }
.pairing-matrix td.compat-c { background: #fff3cd; color: #856404; font-weight: 700; }
.pairing-matrix td.compat-x { background: #f8f9fa; color: #aaa; }

.row-highlight { background-color: rgba(26,75,140,.06) !important; }
.col-highlight  { background-color: rgba(26,75,140,.06) !important; }

/* ============================================================
   DFC Filter
   ============================================================ */
.dfc-filter-form .filter-row { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; }
.filter-row { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; }
.filter-hint { margin-top: .75rem; font-size: .88rem; color: var(--color-muted); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.input-narrow { width: 56px; }
.input-dfc    { width: 100px; }
.input-medium { width: 120px; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .92rem; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .55rem .8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-white);
    transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26,75,140,.12);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-group-sm { margin-bottom: 0; }
.form-group-sm input,
.form-group-sm select { width: auto; }
.form-group-or { align-self: flex-end; padding-bottom: .6rem; color: var(--color-muted); font-size: .9rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: .83rem; color: var(--color-muted); margin-top: .3rem; margin-bottom: 0; }
.form-footer { text-align: center; font-size: .9rem; margin-top: 1rem; }
.align-end { display: flex; align-items: flex-end; gap: .5rem; padding-bottom: 0; }
.req { color: var(--color-error); }

/* Honeypot — visually hidden, off-screen */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
    aria-hidden: true;
}

/* ============================================================
   Alerts
   ============================================================ */
.alert { padding: .9rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .92rem; }
.alert ul { margin: 0; padding-left: 1.25rem; }
.alert-error   { background: var(--color-error-bg); border: 1px solid #f5c6cb; color: var(--color-error); }
.alert-success { background: #d4edda; border: 1px solid #b8ddc4; color: var(--color-success); }

/* ============================================================
   Empty States
   ============================================================ */
.empty-state { text-align: center; color: var(--color-muted); padding: 2.5rem; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; font-size: .92rem; }
.pagination a { color: var(--color-primary); }
.pagination-info { color: var(--color-muted); }

/* ============================================================
   Misc
   ============================================================ */
.lead { font-size: 1.1rem; color: var(--color-muted); margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.status-icon { font-size: 3rem; margin: 1.5rem 0 .75rem; }
.prose h2 { margin-top: 2rem; }
.prose h2:first-child { margin-top: 0; }

.product-list { display: flex; flex-direction: column; gap: .5rem; }
.product-list-item {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    text-decoration: none !important;
    color: var(--color-text);
    gap: 1rem;
}
.product-list-item:hover { border-color: var(--color-primary); }
.product-list-info { display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.product-list-meta { display: flex; gap: .75rem; font-size: .85rem; color: var(--color-muted); flex-shrink: 0; }
.product-aar, .product-cat { font-size: .82rem; color: var(--color-muted); }

.casting-types ul { list-style: none; padding: 0; display: flex; gap: .5rem; flex-wrap: wrap; }
.casting-types a { background: #e8eef5; color: var(--color-primary); padding: .3rem .7rem; border-radius: 20px; font-size: .88rem; }
.casting-types a:hover { background: var(--color-primary); color: #fff; text-decoration: none; }

.calc-results { margin-top: 2rem; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    h1 { font-size: 1.6rem; }
    .catalog-layout { grid-template-columns: 1fr; }
    .catalog-sidebar { order: 2; }
    .part-detail .part-main { grid-template-columns: 1fr; }
    .feature-cards, .tool-cards { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .footer-cols { grid-template-columns: 1fr 1fr; }
    .site-nav { display: none; }
    .nav-toggle { display: block; background: none; border: 1px solid rgba(255,255,255,.4); border-radius: 4px; padding: .3rem .5rem; cursor: pointer; }
    .nav-toggle span { display: block; width: 18px; height: 2px; background: #fff; margin: 3px 0; }
}

@media (max-width: 480px) {
    .hero { padding: 2.5rem 0 2rem; }
    .hero h1 { font-size: 1.4rem; }
    .footer-cols { grid-template-columns: 1fr; }
}
