/* ============================================================
   Hartford Auto Vehicles — Gallery & Frontend Styles
   ============================================================ */

/* --- Vehicle Gallery --- */
.hav-vehicle-gallery {
    margin: 0 0 2.5rem;
}

.hav-gallery-main {
    position: relative;
    background: #111;
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.hav-gallery-slide {
    display: none;
    position: absolute;
    inset: 0;
}

.hav-gallery-slide.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hav-gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hav-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,.6);
    color: #fff;
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    padding: .1em .4em;
    cursor: pointer;
    z-index: 5;
    transition: background .2s;
    border-radius: 2px;
}
.hav-gallery-nav:hover { background: rgba(0,0,0,.85); }
.hav-gallery-prev { left: 8px; }
.hav-gallery-next { right: 8px; }

.hav-gallery-counter {
    position: absolute;
    bottom: 10px;
    right: 12px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: .8rem;
    padding: 3px 10px;
    border-radius: 20px;
}

.hav-lightbox-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,.5);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}
.hav-gallery-main:hover .hav-lightbox-btn { opacity: 1; }
.hav-lightbox-btn svg { width: 18px; height: 18px; }

.hav-gallery-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.hav-gallery-thumb {
    flex: 0 0 80px;
    height: 60px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 3px;
    overflow: hidden;
    opacity: .65;
    transition: opacity .2s, border-color .2s;
}
.hav-gallery-thumb.active,
.hav-gallery-thumb:hover { opacity: 1; border-color: var(--hpa-red, #c0392b); }
.hav-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* --- Lightbox --- */
.hav-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}
.hav-lightbox.open { display: flex; }
.hav-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.92);
}
.hav-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 92vw;
    max-height: 90vh;
}
.hav-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border-radius: 4px;
}
.hav-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

/* --- Inventory Grid --- */
.hav-inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 24px 0;
}
.hav-cols-2 { grid-template-columns: repeat(2, 1fr); }
.hav-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .hav-inventory-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .hav-inventory-grid { grid-template-columns: 1fr; }
}

/* --- Vehicle Card --- */
.hav-vehicle-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.hav-vehicle-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.hav-card-image-link { display: block; }
.hav-card-image {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #f0f0f0;
}
.hav-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.hav-vehicle-card:hover .hav-card-image img { transform: scale(1.03); }
.hav-no-photo {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #aaa;
    gap: 8px;
    font-size: .85rem;
}
.hav-no-photo svg { width: 40px; height: 40px; }

.hav-card-body { padding: 16px; }

.hav-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
}
.hav-card-title a { color: inherit; text-decoration: none; }
.hav-card-title a:hover { color: var(--hpa-red, #c0392b); }
.hav-trim { font-weight: 400; color: #666; font-size: .9em; }

.hav-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: .82rem;
    color: #555;
    margin-bottom: 8px;
}
.hav-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.hav-card-meta svg { width: 13px; height: 13px; }

.hav-stock { font-size: .78rem; color: #999; margin: 4px 0; }

.hav-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.hav-price {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--hpa-red, #c0392b);
}
.hav-price-call { font-size: 1rem; font-weight: 700; color: #555; }

/* Badges */
.hav-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 3px;
}
.hav-badge-featured { background: var(--hpa-red, #c0392b); color: #fff; }
.hav-badge-sold { background: #333; color: #fff; left: auto; right: 12px; }
.hav-badge-pending { background: #e67e22; color: #fff; left: auto; right: 12px; }

.hav-sold .hav-card-image { filter: grayscale(.7); }
.hav-sold .hav-price::after { content: ' (Sold)'; font-size: .7em; }

/* --- Buttons --- */
.hav-btn {
    display: inline-block;
    padding: .55em 1.3em;
    border-radius: 4px;
    font-weight: 700;
    font-size: .88rem;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .2s;
    text-align: center;
}
.hav-btn-primary {
    background: var(--hpa-red, #c0392b);
    color: #fff;
    border-color: var(--hpa-red, #c0392b);
}
.hav-btn-primary:hover {
    background: #a93226;
    border-color: #a93226;
    color: #fff;
}
.hav-btn-ghost {
    background: transparent;
    color: var(--hpa-dark, #1a1a2e);
    border-color: #ccc;
}
.hav-btn-ghost:hover {
    border-color: var(--hpa-red, #c0392b);
    color: var(--hpa-red, #c0392b);
}
.hav-btn-sm { padding: .4em 1em; font-size: .82rem; }

/* --- Filter Bar --- */
.hav-filter-bar {
    background: var(--hpa-dark, #1a1a2e);
    padding: 20px 24px;
    border-radius: 6px;
    margin-bottom: 28px;
}
.hav-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.hav-filter-select,
.hav-filter-input {
    background: rgba(255,255,255,.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 4px;
    padding: 9px 14px;
    font-size: .875rem;
    flex: 1 1 160px;
    min-width: 120px;
    transition: border-color .2s;
}
.hav-filter-select option { background: #1a1a2e; }
.hav-filter-select:focus,
.hav-filter-input:focus {
    outline: none;
    border-color: var(--hpa-red, #c0392b);
}
.hav-filter-input::placeholder { color: rgba(255,255,255,.5); }

/* --- Specs Table --- */
.hav-vehicle-specs,
.hav-vehicle-features {
    margin: 2rem 0;
}
.hav-specs-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
}
.hav-specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}
.hav-specs-table tr:nth-child(odd) { background: #f8f8f8; }
.hav-specs-table th {
    text-align: left;
    padding: 9px 14px;
    font-weight: 600;
    color: #444;
    width: 40%;
    border-bottom: 1px solid #eee;
}
.hav-specs-table td {
    padding: 9px 14px;
    color: #222;
    border-bottom: 1px solid #eee;
}
.hav-features-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.hav-features-list li::before {
    content: '✓ ';
    color: var(--hpa-red, #c0392b);
    font-weight: 700;
}

/* --- Finance Calculator --- */
.hav-finance-calc {
    background: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 28px;
    margin: 2rem 0;
}
.hav-finance-calc h3 { margin: 0 0 20px; font-size: 1.25rem; }
.hav-calc-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}
.hav-calc-field label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}
.hav-calc-field input,
.hav-calc-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: .9rem;
    box-sizing: border-box;
}
.hav-calc-result {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
    text-align: center;
}
.hav-calc-monthly {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}
.hav-calc-monthly span {
    font-size: 3rem;
    font-weight: 800;
    color: var(--hpa-red, #c0392b);
}
.hav-calc-monthly small { color: #888; font-size: .9rem; }
.hav-calc-breakdown {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: .88rem;
    color: #555;
}
.hav-calc-disclaimer { font-size: .78rem; color: #999; margin-top: 12px; }

/* --- Loading Spinner --- */
.hav-loading {
    text-align: center;
    padding: 40px;
    color: #888;
}
.hav-spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid #eee;
    border-top-color: var(--hpa-red, #c0392b);
    border-radius: 50%;
    animation: hav-spin .7s linear infinite;
    margin-bottom: 12px;
}
@keyframes hav-spin { to { transform: rotate(360deg); } }

/* --- Pagination --- */
.hav-pagination {
    margin: 32px 0 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.hav-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: .875rem;
    transition: all .2s;
}
.hav-pagination .current,
.hav-pagination .page-numbers:hover {
    background: var(--hpa-red, #c0392b);
    color: #fff;
    border-color: var(--hpa-red, #c0392b);
}

.hav-no-results-wrap { grid-column: 1/-1; text-align: center; padding: 40px 0; color: #888; }
