@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

body {
    font-family: 'Roboto', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
}
header {
    background-color: #343a40;
    color: white;
    padding: 20px;
    text-align: center;
}
.main-nav {
    padding: 5px;
    font-size: 20px;
	font-weight: bold;
}
.main-nav a {
    color: white;
    margin: 0 10px;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
}
.main-nav a:hover,
.main-nav a.active {
    background-color: #495057;
}
.tagline {
    margin: 0;
    font-size: 1.1em;
    font-weight: 400;
}
.container {
    width: 90%;
    max-width: 1000px;
    margin: 20px auto;
}
.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.logo {
    display: flex;
    height: 115px;
    justify-content: center;
}

.contact-section {
    padding: 20px 0;
}

.contact-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
}

.contact-info {
    flex: 1 1 300px;
    font-size: 16px;
    line-height: 1.6;
}

.contact-info i {
    color: #c00;
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.contact-map {
    flex: 1 1 400px;
    min-width: 300px;
}

.contact-info a {
    color: #007BFF;
    text-decoration: none;
}

.contact-info a:hover {
    text-decoration: underline;
}

.car, .car-detail {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 3px;
    background: white;
    display: flex;
    gap: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow .3s;
    color: inherit;
    text-decoration: none;
}
.car:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.car-gallery {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
}
.car-gallery img {
    display: none;
    width: 300px;
    height: 225px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}
.car-gallery img:first-of-type {
    display: block;
}

.car-gallery .gallery-watermark {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    pointer-events: none;
    font-size: 0.9em;
}

.status-label {
    position: absolute;
    top: -10px;
    right: -15px;
    padding: 5px 40px;
    background: #28a745;
    color: #fff;
    font-weight: bold;
    font-size: 0.8em;
    text-transform: uppercase;
    transform-origin: top right;
    pointer-events: none;
}

.status-new-arrival {
    background: #28a745;
}
.status-sale {
    background: #e74c3c;
}
.status-sold {
    background: #6c757d;
}
.status-featured {
    background: #f39c12;
}
.status-low-mileage {
    background: #17a2b8;
}
.status-price-reduced {
    background: #6f42c1;
}
.car-detail .car-gallery {
    max-width: 600px;
}
.car-detail .car-gallery img {
    display: none;
    width: 600px;
    height: 510px;
}
.car-detail .car-gallery img:first-of-type {
    display: block;
}
.price {
    margin-left: auto;
    font-weight: bold;
    align-self: flex-start;
}

.car .price {
    font-size: x-large;
}

.car-detail .car-info {
    display: flex;
    flex-direction: column;
}

.car-detail .car-info .price {
    font-size: xx-large;
    margin-left: 0;
    margin-top: auto;
    align-self: flex-end;
}
.tax-info .has-tax {
    color: green;
}
.tax-info .no-tax {
    color: red;
}
.errors p {
    color: red;
    margin: 0 0 10px 0;
}
.car-info {
    flex: 1;
}

.car-description-box {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.car-tags {
    margin-top: 10px;
}

.car-tags .tag {
    display: inline-block;
    background: #f1f1f1;
    border-radius: 3px;
    padding: 4px 8px;
    margin: 0 5px 5px 0;
    font-size: 0.85em;
}
.car-details {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
}
.car-details li {
    margin-bottom: 4px;
}
.car-details i {
    margin-right: 4px;
    color: #555;
}
footer {
    background: #343a40;
    color: white;
    padding: 20px 0;
    text-align: center;
}
/* Admin panel layout */
.admin-nav {
    width: 220px;
    min-height: 100vh;
    background: #2c3e50;
    padding-top: 20px;
    position: fixed;
    top: 0;
    left: 0;
}
.admin-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.admin-nav li {
    margin: 0;
}
.admin-nav a {
    display: block;
    color: #ecf0f1;
    padding: 12px 20px;
    text-decoration: none;
    transition: background 0.3s;
}
.admin-nav a:hover {
    background: #34495e;
}
.admin-content {
    margin-left: 240px;
    padding: 30px;
}

.inventory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.sold-toggle-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.sold-toggle-form .sold-label {
    font-size: 0.9em;
    color: #555;
}

.admin-search-form {
    margin-bottom: 15px;
}

/* Form elements */
form input,
form select {
    padding: 8px;
    margin: 5px 0;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.admin-search-form input[type="text"] {
    width: auto;
    display: inline-block;
    margin-right: 5px;
}

.admin-search-form button {
    display: inline-block;
    margin-right: 5px;
}

button {
    padding: 10px 15px;
    background: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    margin: 5px 0;
}

button:hover {
    background: #0056b3;
}

.btn {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 4px;
    text-decoration: none;
    color: #fff;
    margin-right: 4px;
}

.btn:hover {
    opacity: 0.9;
}

.btn-add {
    background: #28a745;
}

.btn-edit {
    background: #007bff;
    margin-right: 8px;
    width: 80px;
    text-align: center;
}

.btn-delete {
    background: #dc3545;
    width: 80px;
    text-align: center;
}

.btn-sold {
    background: #ff8800;
    width: 80px;
    text-align: center;
}

/* Admin table styling */
.admin-content table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 4px;
    overflow: hidden;
}

.admin-content th,
.admin-content td {
    padding: 10px;
    border: 1px solid #dee2e6;
    text-align: left;
}

.admin-content th {
    background: #f1f1f1;
}

.admin-textarea {
    width: 100%;
    height: 94px;
}

.fetch-row {
    display: flex;
    gap: 8px;
}

.fetch-row input {
    flex: 1;
    width: auto;
}

.fetch-row button {
    flex: 0 0 120px;
}

.admin-image {
    position: relative;
    display: inline-block;
    margin: 5px;
}
.admin-image img {
    max-width: 200px;
    display: block;
}
.delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 0, 0, 0.8);
    color: #fff;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    text-decoration: none;
    font-weight: bold;
}
.set-main-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 123, 255, 0.8);
    color: #fff;
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 4px;
    text-decoration: none;
}
.enquiry-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.enquiry-form input[type="text"],
.enquiry-form input[type="email"] {
    width: calc(50% - 5px);
    padding: 10px;
    box-sizing: border-box;
}

