/**
 * DealerHub Vehicles Pro - Detail Page Styles
 * Single vehicle detail page layout and components
 */

/* ========================================
   BREADCRUMB NAVIGATION
   ======================================== */

.dh-breadcrumb {
    margin-bottom: 2rem;
    padding: 0;
}

.dh-breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0 !important;
    padding: 0 !important;
}

.dh-breadcrumb-item {
    display: inline-flex !important;
    margin: 0 !important;
    padding: 0 !important;
}

.dh-breadcrumb-link {
    color: var(--dh-primary-color);
    text-decoration: none;
    transition: color var(--dh-transition-base);
}

.dh-breadcrumb-link:hover {
    color: var(--dh-primary-hover);
    text-decoration: underline;
}

.dh-breadcrumb-separator {
    color: var(--dh-text-secondary);
    user-select: none;
}

.dh-breadcrumb-current {
    color: var(--dh-text-primary);
    font-weight: 500;
}

/* ========================================
   DETAIL PAGE CONTAINER
   ======================================== */

.dh-vehicle-detail {
    width: 100%;
    /* FIXED: Removed max-width: 80% and margin: 0 auto which broke the theme header.
     * The inner .dh-container handles centering and max-width constraints.
     * This outer wrapper must be full-width to not affect #header or #footer. */
    max-width: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--dh-main-bg, var(--dh-bg-primary));
    box-sizing: border-box;
}

/* ========================================
   DETAIL HEADER
   ======================================== */

.dh-vehicle-detail-header {
    margin-bottom: var(--dh-spacing-xl);
}

.dh-vehicle-detail-title {
    font-size: var(--dh-font-size-4xl);
    font-weight: 700;
    color: var(--dh-heading-color);
    margin: 0 0 8px 0;
    line-height: var(--dh-line-height-tight);
}

.dh-vehicle-detail-subtitle {
    font-size: var(--dh-font-size-xl);
    color: var(--dh-text-secondary);
    margin: 0 0 16px 0;
}

/* Uses the Styling page's "Accent Color (Price, Highlights)" control, matching
   the admin styling preview. Falls back to the primary colour if unset. */
.dh-vehicle-detail-price {
    font-size: var(--dh-font-size-3xl);
    font-weight: 700;
    color: var(--dh-accent-color, var(--dh-primary-color));
    margin: 0;
}

/* ========================================
   DETAIL LAYOUT
   ======================================== */

.dh-vehicle-detail-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--dh-spacing-xl);
    margin-bottom: var(--dh-spacing-xl);
}

@media (min-width: 1024px) {
    .dh-vehicle-detail-layout {
        grid-template-columns: 3fr 1fr;
    }
}

.dh-vehicle-detail-main {
    min-width: 0;
}

.dh-vehicle-detail-sidebar {
    position: relative;
}

@media (min-width: 1024px) {
    .dh-vehicle-detail-sidebar {
        position: sticky;
        top: 20px;
        align-self: start;
    }
}

/* ========================================
   IMAGE GALLERY
   ======================================== */

.dh-vehicle-gallery {
    margin-bottom: var(--dh-spacing-xl);
}

.dh-vehicle-gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: var(--dh-image-aspect-ratio, 16 / 9);
    background-color: var(--dh-bg-tertiary);
    border-radius: var(--dh-card-radius);
    overflow: hidden;
    margin-bottom: var(--dh-spacing-md);
}

.dh-vehicle-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Driven by the "Vertical Image Position" control on the Styling page. */
    object-position: var(--dh-image-position-x, center) var(--dh-image-position-y, 50%);
}

.dh-vehicle-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.dh-vehicle-gallery-nav-prev {
    left: 16px;
}

.dh-vehicle-gallery-nav-next {
    right: 16px;
}

.dh-vehicle-gallery-nav button {
    width: 48px;
    height: 48px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--dh-transition-base);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dh-vehicle-gallery-nav button:hover {
    background-color: var(--dh-primary-color);
    color: var(--dh-text-white);
    transform: scale(1.1);
}

/* Thumbnail strip */
.dh-vehicle-gallery-thumbs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px;
    scrollbar-width: thin;
}

.dh-vehicle-gallery-thumb {
    flex-shrink: 0;
    width: 100px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all var(--dh-transition-base);
}

.dh-vehicle-gallery-thumb:hover {
    border-color: var(--dh-primary-color);
    opacity: 0.8;
}

.dh-vehicle-gallery-thumb.active {
    border-color: var(--dh-primary-color);
}

.dh-vehicle-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   SPECIFICATIONS SECTION
   ======================================== */

