/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Site Header Styles */
.site-header {
    text-align: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.site-logo {
    max-height: 80px;
    width: auto;
    max-width: 90%;
}

/* Page Header Container for Title and Back Link */
.page-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.page-header-container .page-title,
.page-header-container .car-detail-title-main {
    margin-bottom: 0;
    text-align: left;
    font-size: 2.2em;
}

/* Styles for car_details.php title block and variant subtitle */
.page-header-container .title-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-grow: 1;
}
.car-detail-variant-subtitle {
    font-size: 1.2em;
    color: #555;
    margin-top: -5px;
    margin-bottom: 10px;
    font-weight: normal;
    line-height: 1.3;
}


.page-header-container .back-link {
    margin-bottom: 0;
    white-space: nowrap;
    margin-left: 20px;
}

/* Style for the checkbox in the header (e.g., "Mark as SOLD") */
.page-header-container .header-status-field {
    display: flex;
    align-items: center;
    margin-left: 20px;
    padding: 5px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #f8f9fa;
    white-space: nowrap;
}
.page-header-container .header-status-field label {
    margin: 0 0 0 5px;
    font-weight: bold;
    cursor: pointer;
    color: #dc3545; /* Red color for "SOLD" emphasis */
    font-size: 0.9em;
}
.page-header-container .header-status-field input[type="checkbox"] {
    vertical-align: middle;
    cursor: pointer;
    margin: 0;
}


