.car-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.car-modal.show {
    opacity: 1;
}

.car-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 1200px;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.car-modal.show .car-modal-content {
    transform: translateY(0);
}

.car-modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    z-index: 1;
}

.car-modal-close:hover {
    color: #000;
}

.car-modal-gallery {
    position: relative;
    margin: -20px -20px 20px -20px;
    background: #f5f5f5;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.car-modal-gallery img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: block;
}

.car-modal-gallery img.active {
    opacity: 1;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: #333;
    transition: background 0.3s;
}

.gallery-nav:hover {
    background: rgba(255,255,255,1);
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

.car-modal-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.car-details h2 {
    margin: 0 0 15px;
    font-size: 24px;
}

.car-details .price {
    font-size: 22px;
    color: #333;
    margin-bottom: 20px;
}

.vehicle-specs {
    display: grid;
    gap: 10px;
    margin: 20px 0;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.spec-item .label {
    color: #666;
}

.car-description {
    margin-top: 7px;
    line-height: 1.6;
}

.car-contact {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.contact-buttons {
    margin-bottom: 20px;
}

form.eauto {
    padding-top: 5px;
    width: 100%;
    margin-bottom: 0;
    padding-bottom: 5px;
}

form.eauto input,
form.eauto textarea {
    margin-bottom: 4px;
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

form.eauto textarea {
    resize: vertical;
    height: 60px;
    min-height: 60px;
    font-family: inherit;
}

form.eauto .form-field {
    margin-bottom: 8px;
    position: relative;
}

form.eauto .form-row {
    display: flex;
    margin: 0 -4px;
    width: 100%;
}

form.eauto .form-field-half {
    width: 50%;
    padding: 0 4px;
    box-sizing: border-box;
}

form.eauto input[type="text"],
form.eauto input[type="email"],
form.eauto input[type="tel"] {
    height: 36px;
}

.eauto button {
    width: 100%;
    padding: 12px;
    color: rgba(0, 0, 0, 0.8);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.eauto button[type="submit"] {
    width: 100%;
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    margin-bottom: 0;
    margin-top: 5px;
    border-radius: 4px;
    font-weight: 500;
    height: 40px;
}

.car-contact-options form.eauto input:focus,
.car-contact-options form.eauto textarea:focus {
    border-color: #25d366;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
}

.car-contact-options form.eauto button:hover {
    background-color: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25);
}

/* Car modal overlay */
.car-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    /* Ensure the overlay doesn't affect the layout of cards */
    margin: 0;
    padding: 0;
}

.car-modal-overlay.active {
    display: flex;
}

.car-modal-content {
    background: white;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Gallery styling */
.car-modal-gallery {
    flex: 1;
    min-height: 60%;
    position: relative;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.car-modal-gallery img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: none;
    padding: 20px;
}

.car-modal-gallery img.active {
    display: block;
}

/* Description styling */
.car-modal-description {
    padding: 20px 30px;
    max-height: 40%;
    overflow-y: auto;
    border-top: 1px solid #eee;
}

.car-modal-description h4 {
    margin-top: 0;
    font-size: 18px;
    margin-bottom: 15px;
}

.car-modal-description .form-error {
    color: #d63638;
    font-size: 11px;
    margin-top: 1px;
    min-height: 14px;
    line-height: 1;
}

/* Close button */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1010;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.15s ease;
    color: #333;
    border: 1px solid rgba(0,0,0,0.1);
    padding: 0;
}

.close-x {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    width: 100%;
    height: 100%;
    text-align: center;
    font-weight: 300;
}

.modal-close:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

/* Button styling */
.expand-details-btn {
    display: block;
    width: 100%;
    background: #f0f0f0;
    border: none;
    padding: 8px;
    margin-top: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s ease;
    clear: both;
    position: relative;
    z-index: 103;
}

.expand-details-btn:hover {
    background: #e0e0e0;
}

/* Gallery navigation */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.9);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 28px;
    line-height: 0;
    z-index: 1005;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.15s ease;
    color: #333;
    border: 1px solid rgba(0,0,0,0.1);
    font-weight: 300;
    user-select: none;
}

.gallery-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.gallery-prev {
    left: 15px;
}

.gallery-next {
    right: 15px;
}

.offer_preview.expanded .car-description {
    display: block;
    padding: 15px;
    margin-top: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.offer_preview.expanded .car-gallery {
    display: block;
    margin: 15px 0;
    position: relative;
}

.offer_preview .car-gallery img {
    width: 100%;
    height: auto;
    display: none;
    border-radius: 4px;
    transition: opacity 0.3s ease;
}

.offer_preview .car-gallery img.active {
    display: block;
}

.expand-details-btn {
    display: block;
    width: auto;
    background: #f0f0f0;
    border: none;
    padding: 6px 12px;
    margin: 3px auto;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s ease;
    text-align: center;
    font-size: 0.9em;
}

.expand-details-btn:hover {
    background: #e0e0e0;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.7);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    z-index: 5;
    transition: background 0.3s ease;
}

.gallery-nav:hover {
    background: rgba(255,255,255,0.9);
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

.close-expanded {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}



/* Styling for vehicle specifications block */
.vehicle-specs-block {
    padding: 5px 15px;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 0.9em;
    line-height: 1.4em;
    position: relative;
    z-index: 1;
    width: 100%;
}

/* Dealer-only badge for export vehicles */
.dealer-only-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #e74c3c;
    color: white;
    padding: 4px 8px;
    font-size: 0.75em;
    font-weight: bold;
    border-radius: 0 0 0 4px;
    z-index: 2;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* No results message */
.no-results {
    padding: 30px 20px;
    text-align: center;
    font-size: 1.2em;
    color: #555;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 20px auto;
    max-width: 600px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.consumption-emissions {
    font-size: 0.85em;
    padding: 0 10px;
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
    line-height: 1.3;
    font-size: 0.75em;
    /* Position immediately after vehicle specs */
    order: 2;
    display: block; /* Use block instead of flex to maintain top alignment */
}

.car-permalink {
    padding: 5px 15px;
    text-align: right;
    font-size: 12px;
}

.car-permalink a {
    color: #666;
    text-decoration: none;
}

.car-permalink a:hover {
    text-decoration: underline;
}

.vehicle-specs-block small {
    display: block;
    margin: 0;
    font-size: 0.85em;
    background: transparent;
}

/* Position content at the top of the card */
/* Car card grid layout */
.offer_wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}

.offer_wrapper.mobile {
    flex-direction: row;
}

/* Make cards take up appropriate width based on screen size */
.offer_wrapper .offer_preview {
    width: calc(33.33% - 14px); /* 3 cards per row minus gap space */
    margin-bottom: 20px;
}

/* Responsive layout for tablets */
@media (max-width: 992px) {
    .offer_wrapper .offer_preview {
        width: calc(50% - 10px); /* 2 cards per row on medium screens */
    }
}

/* Responsive layout for mobile */
@media (max-width: 576px) {
    .offer_wrapper {
        flex-direction: column;
    }

    .offer_wrapper .offer_preview {
        width: 100%; /* Full width on small screens */
    }
}

.offer_preview {
    position: relative;
    display: flex;
    flex-direction: column;
    padding-top: 0;
    margin-top: 0;
    gap: 5px; /* Add consistent gap between elements */
    justify-content: flex-start; /* Align items at the top */
    height: 100%; /* Ensure all cards have the same height */
    align-items: stretch; /* Stretch items horizontally */
}

/* AJAX loading indicator and messages */
.loading-indicator {
    text-align: center;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    font-weight: 500;
    color: #333;
}

.no-results {
    text-align: center;
    padding: 30px;
    background-color: #f8f8f8;
    border-radius: 5px;
    border: 1px solid #ddd;
    color: #555;
    font-weight: 500;
}

.error-message {
    text-align: center;
    padding: 20px;
    background-color: #fff0f0;
    border: 1px solid #ffcaca;
    border-radius: 5px;
    color: #d63638;
    font-weight: 500;
}

.offer_preview .price {
    margin-top: -5px;
}

/* Tighten up spacing between elements */
.offer_preview .vehicle-specs-block {
    margin-top: 0;
    padding-top: 5px;
    margin-bottom: 5px;
    padding-bottom: 0;
}

.offer_preview .teaser {
    margin-top: 5px;
    padding-top: 0;
    margin-bottom: 5px;
    padding-bottom: 0;
    overflow: auto; /* Allow scrolling for longer descriptions */
    display: block; /* Use block instead of flex to maintain top alignment */
}

.offer_preview .info-item {
    margin-top: 10px;
}

/* Car contact options styling */
.car-contact-options {
    padding: 10px 15px;
    border-top: 1px solid #e1e1e1;
    margin-top: auto; /* Push to bottom of card */
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
    position: relative; /* Ensure proper positioning */
    z-index: 100; /* Increased to ensure clicks work */
    background-color: #fff; /* Match card background */
    pointer-events: auto; /* Ensure clicks pass through */
    width:100%
}



.car-contact-options .button_detail {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: #25D366;
    color: white;
    font-weight: 600;
    height: fit-content;
    box-shadow: 0 2px 5px rgba(37, 211, 102, 0.3);
    transition: all 0.2s ease;
    gap: 8px;
}

.car-contact-options a.button_wa {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex: 1 1 auto;
    background-color: #25d366;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    width: 100% !important;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(37, 211, 102, 0.3);
    gap: 8px;
}

.offer_preview .modell {
    font-size: 24px;
}

.offer_preview .variant {
    font-size: 24px;
    min-height: 50px
}

.offer_preview a {
    flex-direction: unset !important;
    pointer-events: auto;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.car-contact-options .button_detail svg,
.car-contact-options a.button_wa svg {
    margin-right: 8px;
    flex-shrink: 0;
}

.car-contact-options form.eauto {
    flex: 2;
    min-width: 300px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.car-contact-options form.eauto input,
.car-contact-options form.eauto textarea {
    width: 100%;
    margin-bottom: 8px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9em;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.car-contact-options form.eauto button {
    background-color: #4a4a4a;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    margin-top: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.car-contact-options form.eauto button:hover {
    background-color: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25);
}



@media (max-width: 768px) {
    .car-modal-content {
        width: 95%;
        margin: 2% auto;
    }

    .car-modal-info {
        grid-template-columns: 1fr;
    }

    .car-contact-options {
        flex-direction: column;
    }

    .car-contact-options .button_detail {
        width: 100%;
        margin-bottom: 15px;
    }
}

/* Success and error messages */
.success-message {
    padding: 10px 15px;
    margin: 10px 0;
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    border-radius: 4px;
    font-weight: 500;
    position: fixed;
    top: 50px;
    left: 50px;
    z-index: 1000;
    transition: opacity 0.5s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.error-message {
    padding: 10px 15px;
    margin: 10px 0;
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
    border-radius: 4px;
    font-weight: 500;
    position: fixed;
    top: 50px;
    left: 50px;
    z-index: 1000;
    transition: opacity 0.5s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.form-toggle {
    display: none;
    width: 100%
}

/* Form validation styling */
.form-error {
    color: #d63638;
    font-size: 0.7em;
    margin: 5px 0;
    height: 0;
    overflow: hidden;
    line-height: 1;
    display: block;
    transition: all 0.2s;
}

.form-error:not(:empty) {
    height: auto;
    margin-top: 3px;
}

input.error, textarea.error {
    border-color: #d63638 !important;
    background-color: rgba(214, 54, 56, 0.03);
}

/* Enhanced form styling */
.inquiry-form-container {
    padding: 12px;
}

.contact-methods {
    margin-bottom: 15px;
    margin: 0 12px;
}

.button_wa {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #25d366;
    color: white;
    text-decoration: none;
    padding: 10px;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button_wa:hover {
    background-color: #1fb655;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.inquiry-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.contact-heading {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

/* Car inquiry form styling */
form.eauto {
    padding: 0;
}

form.eauto .form-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

form.eauto .form-field-half {
    flex: 1;
}

form.eauto .form-field {
    margin-bottom: 8px;
    position: relative;
    width: 100%;
}

/* Form inputs */
form.eauto input,
form.eauto textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    background-color: white;
    box-sizing: border-box;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

form.eauto input[type="text"],
form.eauto input[type="email"],
form.eauto input[type="tel"] {
    height: 38px;
}

form.eauto .form-error {
    color: #d63638;
    margin-left: 0;
    padding: 0
}

form.eauto input:focus,
form.eauto textarea:focus {
    border-color: #25d366;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37,211,102,0.2);
}

form.eauto textarea {
    height: 80px;
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.4;
    padding-top: 9px;
    padding-bottom: 9px;
}

form.eauto button[type="submit"] {
    width: 100%;
    background-color: #25d366; /* WhatsApp green to match theme */
    color: white;
    border: none;
    padding: 12px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

form.eauto button[type="submit"]:hover {
    background-color: #1fb655;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

form.eauto button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
