/* ================================================================
   AutoTrader Vehicle Detail Page - Structural Layout Only
   All visual styles inherit from the active theme.
   Colors customisable via AutoTrader > Settings > Appearance.
   CSS variables (--ats-*) are set via admin color pickers.
   ================================================================ */

/* ===== Theme Title Hiding ===== */
body.ats-vehicle-detail .wp-block-post-title,
body.ats-vehicle-detail .entry-title,
body.ats-vehicle-detail .page-title,
body.ats-vehicle-detail h1.wp-block-post-title,
body.ats-vehicle-detail .ast-title-container,
body.ats-vehicle-detail .page-header,
body.ats-vehicle-detail .entry-header .entry-title,
body.ats-vehicle-detail .site-main > article > .entry-header,
body.ats-vehicle-detail .hentry > .entry-header > .entry-title,
body.ats-vehicle-detail .wp-block-post-featured-image {
    display: none !important;
}

/* ===== Container ===== */
.atd-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 20px 60px;
    width: 100%;
}

.atd-container *, .atd-container *::before, .atd-container *::after {
    box-sizing: border-box;
}

/* ===== Breadcrumb ===== */
.atd-breadcrumb {
    font-size: 0.85em;
    opacity: 0.6;
    margin-bottom: 16px;
}

.atd-breadcrumb a {
    color: var(--ats-link-color, inherit);
    text-decoration: none;
}

.atd-breadcrumb a:hover { text-decoration: underline; }

.atd-sep { margin: 0 6px; }

/* ===== Page Header ===== */
.atd-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 20px;
}

.atd-title {
    margin: 0 0 4px;
    font-size: 1.6em;
    font-weight: 700;
}

.atd-subtitle {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.6;
}

.atd-price {
    font-size: 1.7em;
    font-weight: 800;
    color: var(--ats-price-color, inherit);
    white-space: nowrap;
}

/* ===== Main Layout ===== */
.atd-main {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: flex-start;
}

.atd-left { min-width: 0; }

/* ===== Gallery ===== */
.atd-gallery {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.atd-gallery-main {
    position: relative;
    cursor: pointer;
}

.atd-gallery-main img {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    display: block;
}

.atd-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.atd-gallery-prev { left: 12px; }
.atd-gallery-next { right: 12px; }

.atd-gallery-counter {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.atd-view-gallery-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(255,255,255,0.92);
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 3;
}

/* Thumbnail Strip */
.atd-thumbs {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
    border-top: 1px solid #eee;
}

.atd-thumb {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.atd-thumb:hover { opacity: 0.8; }

.atd-thumb.active {
    opacity: 1;
    border-color: var(--ats-primary-color, currentColor);
}

/* ===== Gallery Grid Modal ===== */
.atd-grid-modal {
    position: fixed;
    z-index: 999999;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Offset for WP admin bar when logged in */
.admin-bar .atd-grid-modal {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .atd-grid-modal {
        top: 46px;
    }
}

.atd-grid-modal-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.atd-grid-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: #fff;
    border: 1px solid #ddd;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.admin-bar .atd-grid-close {
    top: 48px;
}

@media (max-width: 782px) {
    .admin-bar .atd-grid-close {
        top: 62px;
    }
}

.atd-grid-tabs {
    text-align: center;
    padding: 16px 0 20px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.atd-grid-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 2px solid #ddd;
    border-radius: 24px;
    background: transparent;
    font-size: inherit;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: inherit;
}

.atd-grid-tab:hover {
    border-color: var(--ats-primary-color, currentColor);
}

.atd-grid-tab.active {
    background: var(--ats-primary-color, #333);
    border-color: var(--ats-primary-color, #333);
    color: var(--ats-button-text-color, #fff);
}

.atd-tab-count {
    font-size: 0.85em;
    font-weight: 400;
    opacity: 0.8;
}

.atd-grid-count {
    font-size: 0.9em;
    opacity: 0.6;
    font-weight: 600;
}

.atd-grid-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.atd-grid-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.atd-grid-item:first-child {
    grid-column: 1 / -1;
}

.atd-grid-item:first-child img {
    max-height: 500px;
}

.atd-grid-item:not(:first-child) {
    height: 250px;
}

.atd-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.atd-grid-item:hover img { transform: scale(1.03); }

.atd-grid-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
}

/* ===== Fullscreen Lightbox ===== */
.atd-lightbox {
    position: fixed;
    z-index: 9999999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
}

.atd-lb-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    padding: 8px;
}

.atd-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.atd-lb-prev { left: 20px; }
.atd-lb-next { right: 20px; }

.atd-lb-image-wrap {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.atd-lb-image-wrap img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.atd-lb-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
}

/* ===== Details Section ===== */
.atd-details-section {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.atd-details-section h2 {
    margin: 0 0 18px;
    font-size: 1.25em;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

/* Specs Grid */
.atd-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.atd-spec-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.atd-spec-icon {
    width: 20px;
    text-align: center;
    color: var(--ats-primary-color, inherit);
    font-size: 16px;
    flex-shrink: 0;
}

.atd-spec-label {
    display: block;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.5;
}

.atd-spec-value {
    display: block;
    font-size: 0.9em;
    font-weight: 600;
}

.atd-strapline {
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 12px;
}

.atd-description {
    font-size: 0.9em;
    line-height: 1.7;
    opacity: 0.8;
}

/* ===== Enquiry Card ===== */
.atd-right {
    position: sticky;
    top: 20px;
}

.atd-enquiry-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
}

.atd-enquiry-card h2 {
    margin: 0 0 6px;
    font-size: 1.1em;
    font-weight: 700;
}

.atd-enquiry-vehicle {
    font-size: 0.85em;
    opacity: 0.6;
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.atd-form-group {
    margin-bottom: 16px;
}

.atd-form-group label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 6px;
}

.atd-form-group label i {
    opacity: 0.5;
    width: 16px;
    margin-right: 4px;
}

.atd-form-group input,
.atd-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    outline: none;
}

.atd-form-group input:focus,
.atd-form-group textarea:focus {
    border-color: var(--ats-primary-color, #333);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}

.atd-btn-enquiry {
    width: 100%;
    padding: 12px 20px;
    background: var(--ats-button-color, #333);
    color: var(--ats-button-text-color, #fff);
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.atd-btn-enquiry:hover {
    opacity: 0.9;
}

.atd-btn-enquiry:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.atd-form-result {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.9em;
}

.atd-form-result.success {
    background: #d4edda;
    color: #155724;
}

.atd-form-result.error {
    background: #f8d7da;
    color: #721c24;
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
    .atd-main { grid-template-columns: 1fr; }
    .atd-right { position: static; }
    .atd-specs-grid { grid-template-columns: 1fr 1fr; }
    .atd-header { flex-direction: column; gap: 8px; }
}

@media (max-width: 640px) {
    .atd-specs-grid { grid-template-columns: 1fr; }
    .atd-gallery-main img { max-height: 300px; }
    .atd-title { font-size: 1.3em; }
    .atd-price { font-size: 1.4em; }
    .atd-grid-images { grid-template-columns: 1fr; }
}