.dh-vehicle-specs {
    background-color: var(--dh-section-bg, var(--dh-bg-secondary));
    border-radius: var(--dh-card-radius);
    padding: var(--dh-spacing-xl);
    margin-bottom: var(--dh-spacing-xl);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.dh-vehicle-specs-title {
    font-size: var(--dh-font-size-2xl);
    font-weight: 700;
    color: var(--dh-heading-color);
    margin: 0 0 var(--dh-spacing-lg) 0;
    text-align: center;
}

.dh-vehicle-specs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--dh-spacing-md);
}

@media (min-width: 640px) {
    .dh-vehicle-specs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dh-vehicle-spec-item {
    background-color: var(--dh-attr-bg);
    border: 1px solid var(--dh-attr-border);
    border-radius: var(--dh-attr-radius);
    padding: var(--dh-attr-padding);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    transition: all var(--dh-transition-base);
    min-width: 0;
    box-sizing: border-box;
}

.dh-vehicle-spec-item:hover {
    border-color: var(--dh-primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.dh-vehicle-spec-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dh-vehicle-spec-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.dh-vehicle-spec-label {
    font-size: var(--dh-font-size-sm);
    color: var(--dh-attr-label-color);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dh-vehicle-spec-value {
    font-size: var(--dh-font-size-base);
    color: var(--dh-attr-value-color);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   DESCRIPTION SECTION
   ======================================== */

.dh-vehicle-description {
    background-color: var(--dh-section-bg, var(--dh-card-bg));
    border: 1px solid var(--dh-card-border);
    border-radius: var(--dh-card-radius);
    padding: var(--dh-spacing-xl);
    margin-bottom: var(--dh-spacing-xl);
}

.dh-vehicle-description-title {
    font-size: var(--dh-font-size-2xl);
    font-weight: 700;
    color: var(--dh-heading-color);
    margin: 0 0 var(--dh-spacing-md) 0;
}

.dh-vehicle-description-content {
    font-size: var(--dh-font-size-base);
    color: var(--dh-text-primary);
    line-height: var(--dh-line-height-relaxed);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.dh-vehicle-description-content p {
    margin: 0 0 var(--dh-spacing-md) 0;
}

.dh-vehicle-description-content p:last-child {
    margin-bottom: 0;
}

/* Description intro paragraph (before list) */
.dh-vehicle-description-content .description-intro {
    margin-bottom: var(--dh-spacing-md);
    font-size: var(--dh-font-size-base);
    line-height: var(--dh-line-height-relaxed);
}

/* JavaScript-generated features list */
.dh-vehicle-description-content .dealerhub-features-list {
    list-style: none;
    padding: 0;
    margin: var(--dh-spacing-md) 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--dh-spacing-sm);
}

.dh-vehicle-description-content .dealerhub-features-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background-color: var(--dh-attr-bg);
    border: 1px solid var(--dh-attr-border);
    border-radius: 8px;
    transition: all var(--dh-transition-base);
    color: var(--dh-text-primary);
}

.dh-vehicle-description-content .dealerhub-features-list li:hover {
    border-color: var(--dh-primary-color);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dh-vehicle-description-content .dealerhub-features-list li::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: var(--dh-primary-color);
    color: #ffffff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 0;
    line-height: 1;
}

/* ========================================
   FEATURES LIST
   ======================================== */

.dh-vehicle-features {
    background-color: var(--dh-card-bg);
    border: 1px solid var(--dh-card-border);
    border-radius: var(--dh-card-radius);
    padding: var(--dh-spacing-xl);
    margin-bottom: var(--dh-spacing-xl);
}

.dh-vehicle-features-title {
    font-size: var(--dh-font-size-2xl);
    font-weight: 700;
    color: var(--dh-heading-color);
    margin: 0 0 var(--dh-spacing-lg) 0;
}

.dh-vehicle-features-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--dh-spacing-sm);
}

.dh-vehicle-feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    font-size: var(--dh-font-size-base);
    color: var(--dh-text-primary);
}

.dh-vehicle-feature-icon {
    width: 20px;
    height: 20px;
    color: var(--dh-primary-color);
    flex-shrink: 0;
}

/* ========================================
   CONTACT CARD (SIDEBAR)
   ======================================== */

.dh-vehicle-contact-card {
    background-color: var(--dh-card-bg);
    border: 2px solid var(--dh-primary-color);
    border-radius: var(--dh-card-radius);
    padding: var(--dh-spacing-lg);
    box-shadow: var(--dh-card-shadow);
}

.dh-vehicle-contact-title {
    font-size: var(--dh-font-size-xl);
    font-weight: 700;
    color: var(--dh-heading-color);
    margin: 0 0 var(--dh-spacing-md) 0;
    text-align: center;
}

.dh-vehicle-contact-info {
    display: flex;
    flex-direction: column;
    gap: var(--dh-spacing-md);
    margin-bottom: var(--dh-spacing-lg);
}

.dh-vehicle-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--dh-bg-secondary);
    border-radius: 8px;
}

