/* Car Dealer Frontend Styles */

/* General Styles */
.car-archive-wrapper,
.single-car-wrapper {
    padding: 40px 0;
    background-color: #f8f9fa;
    min-height: 80vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Archive Header */
.archive-header {
    text-align: center;
    margin-bottom: 40px;
}

.archive-title {
    font-size: 2.5em;
    margin-bottom: 30px;
    color: #333;
}

/* Search Form */
.car-search-form-wrapper {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.search-field {
    display: flex;
    flex-direction: column;
}

.search-field label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
}

.search-field input,
.search-field select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-field input:focus,
.search-field select:focus {
    outline: none;
    border-color: #4CAF50;
}

.search-submit {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.button-search,
.button-reset {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.button-search {
    background-color: #4CAF50;
    color: white;
}

.button-search:hover {
    background-color: #45a049;
}

.button-reset {
    background-color: #f44336;
    color: white;
}

.button-reset:hover {
    background-color: #da190b;
}

/* Results Section */
.car-results {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.results-count {
    font-size: 1.2em;
    color: #666;
}

.sort-form select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

/* Cars Grid */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Car Card */
.car-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.car-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.car-card.featured {
    border: 2px solid #FFD700;
}

.featured-ribbon {
    position: absolute;
    top: 10px;
    right: -30px;
    background: #FFD700;
    color: #333;
    padding: 5px 40px;
    transform: rotate(45deg);
    font-weight: bold;
    font-size: 12px;
    z-index: 1;
}

.car-image {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.car-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
    font-size: 18px;
}

.car-info {
    padding: 20px;
}

.car-title {
    margin: 0 0 10px;
    font-size: 1.3em;
}

.car-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.car-title a:hover {
    color: #4CAF50;
}

.car-price {
    font-size: 1.5em;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 15px;
}

.car-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.spec-item {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.view-details {
    display: inline-block;
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.view-details:hover {
    background: #45a049;
}

/* Pagination */
.pagination {
    text-align: center;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 5px;
    border: 1px solid #ddd;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
}

.pagination a:hover {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.pagination .current {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Single Car Page */
.single-car-wrapper .featured-badge {
    display: inline-block;
    background: #FFD700;
    color: #333;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    margin-bottom: 20px;
}

.car-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.car-title {
    font-size: 2.5em;
    margin: 0;
    color: #333;
}

.price-amount {
    font-size: 2em;
    font-weight: bold;
    color: #4CAF50;
}

.car-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .car-content {
        grid-template-columns: 1fr;
    }
}

/* Gallery */
.car-gallery {
    position: relative;
}

.main-image {
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.main-image img {
    width: 100%;
    height: auto;
    display: block;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.thumbnail {
    cursor: pointer;
    border-radius: 5px;
    overflow: hidden;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.thumbnail.active,
.thumbnail:hover {
    opacity: 1;
}

.thumbnail img {
    width: 100%;
    height: 80px;
    object-fit: cover;
}

/* Details Grid */
.car-details h2,
.car-details h3 {
    color: #333;
    margin-bottom: 20px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.detail-label {
    font-weight: 600;
    color: #666;
}

.detail-value {
    color: #333;
}

/* Tax & MOT Info */
.tax-mot-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.info-grid {
    display: grid;
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-weight: 600;
    color: #666;
}

.status-valid {
    color: #4CAF50;
    font-weight: bold;
}

.status-expired {
    color: #f44336;
    font-weight: bold;
}

/* Description */
.car-description {
    margin-top: 30px;
}

.car-description p {
    line-height: 1.6;
    color: #555;
}

/* Navigation */
.car-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.nav-prev,
.nav-next {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.nav-prev:hover,
.nav-next:hover {
    color: #45a049;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results h2 {
    color: #666;
    margin-bottom: 10px;
}

/* Icons (using CSS pseudo-elements for simplicity) */
.icon-calendar::before { content: "📅 "; }
.icon-gauge::before { content: "🏁 "; }
.icon-fuel::before { content: "⛽ "; }
.icon-gear::before { content: "⚙️ "; }

/* Responsive Design */
@media (max-width: 1024px) {
    .cars-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .search-grid {
        grid-template-columns: 1fr;
    }
    
    .car-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .car-navigation {
        flex-direction: column;
        gap: 10px;
    }
}

/* Shortcode Styles */
.car-grid-shortcode,
.recent-cars-shortcode,
.featured-cars-shortcode {
    margin: 40px 0;
}

.car-grid-title,
.recent-cars-title,
.car-brands-title,
.car-stats-title,
.car-slider-title {
    font-size: 2em;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

/* Grid Columns */
.cars-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.cars-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.cars-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.cars-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.cars-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Car Brands */
.car-brands-grid {
    display: grid;
    gap: 20px;
    margin-top: 30px;
}

.car-brands-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.car-brands-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.car-brands-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

.brand-item {
    text-align: center;
    transition: transform 0.3s;
}

.brand-item:hover {
    transform: translateY(-5px);
}

.brand-link {
    display: block;
    padding: 30px 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.brand-link:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    background: #4CAF50;
    color: white;
}

.brand-name {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.brand-count {
    font-size: 0.9em;
    opacity: 0.7;
}

/* Car Stats */
.car-stats-shortcode {
    margin: 40px 0;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
    text-align: center;
}

.stat-item {
    background: white;
    padding: 30px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1em;
    color: #666;
}

/* Car Slider */
.car-slider-shortcode {
    margin: 40px 0;
    position: relative;
}

.car-slider-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.car-slider {
    display: flex;
    transition: transform 0.5s ease;
}

.slider-item {
    min-width: 100%;
    position: relative;
}

.slider-image {
    height: 400px;
    overflow: hidden;
    position: relative;
}

.slider-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slider-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 40px;
    text-align: center;
}

.slider-title {
    font-size: 2em;
    margin-bottom: 10px;
}

.slider-title a {
    color: white;
    text-decoration: none;
}

.slider-price {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #4CAF50;
}

.slider-button {
    display: inline-block;
    padding: 10px 30px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.slider-button:hover {
    background: #45a049;
}

.slider-prev,
.slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    padding: 20px;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.3s;
}

.slider-prev:hover,
.slider-next:hover {
    background: rgba(0,0,0,0.8);
}

.slider-prev {
    left: 20px;
}

.slider-next {
    right: 20px;
}

/* No cars found message */
.no-cars-found {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cars-grid.columns-3,
    .cars-grid.columns-4,
    .cars-grid.columns-5,
    .cars-grid.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .car-brands-grid.columns-4,
    .car-brands-grid.columns-5,
    .car-brands-grid.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .slider-content {
        padding: 20px;
    }
    
    .slider-title {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .cars-grid.columns-2,
    .cars-grid.columns-3,
    .cars-grid.columns-4,
    .cars-grid.columns-5,
    .cars-grid.columns-6 {
        grid-template-columns: 1fr;
    }
    
    .car-brands-grid.columns-4,
    .car-brands-grid.columns-5,
    .car-brands-grid.columns-6 {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Main image cursor */
.main-image {
    cursor: zoom-in;
}

/* Lightbox styles */
.car-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 30px;
    padding: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 5px;
}

/* Prevent body scroll when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}

/* Mobile adjustments for lightbox */
@media (max-width: 768px) {
    .lightbox-image {
        max-width: 100%;
        max-height: 80%;
    }
    
    .lightbox-prev,
    .lightbox-next {
        padding: 15px;
        font-size: 24px;
    }
    
    .lightbox-close {
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
}

/* Mobile Search Form Styles */
@media (max-width: 768px) {
    /* Make search form more compact on mobile */
    .car-search-form-wrapper {
        padding: 20px 15px;
        margin-bottom: 30px;
    }
    
    /* Two-column grid on mobile */
    .car-search-form .search-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 15px;
    }
    
    /* Make certain fields full width for better UX */
    .search-field:first-child {
        grid-column: 1 / -1; /* Keyword field spans full width */
    }
    
    /* Reduce padding and font sizes */
    .search-field label {
        font-size: 13px;
        margin-bottom: 3px;
        font-weight: 500;
    }
    
    .search-field input,
    .search-field select {
        padding: 8px 10px;
        font-size: 14px;
        height: 38px;
    }
    
    /* Compact submit buttons */
    .search-submit {
        display: flex;
        gap: 10px;
        margin-top: 15px;
    }
    
    .button-search,
    .button-reset {
        padding: 10px 20px;
        font-size: 14px;
        flex: 1;
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    .car-search-form-wrapper {
        padding: 15px 10px;
    }
    
    .car-search-form .search-grid {
        gap: 10px;
    }
    
    .search-field label {
        font-size: 12px;
    }
    
    .search-field input,
    .search-field select {
        padding: 6px 8px;
        font-size: 13px;
        height: 36px;
    }
    
    /* Stack buttons on very small screens */
    .search-submit {
        flex-direction: column;
    }
    
    .button-search,
    .button-reset {
        width: 100%;
        padding: 10px;
    }
}

/* Collapsible search form for mobile */
@media (max-width: 768px) {
    .search-toggle-btn {
        display: block;
        width: 110%;
        background: #4CAF50;
        color: white;
        padding: 12px 20px;
        margin: -20px -17px 20px;
        text-align: center;
        font-weight: bold;
        border: none;
        cursor: pointer;
        position: relative;
        font-size: 16px;
        transition: background 0.3s;
    }
    
    .search-toggle-btn:hover {
        background: #45a049;
    }
    
    .toggle-text {
        display: inline-block;
    }
    
    .toggle-icon {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 14px;
        transition: transform 0.3s;
    }
    
    /* Collapsed state */
    .car-search-form-wrapper.collapsed .car-search-form {
        display: none;
    }
    
    /* Remove extra spacing when collapsed */
    .car-search-form-wrapper.collapsed {
        padding-bottom: 0;
        margin-bottom: 20px;
    }
    
    .car-search-form-wrapper.collapsed .search-toggle-btn {
        margin-bottom: 0;
        border-radius: 10px;
    }
}

/* Hide toggle button on desktop */
@media (min-width: 769px) {
    .search-toggle-btn {
        display: none !important;
    }
    
    .car-search-form {
        display: block !important;
    }
}

/* Improve select dropdown appearance on mobile */
@media (max-width: 768px) {
    .search-field select {
        background-size: 12px 12px;
        background-position: right 8px center;
        padding-right: 28px;
    }
}

/* Make placeholder text shorter on mobile */
@media (max-width: 768px) {
    .search-field input[placeholder] {
        text-overflow: ellipsis;
    }
    
    #car_keyword {
        placeholder: "Search...";
    }
    
    #price_min::placeholder {
        content: "Min £";
    }
    
    #price_max::placeholder {
        content: "Max £";
    }
}

/* Ensure thumbnails are properly clickable */
.thumbnail {
    cursor: pointer;
    border-radius: 5px;
    overflow: hidden;
    opacity: 0.7;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.thumbnail:hover {
    opacity: 1;
    border-color: #4CAF50;
}

.thumbnail.active {
    opacity: 1;
    border-color: #4CAF50;
}

.thumbnail img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
    pointer-events: none; /* Prevent image from interfering with click */
}

/* Main image styles */
.main-image {
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    background: #f0f0f0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 500px;
    object-fit: contain;
}