.container {
    width: 90%;
    max-width: 1200px; /* General max-width for admin panel, index.php */
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.container.form-container { /* For add_car.php, edit_opening_hours.php */
    max-width: 800px; 
}
/* For edit_car.php and add_car.php (using this class now for add_car too) */
.container.edit-car-container {
    max-width: 1100px; /* Wider for two-column layout */
}

.container.login-container {
    max-width: 450px;
    margin-top: 50px;
}


.container.details-container { /* For car_details.php */
    max-width: 960px;
}

h1, h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

h1.page-title { /* General page title styling */
    text-align: center;
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 2.5em;
}


a {
    color: #29836f; /* Primary link color */
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: #000000; /* Darker hover for links */
}

/* Navigation / Links Bar */
.nav-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
}
.nav-group-left, .nav-group-right {
    display: flex;
    align-items: center;
}
.nav-links a {
     margin: 0;
}
.nav-group-left a, .nav-group-right a {
    margin-right: 15px;
    padding: 8px 12px;
    border-radius: 4px;
    display: inline-block;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-group-left a:last-child, .nav-group-right a:last-child {
    margin-right: 0;
}
.nav-separator {
    color: #ccc;
    margin: 0 10px;
    font-weight: bold;
}
.nav-links a.logout { background-color: #dc3545; color: white; }
.nav-links a.logout:hover { background-color: #c82333; color: white; text-decoration:none; }
.nav-links a.add-new { background-color: #28a745; color: white; }
.nav-links a.add-new:hover { background-color: #218838; color: white; text-decoration:none; }
.nav-links a.settings-link { background-color: #ffc107; color: #212529; }
.nav-links a.settings-link:hover { background-color: #e0a800; color: #000000; text-decoration:none; }
.nav-links a.nav-to-frontpage { background-color: #e9ecef; color: #495057; }
.nav-links a.nav-to-frontpage:hover { background-color: #dee2e6; color: #000000; text-decoration:none; }

/* Styles for index.php nav links */
.nav-links a.nav-to-contact, /* Though contact link was removed from index.php nav, style kept for potential reuse */
.nav-links a.nav-to-admin,
.nav-links a.nav-to-login {
    background-color: #e9ecef;
    color: #495057;
}
.nav-links a.nav-to-contact:hover,
.nav-links a.nav-to-admin:hover,
.nav-links a.nav-to-login:hover {
    background-color: #dee2e6;
    color: #000000;
    text-decoration: none;
}


/* Back Link for Forms and Details Page */
.back-link {
    display: inline-block;
    padding: 10px 15px;
    border-radius: 4px;
    background-color: #28826f; 
    color: white;
    font-size: 0.95em;
}
.back-link:hover {
    background-color: #000000; 
    color: white;
    text-decoration: none;
}


/* Forms - General Fallback Styles */
form label { 
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

form input[type="text"],
form input[type="number"],
form input[type="url"],
form input[type="password"],
form input[type="email"],
form input[type="file"],
form select,
form textarea { 
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}

form input[type="password"].password-input-field,
form input[type="text"].password-input-field { 
    padding-right: 38px !important; 
}


form textarea {
    min-height: 120px;
    resize: vertical;
}

form input[type="submit"] { 
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    width: 100%;
    margin-top: 20px;
}
/* Specific submit button types */
form input[type="submit"].add-button { /* Used by old add_car, potentially other places */
    background-color: #28a745; 
}
form input[type="submit"].add-button:hover {
    background-color: #218838;
}
form input[type="submit"].update-button { /* Used for edit_opening_hours */
    background-color: #29836f; 
}
form input[type="submit"].update-button:hover {
    background-color: #000000; 
    color: #FFFFFF;
}
form input[type="submit"].login-button {
    background-color: #29836f;  
}
form input[type="submit"].login-button:hover {
    background-color: #000000;
    color: #FFFFFF;
}


/* Status and Error Messages */
.status-message,
.error-message {
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid transparent;
}
.status-message.success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}


/* Table (Admin Panel - Main Car List) */
.table-wrapper {
    overflow-x: auto; 
    width: 100%;
}

table { /* General table, admin.php tables will use this */
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

table th,
table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

table td.image-cell {
    width: 120px; 
    text-align: center;
}

table img.thumbnail { /* Thumbnail in admin.php car list table */
    max-width: 100px;
    max-height: 75px;
    border-radius: 4px;
    object-fit: cover;
    cursor: pointer; 
    transition: transform 0.2s ease;
}
table img.thumbnail:hover {
    transform: scale(1.1); 
}


table th {
    background-color: #34495e; 
    color: #ecf0f1;
    font-weight: bold;
}

table tr:nth-child(even) {
    background-color: #f9f9f9; 
}

table tr:hover {
    background-color: #f1f1f1; 
}

.actions a {
    margin-right: 8px;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 0.9em;
    color: white;
    display: inline-block;
    margin-bottom: 5px; 
    transition: background-color 0.2s ease, color 0.2s ease;
}

.actions .edit-link {
    background-color: #2ecc71; 
}
.actions .edit-link:hover {
    background-color: #27ae60;
    text-decoration: none;
    color: white;
}

.delete-form {
    display: inline-block; 
    margin: 0;
}
.delete-form button {
    background-color: #dc3545; 
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 0.9em;
    cursor: pointer;
    font-family: inherit;
    line-height: inherit;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.delete-form button:hover {
    background-color: #000000; 
    color: white;
    text-decoration: none;
}


/* INDEX.PHP CAR LISTINGS STYLES */
.car-listings-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 350px)); 
    gap: 25px;
    padding: 0;
    margin-top: 20px;
    justify-content: center; 
}

.car-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    overflow: hidden; 
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.car-card:hover {
    transform: translateY(-5px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
}

.car-card-image {
    width: 100%;
    height: 200px; 
    overflow: hidden;
    position: relative; 
}

.car-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    display: block;
    border-bottom: 1px solid #e0e0e0;
}

/* SOLD Sticker Styles */
.sold-sticker {
    position: absolute;
    top: 10px;
    left: -35px; 
    background-color: #dc3545; 
    color: white;
    padding: 5px 40px;
    font-size: 0.9em;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    transform: rotate(-45deg);
    transform-origin: top left;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10; 
    white-space: nowrap;
}
.car-sold .car-card-image img { /* Applies to car-card with car-sold class */
    opacity: 0.7; 
}
.car-card-price.sold-text {
    color: #dc3545; 
    font-weight: bold;
}

.car-card-content {
    padding: 15px;
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
}

.car-card-title-block {
    margin-bottom: 8px;
}
.car-card-title {
    font-size: 1.4em;
    font-weight: 600;
    color: #333;
    margin: 0 0 3px 0;
    line-height: 1.3;
}
.car-card-title a {
    color: inherit; 
    text-decoration: none;
    transition: color 0.2s ease;
}
.car-card-title a:hover {
    color: #29836f; 
}
.car-card-variant-subtitle {
    font-size: 0.95em;
    color: #555;
    margin: 0 0 5px 0;
    font-weight: normal;
    line-height: 1.2;
}


.car-card-price {
    font-size: 1.3em;
    font-weight: bold;
    color: #29836f; 
    margin-bottom: 10px;
}

/* Styles for the car specifications table within car cards on index.php */
.car-card-details {
    font-size: 0.9em; 
    color: #555;     
    margin-bottom: 15px; 
    flex-grow: 1;    
}

.car-specs-table {
    width: 100%;
    border-collapse: collapse; 
    margin-top: 5px; 
    box-shadow: none; /* Remove general table box-shadow for this specific table */
}

.car-specs-table td {
    padding: 4px 0; 
    vertical-align: top; 
    line-height: 1.4; 
    border: none; /* Remove borders from cells in this specific table */
}

.car-specs-table tr:hover {
    background-color: transparent; /* Remove hover effect for rows in this specific table */
}

.car-specs-table td:first-child { 
    padding-right: 8px; 
    white-space: nowrap; 
    color: #333; 
}

.car-specs-table td:last-child { 
    text-align: left; 
}

.car-card-details p { 
    margin: 0; /* Remove margins from p tags if they were previously used for these details */
}
.car-card-details p strong { 
    color: #333;
}


.car-card-description-snippet {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.7em; 
}


.car-card-actions {
    margin-top: auto; 
    padding-top: 10px;
    display: flex;
    justify-content: center;
}

.car-card-actions .details-button {
    display: block;
    width: 95%;
    max-width: 300px;
    padding: 10px 15px;
    background-color: #29836f; 
    color: white;
    text-align: center;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
}

.car-card-actions .details-button:hover {
    background-color: #000000; 
    color: white;
    text-decoration: none;
}

.no-cars-message {
    text-align: center;
    font-size: 1.2em;
    color: #777;
    margin-top: 30px;
}

/* CAR_DETAILS.PHP STYLES */
.car-detail-layout {
    display: flex;
    flex-wrap: wrap; 
    gap: 30px;
    margin-top: 20px;
}

.car-detail-image-column {
    flex: 1 1 400px; 
    max-width: 500px;
    min-width: 280px; 
}

.carousel-container {
    position: relative;
    width: 100%;
    max-width: 500px; 
    margin: 0 auto 15px auto;
    overflow: hidden;
    border-radius: 8px;
    background-color: #eee; 
}

.carousel-slide-image {
    width: 100%;
    height: auto;
    max-height: 400px; 
    object-fit: contain; 
    display: block;
    border-radius: 8px;
    cursor: pointer; 
    transition: opacity 0.3s ease;
}
.carousel-slide-image:hover {
    opacity: 0.85; 
}


.carousel-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 10;
    transition: background-color 0.3s ease;
}
.carousel-nav-button:hover {
    background-color: rgba(0, 0, 0, 0.7);
}
.carousel-prev {
    left: 10px;
}
.carousel-next {
    right: 10px;
}

.carousel-thumbnail-strip {
    display: flex;
    flex-wrap: wrap; 
    gap: 8px;
    justify-content: center; 
    padding-top: 10px;
}

.carousel-thumbnail-strip img {
    width: 80px;
    height: 60px;
    object-fit: cover; 
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.3s ease, opacity 0.3s ease;
    opacity: 0.7; 
}
.carousel-thumbnail-strip img:hover {
    opacity: 1;
    border-color: #29836f; 
}
.carousel-thumbnail-strip img.active-thumb {
    border-color: #29836f; 
    opacity: 1;
    box-shadow: 0 0 5px rgba(41, 131, 111, 0.7);
}


.car-detail-info-column {
    flex: 1 1 300px; 
    padding-left: 10px; 
}

.car-detail-title { 
    font-size: 2.2em;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 10px;
    line-height: 1.2;
}


.car-detail-price {
    font-size: 1.8em;
    font-weight: bold;
    color: #29836f; 
    margin-bottom: 20px;
}
.car-detail-price.sold-text {
    color: #dc3545; 
    font-style: italic;
}

.car-detail-specs {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.car-detail-specs li {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    font-size: 1.1em;
    color: #333;
    padding: 8px 0;
    border-bottom: 1px dotted #eee; 
}
.car-detail-specs li:last-child {
    border-bottom: none;
}

.car-detail-specs strong {
    color: #555;
    flex: 0 0 160px; 
    padding-right: 10px;
    box-sizing: border-box;
    font-weight: 600;
}

.car-detail-specs .spec-value {
    flex-grow: 1;
    text-align: left;
}


.car-detail-description {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee; 
}

.car-detail-description h2 {
    font-size: 1.6em;
    color: #34495e;
    margin-bottom: 15px;
    border-bottom: 2px solid #29836f; 
    padding-bottom: 5px;
    display: inline-block;
}

.car-detail-description p {
    font-size: 1.05em;
    line-height: 1.7;
    color: #444;
    white-space: pre-wrap; 
    text-indent: 0 !important; 
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.car-not-found {
    text-align: center;
    font-size: 1.3em;
    color: #29836f; 
    margin-top: 40px;
}

/* IMAGE MODAL (Lightbox) STYLES */
.image-modal-overlay {
    display: none; 
    position: fixed;
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; 
    background-color: rgba(0,0,0,0.85); 
    justify-content: center; 
    align-items: center; 
}

.image-modal-content {
    position: relative;
    margin: auto;
    padding: 0;
    display: block;
    max-width: 90%; 
    max-height: 90vh; 
}

.image-modal-content img#modalImg {
    display: block;
    margin: auto;
    max-width: 100%;
    max-height: 85vh; 
    border-radius: 5px;
}

.image-modal-close {
    position: absolute;
    top: 10px;
    right: 25px;
    color: #f1f1f1;
    font-size: 35px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1002; 
}

.image-modal-close:hover,
.image-modal-close:focus {
    color: #bbb;
    text-decoration: none;
}

/* Styles for Modal Navigation Buttons */
.modal-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(40, 40, 40, 0.6);
    color: #fff;
    border: none;
    padding: 12px 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001; 
    border-radius: 5px;
    transition: background-color 0.3s ease;
    opacity: 0.8;
}
.modal-nav-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
    opacity: 1;
}
.modal-nav-button:disabled {
    opacity: 0.3;
    cursor: default;
}

.modal-prev {
    left: 15px;
}
.modal-next {
    right: 15px;
}


/* REFINED STYLES FOR LOGIN PAGE PASSWORD TOGGLE WITH IMAGE */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.toggle-password-button {
    position: absolute;
    right: 1px; 
    top: 50%;
    transform: translateY(-50%);
    height: calc(100% - 2px); 
    width: 34px; 
    background-color: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password-button img {
    width: 18px; 
    height: 18px;
    opacity: 0.6; 
    transition: opacity 0.2s ease-in-out;
}
.toggle-password-button:hover img {
    opacity: 1; 
}


/* General Body Styling for Footer - Ensures footer stays at bottom if content is short */
html {
    height: 100%;
}
body { 
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 0; 
}
.container, .form-container, .details-container, .login-container, .edit-car-container { 
    flex-grow: 1; 
}

/* Footer Styles */
.site-footer {
    background-color: #28826f; 
    color: #000000; 
    padding: 40px 0;
    margin-top: auto; 
    font-size: 0.9em;
    line-height: 1.6;
}

.site-footer .footer-container {
    display: flex;
    flex-wrap: wrap; 
    justify-content: space-between;
    gap: 20px; 
}

.site-footer .footer-column {
    flex: 1 1 220px; 
    padding: 0 15px; 
}

.site-footer h4 {
    color: #000000; 
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3); 
    padding-bottom: 8px;
}

.site-footer p {
    margin-bottom: 10px;
    color: #000000; 
}

.site-footer a {
    color: #000000; 
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.site-footer a:hover {
    color: #28826f; 
    text-decoration: underline;
}

.site-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.site-footer ul li {
    margin-bottom: 8px;
    color: #000000; 
}

.site-footer ul li strong { 
    color: #000000;
}

.footer-opening-hours-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    border: none; 
}
.footer-opening-hours-table td {
    padding: 4px 0;
    vertical-align: top;
    color: #000000; 
    border: none; 
}
.footer-opening-hours-table td:first-child { 
    text-align: left;
    padding-right: 10px;
    font-weight: 500; 
}
.footer-opening-hours-table td:last-child { 
    text-align: left;
}

.footer-newest-cars li {
    margin-bottom: 15px; 
}
.footer-newest-cars li a {
    display: flex;
    align-items: flex-start; 
    text-decoration: none;
}

.footer-car-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 3px;
    margin-right: 10px;
    border: 1px solid rgba(0, 0, 0, 0.3); 
    flex-shrink: 0; 
}

.footer-car-info {
    display: flex;
    flex-direction: column; 
}

.footer-car-brand,
.footer-car-model,
.footer-car-price {
    display: block;
    color: #000000; 
    transition: color 0.2s ease-in-out;
    line-height: 1.3;
}

.footer-car-brand {
    font-weight: 500; 
}
.footer-car-model {
    font-size: 0.95em;
}

.footer-car-price {
    font-size: 0.9em;
    margin-top: 2px;
}

.footer-newest-cars li a:hover .footer-car-brand,
.footer-newest-cars li a:hover .footer-car-model,
.footer-newest-cars li a:hover .footer-car-price {
    color: #28826f; 
}


/* Styles for Redesigned Edit/Add Car Page (Two-Column Layout) */
.edit-form-layout {
    display: flex;
    flex-wrap: wrap; 
    gap: 30px; 
}

.form-column {
    flex: 1; 
    min-width: 300px; 
}

.form-column-left {
    max-width: 450px; 
}

.form-column-right {
    display: flex;
    flex-direction: column;
    gap: 20px; 
}

.form-column fieldset {
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 0; 
}

.form-column fieldset legend {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    padding: 0 10px;
    margin-left: -10px; 
}

.form-group { 
    margin-bottom: 18px;
}

.form-group label { 
    display: block;
    margin-bottom: 6px;
    font-weight: 500; 
    color: #444;
    font-size: 0.95em;
}

.edit-form-layout .form-group input[type="text"],
.edit-form-layout .form-group input[type="number"],
.edit-form-layout .form-group input[type="url"], 
.edit-form-layout .form-group input[type="password"], 
.edit-form-layout .form-group input[type="email"], 
.edit-form-layout .form-group select,
.edit-form-layout .form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.95em;
}

.form-group small {
    font-size: 0.85em;
    color: #666;
    display: block;
    margin-top: 4px;
}

.readonly-group { 
    margin-bottom: 20px;
}
.readonly-info-field {
    background-color: #e9ecef;
    padding: 9px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95em;
    color: #495057;
    cursor: default;
}

.description-textarea { 
    min-height: 150px; 
    resize: vertical;
}

.image-management-fieldset legend, 
.upload-new-fieldset legend { 
    font-size: 1.2em; 
}

.image-management-info { 
    font-size: 0.9em;
    color: #555;
    margin-bottom: 15px;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.current-images-grid { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); 
    gap: 12px;
    margin-bottom: 20px;
}

.image-item { 
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    background-color: #f9f9f9;
    position: relative; 
    cursor: grab; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; 
    min-height: 130px; 
}
.image-item:active { 
    cursor: grabbing;
}

.image-item img.thumbnail { 
    max-width: 90px; 
    max-height: 70px; 
    object-fit: cover;
    border-radius: 3px;
    margin-bottom: 8px;
    display: block;
    border: 1px solid #eee;
    cursor: pointer; 
    transition: none; 
}
.image-item img.thumbnail:hover { 
    transform: none; 
}

.image-error-text { 
    font-size: 0.8em;
    color: #c0392b;
}

.primary-badge { 
    position: absolute;
    top: 4px;
    left: 4px;
    background-color: #28a745; 
    color: white;
    padding: 2px 6px;
    font-size: 0.75em;
    border-radius: 3px;
    z-index: 10;
    font-weight: bold;
    line-height: 1.2;
}

.delete-image-label { 
    font-size: 0.8em;
    color: #c0392b; 
    cursor: pointer;
    display: flex; 
    align-items: center;
    margin-top: auto; 
}
.delete-image-label input[type="checkbox"] { 
    margin-right: 4px;
    vertical-align: middle;
}

.sortable-ghost { 
    opacity: 0.4;
    background-color: #cce5ff; 
    border: 1px dashed #007bff;
}
.sortable-chosen,
.sortable-drag { 
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
}

.upload-new-fieldset { 
    margin-top: 20px; 
}
.file-upload-label { 
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}
.file-input-styled { 
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    width: 100%;
    box-sizing: border-box;
    background-color: #fff; 
}
.file-input-styled:hover { 
    border-color: #999;
}

.form-full-width-submit { 
    flex-basis: 100%; 
    text-align: center; 
    margin-top: 20px;
}

.main-submit-button { 
    padding: 12px 30px;
    font-size: 1.1em;
    background-color: #29836f; 
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: auto; 
    display: inline-block;
}
.main-submit-button:hover { 
    background-color: #216a5a; 
}

.sold-date-info { 
    color: #dc3545; 
    font-style: italic;
    margin-bottom: 15px;
    text-align: left; 
    font-size: 0.9em;
}


/* Responsive adjustments */
@media (max-width: 992px) { /* Tablet and smaller */
    .site-footer .footer-column {
        flex-basis: calc(50% - 10px); 
        margin-bottom: 30px;
    }

    .edit-form-layout {
        flex-direction: column; 
        gap: 0; 
    }
    .form-column {
        max-width: 100%; 
        margin-bottom: 25px;
    }
    .form-column:last-child {
        margin-bottom: 0;
    }
    .form-column-left { 
      max-width: 100%;
    }
}

@media (max-width: 767px) { /* Mobile devices */
    .container, .container.form-container, .container.details-container, .container.login-container, .container.edit-car-container {
        width: 95%; 
        padding: 15px;
    }
    .container.login-container {
        margin-top: 30px;
    }

    .site-logo {
        max-height: 60px;
    }

    .page-header-container {
        flex-direction: column; 
        align-items: center;
        text-align: center;
    }
    .page-header-container .page-title,
    .page-header-container .car-detail-title-main,
    .page-header-container .title-block {
        margin-bottom: 10px;
        text-align: center;
        width:100%;
        align-items: center;
    }
     .page-header-container .back-link {
        align-self: center;
        margin-left: 0;
        margin-top: 10px;
    }
    .page-header-container .header-status-field { 
        margin-left: 0;
        margin-top: 10px;
        justify-content: center; 
    }


    .nav-links {
        flex-direction: column; 
    }
    .nav-group-left, .nav-group-right {
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
    }
    .nav-group-right {
        margin-bottom: 0;
    }
    .nav-group-left a, .nav-group-right a {
        margin-right: 8px;
        margin-left: 8px;
    }
    .nav-separator {
        margin: 0 5px;
    }


    h1.page-title { 
        font-size: 2em;
    }

    .car-listings-container { 
        gap: 15px; 
    }
    
    .car-card-title { 
        font-size: 1.2em;
    }
    .car-card-variant-subtitle { 
        font-size: 0.9em;
    }
    .car-card-price { 
        font-size: 1.1em;
    }

    .car-detail-layout { 
        flex-direction: column; 
        gap: 20px;
    }
    .car-detail-image-column, .car-detail-info-column { 
        flex-basis: auto;
        width: 100%;
        max-width: 100%;
        padding-left: 0; 
    }
    .car-detail-title { 
        font-size: 1.8em;
    }
    .car-detail-variant-subtitle { 
        font-size: 1.1em;
    }
    .car-detail-price { 
        font-size: 1.5em;
    }
    .car-detail-specs li { 
        font-size: 1em;
    }
    .car-detail-specs strong { 
        flex-basis: 120px; 
    }

    .car-detail-description h2 { 
        font-size: 1.4em;
    }
    .car-detail-description p { 
        text-align: left; 
    }

    .carousel-thumbnail-strip img { 
        width: 70px;
        height: 52px;
    }
    .carousel-nav-button { 
        padding: 8px 10px;
        font-size: 18px;
    }
    .modal-nav-button { 
        padding: 10px;
        font-size: 20px;
    }
    .modal-prev { left: 5px; }
    .modal-next { right: 5px; }


    /* Responsive Table for Admin Panel (admin.php main list) */
    .table-wrapper table,
    .table-wrapper thead,
    .table-wrapper tbody,
    .table-wrapper th,
    .table-wrapper td,
    .table-wrapper tr {
        display: block; 
    }

    .table-wrapper thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-wrapper tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        border-radius: 4px;
    }
    .table-wrapper tr:nth-child(even) { 
        background-color: #fff;
    }


    .table-wrapper td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%; 
        padding-top: 8px;
        padding-bottom: 8px;
        white-space: normal;
        text-align: left;
    }
    .table-wrapper td.image-cell {
        padding-left: 10px; 
        text-align: center;
    }
    .table-wrapper td.image-cell:before { 
        display: none;
    }


    .table-wrapper td:before { 
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        content: attr(data-label); 
        color: #34495e;
    }
    
    .table-wrapper td:last-child {
        border-bottom: none; 
    }
    
    .actions a { 
        display: block;
        margin-bottom: 8px;
        text-align: center;
    }
     .actions a:last-child {
        margin-bottom: 0;
    }

    form input[type="text"],
    form input[type="number"],
    form input[type="url"],
    form input[type="password"].password-input-field, 
    form input[type="text"].password-input-field, 
    form input[type="email"],
    form input[type="file"], 
    form select,
    form textarea,
    form input[type="submit"] { 
        font-size: 0.95em; 
    }
    
    form input[type="password"].password-input-field,
    form input[type="text"].password-input-field {
      padding-right: 32px !important; 
    }
    .toggle-password-button {
      width: 30px;
    }
    .toggle-password-button img {
      width: 16px;
      height: 16px;
    }

    .image-modal-content { 
        max-width: 95%; 
    }
    .image-modal-close { 
        top: 10px;
        right: 25px;
        font-size: 30px;
    }

    .form-column fieldset legend { 
        font-size: 1.2em;
    }
    .current-images-grid { 
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 10px;
    }
    .image-item img.thumbnail { 
        max-width: 75px;
        max-height: 55px;
    }
    .main-submit-button { 
        font-size: 1em;
        padding: 10px 25px;
    }

    .site-footer .footer-column {
        flex-basis: 100%; 
        margin-bottom: 30px;
    }
    .site-footer .footer-column:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 480px) { /* Extra small screens */
    .site-logo {
        max-height: 50px;
    }

    .page-header-container .page-title,
    .page-header-container .car-detail-title-main,
    .page-header-container .title-block {
        font-size: 1.6em; 
        align-items: center; 
    }
     .page-header-container .back-link {
        font-size: 0.8em;
        padding: 5px 8px;
    }

    h1.page-title { 
        font-size: 1.8em;
    }
    
    form input[type="password"].password-input-field,
    form input[type="text"].password-input-field {
      padding-right: 30px !important;
    }
    .toggle-password-button {
      width: 28px;
    }
    .toggle-password-button img {
      width: 14px;
      height: 14px;
    }

    .carousel-thumbnail-strip img {
        width: 60px;
        height: 45px;
    }
    .modal-nav-button {
        padding: 8px;
        font-size: 18px;
    }
    .modal-prev { left: 2px; }
    .modal-next { right: 2px; }
}