.dh-vehicle-contact-icon {
    width: 24px;
    height: 24px;
    color: var(--dh-primary-color);
    flex-shrink: 0;
}

.dh-vehicle-contact-text {
    font-size: var(--dh-font-size-base);
    color: var(--dh-text-primary);
    font-weight: 500;
}

.dh-vehicle-contact-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ========================================
   WORDPRESS THEME COMPATIBILITY
   ======================================== */

.dh-vehicle-detail * {
    box-sizing: border-box;
}

/* NOTE: These selectors are intentionally NOT applying max-width: 80%
 * because the Motors theme renders the detail page directly in #main,
 * not inside .entry-content or .post-content. The inner .dh-container
 * handles all centering and max-width constraints. */
.entry-content .dh-vehicle-detail,
.post-content .dh-vehicle-detail,
.site-content .dh-vehicle-detail,
.content-area .dh-vehicle-detail {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Ensure parent containers don't restrict width */
body.dealerhub-vehicle-detail-page .entry-content,
body.dealerhub-vehicle-detail-page .post-content,
body.dealerhub-vehicle-detail-page .site-content,
body.dealerhub-vehicle-detail-page .content-area,
body.dealerhub-vehicle-detail-page main,
body.dealerhub-vehicle-detail-page article {
    max-width: 100% !important;
    width: 100% !important;
}

/* Additional theme overrides for common themes */
/* FIXED: Removed .container from this selector - it was overriding the Motors theme
 * header's .container class, setting it to max-width: 100% and padding: 0,
 * which pushed the header menu to the left.
 * Only target content-area containers, NOT the theme's structural .container. */
body.dealerhub-vehicle-detail-page .site-main,
body.dealerhub-vehicle-detail-page #primary,
body.dealerhub-vehicle-detail-page #content,
body.dealerhub-vehicle-detail-page .ast-container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Protect Motors theme header containers from being overridden */
body.dealerhub-vehicle-detail-page #header .container,
body.dealerhub-vehicle-detail-page .header-main .container,
body.dealerhub-vehicle-detail-page #top-bar .container {
    max-width: 1140px !important;
    width: auto !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* For very large screens, cap at reasonable width */
@media (min-width: 1920px) {
    .entry-content .dh-vehicle-detail,
    .post-content .dh-vehicle-detail {
        max-width: 1600px !important;
    }
}

.dh-vehicle-detail h1,
.dh-vehicle-detail h2,
.dh-vehicle-detail h3 {
    border: none !important;
    background: none !important;
    padding: 0 !important;
}

.dh-vehicle-detail img {
    max-width: 100% !important;
    height: auto !important;
    margin: 0 !important;
}


/* ============================================
   DESCRIPTION FEATURE LIST WITH CHECKMARKS
   ============================================ */

/* Run-in heading above a spec list ("Specification Highlights" and the like),
   lifted out of the surrounding prose by DealerHub_Description. */
.dh-description-heading {
    font-size: var(--dh-font-size-lg);
    font-weight: 700;
    color: var(--dh-heading-color);
    margin: 1.5rem 0 0.5rem 0;
}

/* Styled bullet lists with checkmarks */
.dh-feature-list {
    list-style: none;
    padding-left: 0;
    margin: 1rem 0;
}

.dh-feature-list li {
    padding: 0.5rem 0;
    display: flex;
    align-items: flex-start;
}

.dh-checkmark {
    color: var(--dh-primary-color, #f97316);
    font-weight: bold;
    margin-right: 0.75rem;
    font-size: 1.2em;
    flex-shrink: 0;
}

/* Alternative: CSS-only checkmarks for regular ul/li */
.dh-vehicle-description-content ul:not(.dh-feature-list) {
    list-style: none;
    padding-left: 0;
}

.dh-vehicle-description-content ul:not(.dh-feature-list) li {
    padding-left: 2rem;
    position: relative;
    margin-bottom: 0.75rem;
}

.dh-vehicle-description-content ul:not(.dh-feature-list) li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--dh-primary-color, #f97316);
    font-weight: bold;
    font-size: 1.2em;
}


/* ============================================
   BREADCRUMB NAVIGATION
   ============================================ */

.dh-breadcrumb {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.dh-breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0.5rem;
}

.dh-breadcrumb-item {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
    list-style: none !important;
    list-style-type: none !important;
}

.dh-breadcrumb-link {
    color: var(--dh-primary-color, #f97316);
    text-decoration: none;
    transition: color 0.2s ease;
}

.dh-breadcrumb-link:hover {
    color: var(--dh-secondary-color, #dc2626);
    text-decoration: underline;
}

.dh-breadcrumb-separator {
    color: #9ca3af;
    margin: 0 0.25rem;
    user-select: none;
}

.dh-breadcrumb-current {
    color: #374151;
    font-weight: 500;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
    .dh-breadcrumb {
        margin-bottom: 1rem;
    }
    
    .dh-breadcrumb-item,
    .dh-breadcrumb-link {
        font-size: 0.8125rem;
    }
}

/* ============================================
   SHOWCASE DETAIL LAYOUT
   Gallery left, key facts and actions in a right rail, matching the layout
   dealers coming from a Motors-style listing theme expect. Selected with the
   Detail Layout setting; the Standard layout above is untouched.
   ============================================ */

.dh-detail-showcase .dh-showcase-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--dh-spacing-xl);
    margin-bottom: var(--dh-spacing-xl);
    align-items: start;
}

@media (min-width: 1024px) {
    .dh-detail-showcase .dh-showcase-layout {
        /* Gallery takes a little over half, so the spec table stays readable. */
        grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr);
    }
}

