:root {
    --primary-color: #E30613;
    --secondary-color: #1F2937;
    --background-color: #F5F5F5;
    --card-bg: #FFFFFF;
    --text-color: #333333;
    --light-text: #666666;
    --border-color: #E5E5E5;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 16px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #374151 100%);
    padding: 40px 0 80px;
    margin-bottom: -30px;
}

.hero-content {
    color: white;
    margin-bottom: 25px;
    text-align: center;
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.search-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 1000px;
    margin: 0 auto;
}

.search-box .form-select-lg, 
.search-box .btn-lg {
    height: 50px;
    font-size: 16px;
}

.search-box .btn-primary {
    font-weight: 600;
}

/* Navbar */
.navbar {
    background-color: var(--secondary-color);
    color: white;
    padding: 12px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-size: 22px;
    font-weight: bold;
    color: white !important;
}

.navbar-brand span {
    color: var(--primary-color);
}

.navbar-nav .nav-link {
    color: white !important;
    font-weight: 500;
    transition: color 0.3s;
    padding: 8px 15px !important;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-toggler {
    border-color: rgba(255,255,255,0.3);
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
}

.btn-primary:hover {
    background-color: #c00510;
    border-color: #c00510;
}

.btn {
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s;
}

/* Car Card */
.car-card {
    background-color: var(--card-bg);
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
}

.car-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.car-image-container {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    min-height: 160px;
}

.car-image-container img {
    height: 180px;
    object-fit: cover;
    transition: transform 0.3s;
    width: 100%;
}

.car-card:hover .car-image-container img {
    transform: scale(1.05);
}

.car-year-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0,0,0,0.75);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.car-tramer-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(40, 167, 69, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.car-tramer-badge.damaged {
    background-color: rgba(220, 53, 69, 0.9);
}

.car-card .card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.car-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.car-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.car-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--light-text);
    margin-bottom: 8px;
}

.car-details span {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 4px;
}

.car-details i {
    color: var(--secondary-color);
    font-size: 11px;
}

.car-location {
    font-size: 13px;
    color: var(--light-text);
    margin-bottom: 0;
    margin-top: auto;
}

.car-location i {
    margin-right: 4px;
}

/* Detail Page */
.detail-container {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.gallery-main-img {
    width: 100%;
    height: 400px;
    object-fit: contain;
    border-radius: 12px;
    background: #f8f9fa;
}

.gallery-thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    overflow-x: auto;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.gallery-thumb {
    width: 90px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.gallery-thumb:hover, .gallery-thumb.active {
    opacity: 1;
    border-color: var(--primary-color);
}

.seller-info {
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
}

.seller-info h5 {
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 15px;
}

.table-specs {
    width: 100%;
    border-collapse: collapse;
}

.table-specs td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.table-specs tr:last-child td {
    border-bottom: none;
}

.table-specs td:first-child {
    font-weight: 600;
    width: 40%;
    color: var(--light-text);
}

.table-specs td:last-child {
    color: var(--secondary-color);
    font-weight: 500;
}

/* Damaged Parts Display */
.damaged-parts-display {
    background: #fff5f5;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    padding: 15px;
}

.damaged-parts-display h5 {
    color: #dc3545;
    margin-bottom: 10px;
}

.damaged-parts-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.damaged-part-tag {
    background: #dc3545;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

/* Vertical Damage Badge */
.damage-badge-vertical {
    position: absolute;
    top: 20px;
    left: -35px;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 8px 20px;
    font-weight: bold;
    font-size: 12px;
    transform: rotate(-45deg);
    box-shadow: 0 2px 10px rgba(220, 53, 69, 0.5);
    z-index: 10;
    width: 150px;
    text-align: center;
    border: 2px solid white;
}

.damage-badge-vertical i {
    margin-right: 5px;
}

/* Damaged Parts Selection */
.damaged-parts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.damaged-parts-grid .form-check {
    margin-bottom: 5px;
}

.damaged-parts-grid .form-check-input {
    margin-top: 0.2rem;
}

.damaged-parts-grid .form-check-label {
    font-size: 14px;
    cursor: pointer;
}

.damaged-parts-grid .form-check-input:checked + .form-check-label {
    color: var(--primary-color);
    font-weight: 600;
}

/* Panel Styles */
.panel-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.panel-card .card-header {
    background: var(--secondary-color);
    color: white;
    padding: 15px 20px;
    font-weight: 600;
}

.panel-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: rgba(227, 6, 19, 0.1);
    color: var(--primary-color);
}

.stat-icon.success {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.stat-icon.info {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

.stat-info h4 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary-color);
}

.stat-info p {
    margin: 0;
    color: var(--light-text);
    font-size: 13px;
}

/* Forms */
.form-label {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 5px;
    font-size: 14px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(227, 6, 19, 0.25);
}

.form-control::placeholder {
    color: #999;
}

/* Table */
.table {
    font-size: 14px;
}

.table th {
    background: #f8f9fa;
    color: var(--secondary-color);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.table img {
    border-radius: 8px;
}

/* Image Upload */
.image-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9fa;
}

.image-upload-area:hover {
    border-color: var(--primary-color);
    background: #fff5f5;
}

/* Footer */
.footer {
    background-color: var(--secondary-color);
    color: white;
    padding: 20px 0;
    margin-top: 40px;
}

.footer a {
    transition: color 0.3s;
}

.footer a:hover {
    color: var(--primary-color) !important;
}

/* Pagination */
.pagination {
    margin-top: 30px;
}

.page-link {
    color: var(--secondary-color);
    border-color: var(--border-color);
}

.page-link:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Image Preview */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.image-preview-item .primary-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(40, 167, 69, 0.9);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
}

.image-preview-item.primary-photo {
    border: 3px solid var(--primary-color);
}

/* No Image Placeholder */
.no-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #999;
    font-size: 48px;
    min-height: 200px;
    border-radius: 12px;
}