.enquiry-form textarea {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    height: 120px;
    resize: vertical;
}

.enquiry-form button {
    margin-top: 10px;
    padding: 10px 20px;
    background-color: #333;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.enquiry-form .recaptcha-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.enquiry-form .recaptcha-wrapper button {
    margin-top: 0;
}

.section-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    font-weight: bold;
    font-size: 18px;
    color: #333;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid #ccc;
    margin: 0 15px;
}

.section-divider-header {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 15px 0;
    font-weight: bold;
    font-size: 18px;
    color: white;
}

.section-divider-header::before,
.section-divider-header::after {
    content: '';
    flex: 1;
    border-top: 1px solid #ccc;
    margin: 0 15px;
}


.search-form-container {
    width: 100%;
    padding: 18px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow .3s;
}

.side-panel {
    width: 350px;
    flex: 0 0 350px;
}

.recently-sold-container {
    width: 100%;
    padding: 18px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.recently-sold-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.recently-sold-item img {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 10px;
}

.stock-container {
    min-height: 150px;
    display: flex;
    gap: 20px;
    align-items: stretch;
    max-width: 1370px;
    width: 100%;
    margin: 20px auto;
}

.main-content {
    flex: 1;
}

.no-results {
    text-align: center;
    margin: 20px 0;
    font-weight: bold;
}

.gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
    cursor: pointer;
    z-index: 1000;
}
.gallery-overlay img {
    max-width: 90%;
    max-height: 90%;
}
.gallery-prev,
.gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 1.5em;
    padding: 0;
    cursor: pointer;
}
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }

.gallery-thumbs {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    justify-content: center;
}
.gallery-thumbs img {
    width: 60px;
    height: auto;
    opacity: 0.6;
    cursor: pointer;
    border: 2px solid transparent;
}
.gallery-thumbs img.active {
    opacity: 1;
    border-color: #007bff;
}

.search-description {
    text-align: center;
    margin-bottom: 5px;
    color: #555;
}

.search-form {
    text-align: center;
}

.search-form input[type="text"] {
    max-width: 300px;
}

.search-form select {
    max-width: 200px;
    margin-left: 10px;
}