.dh-detail-showcase .dh-showcase-gallery {
    min-width: 0;
}

.dh-detail-showcase .dh-showcase-info {
    min-width: 0;
}

.dh-detail-showcase .dh-showcase-title {
    font-size: var(--dh-font-size-3xl);
    font-weight: 700;
    color: var(--dh-heading-color);
    margin: 0 0 8px 0;
    line-height: var(--dh-line-height-tight);
}

.dh-detail-showcase .dh-showcase-meta {
    font-size: var(--dh-font-size-base);
    color: var(--dh-text-secondary);
    margin: 0 0 16px 0;
}

.dh-detail-showcase .dh-showcase-price {
    font-size: var(--dh-font-size-3xl);
    font-weight: 700;
    color: var(--dh-accent-color, var(--dh-primary-color));
    margin: 0 0 20px 0;
}

/* Spec table */
.dh-detail-showcase .dh-showcase-specs {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: var(--dh-attr-bg);
    border: 1px solid var(--dh-attr-border);
    border-radius: var(--dh-card-radius);
    overflow: hidden;
}

.dh-detail-showcase .dh-showcase-specs tr:nth-child(even) {
    background-color: var(--dh-section-bg, var(--dh-bg-secondary));
}

.dh-detail-showcase .dh-showcase-specs th,
.dh-detail-showcase .dh-showcase-specs td {
    padding: 10px 16px;
    text-align: left;
    font-size: var(--dh-font-size-sm);
    vertical-align: top;
}

.dh-detail-showcase .dh-showcase-specs th {
    width: 45%;
    font-weight: 600;
    color: var(--dh-attr-label-color);
}

.dh-detail-showcase .dh-showcase-specs td {
    color: var(--dh-attr-value-color);
}

/* Actions */
.dh-detail-showcase .dh-showcase-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Sections below the fold */
.dh-detail-showcase .dh-showcase-section {
    margin-bottom: var(--dh-spacing-xl);
}

.dh-detail-showcase .dh-showcase-section-title {
    font-size: var(--dh-font-size-2xl);
    font-weight: 700;
    color: var(--dh-heading-color);
    margin: 0 0 var(--dh-spacing-md) 0;
}

/* Feature list, three columns on desktop */
.dh-detail-showcase .dh-showcase-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px 24px;
}

@media (min-width: 640px) {
    .dh-detail-showcase .dh-showcase-features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .dh-detail-showcase .dh-showcase-features {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.dh-detail-showcase .dh-showcase-features li {
    position: relative;
    padding-left: 20px;
    font-size: var(--dh-font-size-sm);
    color: var(--dh-text-primary);
    line-height: var(--dh-line-height-relaxed);
}

.dh-detail-showcase .dh-showcase-features li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--dh-primary-color);
}

/* Related listings reuse the standard vehicle card. */
.dh-detail-showcase .dh-showcase-related {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--dh-spacing-md);
}

@media (min-width: 640px) {
    .dh-detail-showcase .dh-showcase-related {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .dh-detail-showcase .dh-showcase-related {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