/* Filters Section */
.filters-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Login/Register Forms */
.auth-container {
    max-width: 450px;
    margin: 40px auto;
}

.auth-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Responsive Styles */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .hero-title {
        font-size: 36px;
    }
    
    .car-details span {
        font-size: 12px;
    }
    
    .damaged-parts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .hero-section {
        padding: 50px 0 90px;
    }
    
    .hero-title {
        font-size: 40px;
    }
    
    .hero-content {
        text-align: left;
        margin-bottom: 30px;
    }
    
    .search-box {
        padding: 25px;
    }
    
    .gallery-thumb {
        width: 100px;
        height: 75px;
    }
    
    .damaged-parts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .panel-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-info h4 {
        font-size: 28px;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .hero-section {
        padding: 60px 0 100px;
    }
    
    .hero-title {
        font-size: 48px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .gallery-main-img {
        height: 500px;
    }
    
    .gallery-thumb {
        width: 110px;
        height: 80px;
    }
    
    .car-image-container img {
        height: 200px;
    }
    
    .car-title {
        font-size: 15px;
    }
    
    .car-price {
        font-size: 22px;
    }
    
    .damaged-parts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .hero-title {
        font-size: 52px;
    }
    
    .gallery-main-img {
        height: 550px;
    }
}

/* Mobile-specific styles */
@media (max-width: 575.98px) {
    .hero-section {
        padding: 30px 0 60px;
        margin-bottom: -20px;
    }
    
    .hero-title {
        font-size: 26px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .search-box {
        padding: 15px;
    }
    
    .search-box .form-select-lg, 
    .search-box .btn-lg {
        height: 45px;
        font-size: 14px;
    }
    
    .search-box .btn-lg {
        margin-top: 10px;
        width: 100%;
    }
    
    .car-card {
        margin-bottom: 15px;
    }
    
    .car-image-container img {
        height: 160px;
    }
    
    .car-price {
        font-size: 18px;
    }
    
    .car-details {
        gap: 5px;
    }
    
    .car-details span {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .gallery-main-img {
        height: 250px;
    }
    
    .gallery-thumb {
        width: 70px;
        height: 55px;
    }
    
    .detail-container {
        padding: 15px;
    }
    
    .table-specs td {
        padding: 8px 5px;
        font-size: 13px;
    }
    
    .damaged-parts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 12px;
    }
    
    .damaged-parts-grid .form-check-label {
        font-size: 12px;
    }
    
    .panel-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .stat-info h4 {
        font-size: 22px;
    }
    
    .stat-info p {
        font-size: 12px;
    }
    
    .image-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .form-control, .form-select {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .footer {
        padding: 15px 0;
    }
    
    .footer .text-md-end {
        text-align: center !important;
        margin-top: 10px;
    }
    
    .auth-container {
        margin: 20px 15px;
        padding: 0;
    }
    
    .auth-card {
        padding: 20px;
    }
}

/* Accessibility */
.visually-hidden-focusable:not(:focus):not(:active) {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .image-preview-item button {
        display: none !important;
    }
    
    .car-card {
        break-inside: avoid;
    }
}