.results-count {
    text-align: center;
    font-weight: bold;
    margin: 10px 0;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag-chip {
	color: #343a40;	
    padding: 6px 14px;
    border: 1px solid #ccc;
    border-radius: 20px;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    font-size: 14px;
    user-select: none;
}

.tag-chip.selected {
    background: #007BFF;
    color: #fff;
    border-color: #007BFF;
}

.pagination {
    margin: 20px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background-color: white;
    border-radius: 5px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow .3s;
}

.pagination .page-info {
    font-weight: bold;
}

.pagination .page-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.pagination .page-links a {
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.pagination .page-links a:hover:not(.current) {
    background: #f0f0f0;
}

.pagination .page-links a.current {
    background: #343a40;
    color: #fff;
    border-color: #343a40;
    display: inline-block;
}

/* Fallback visibility limits for numerous pages */
.pagination .page-links a:nth-of-type(n+13) {
    display: none;
}

.pagination .per-page-form {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.pagination .per-page-form label {
    margin-right: 5px;
    font-weight: 600;
}

.pagination .per-page-form select {
    padding: 4px 6px;
}

.ebay-ad {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f9f9f9;
    text-align: center;
}

.ebay-ad a {
    color: #0066c0;
    font-weight: bold;
    text-decoration: none;
}

.ebay-ad img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 10px;
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.slider.on {
    background-color: #4caf50;
}

.slider.off {
    background-color: #ccc;
}

input:checked + .slider {
    background-color: #4caf50;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Responsive styles */
@media (max-width: 1366px) {
    .stock-container {
        flex-direction: column;
        max-width: 100%;
    }
    .side-panel {
        display: contents;
    }
.search-form-container {
        order: -1;
        margin-left: 10px;
        margin-right: 10px;
        width: auto;
        margin-bottom: 0px;
    }
    .main-content {
        order: 0;
    }
    .recently-sold-container,
    .ebay-ad {
        order: 1;
        margin-left: 10px;
        margin-right: 10px;
        width: auto;
    }
    .car,
    .car-detail {
        margin-left: 10px;
        margin-right: 10px;
    }

    .results-count {
        margin: 10px 10px;
    }
    .recently-sold-container {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    .recently-sold-container h3 {
        flex-basis: 100%;
        margin-bottom: 10px;
		text-align: center;		
    }
    .recently-sold-item {
        width: calc(50% - 10px);
        margin-bottom: 0;
        box-sizing: border-box;
    }	
}

@media (max-width: 1280px) {
    .stock-container {
        flex-direction: column;
        max-width: 100%;
    }
    .side-panel {
        width: auto;
        flex: none;
        margin-left: 10px;
        margin-right: 10px;
    }
}

@media (max-width: 1024px) {
    .admin-nav {
        position: relative;
        width: 100%;
        min-height: auto;
        padding-top: 0;
        float: none;
    }
    .admin-nav ul {
        display: flex;
    }
    .admin-nav li {
        flex: 1;
    }
    .admin-nav a {
        text-align: center;
        padding: 10px;
    }
    .admin-content {
        margin-left: 0;
    }
    .car,
    .car-detail {
        flex-direction: column;
        text-align: center;
    }
    .car-gallery img {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
        object-fit: cover;
    }
    .car-detail .car-gallery {
        max-width: 100%;
    }
    .car-detail .car-gallery img {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }
    .price {
        margin-left: 0;
        margin-top: 10px;
        font-size: 1.4em;
        align-self: center;
    }
    .car-detail .car-info {
        display: block;
    }
    .car-detail .car-info .price {
        align-self: center;
    }
    .status-label {
        top: 3px;
        right: 3px;
        padding: 4px 30px;
        font-size: 1.0em;
    }
    .main-nav a {
        display: block;
        margin: 5px 0;
        padding: 15px;
    }
    .gallery-thumbs img {
        width: 50px;
    }
}

@media (max-width: 600px) {
    .admin-content .mileage-col {
        display: none;
    }
    .pagination .page-links a:nth-of-type(n+7) {
        display: none;
    }
    .pagination {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .enquiry-form .recaptcha-wrapper .g-recaptcha {
        transform: scale(0.75);
        transform-origin: left top;
        width: 228px;
        height: 58px;
    }
    .enquiry-form .recaptcha-wrapper button {
        height: 58px;
    }
}

@media (min-width: 600px) {
    .pagination {
        flex-direction: row;
        justify-content: center;
    }
    .pagination .per-page-form {
        margin-left: 20px;
    }
    .pagination .page-info {
        margin-right: 20px;
        margin-bottom: 0;
    }
}

.contact-details p {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 10px;
}

.contact-details i {
    color: #343a40;
    min-width: 20px;
    margin-top: 4px;
}

.visitor-counter {
    font-size: 14px;
    text-align: right;
    margin-top: 10px;
}
