/* ===============================================
   CAR DETAILS PAGE - PREMIUM STYLING
   =============================================== */

/* Hero Section */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    animation: fadeInUp 1s ease-out;
}

.min-vh-75 {
    min-height: 75vh;
}

/* Hero Stats */
.hero-stats .stat-item {
    text-align: center;
    padding: 1rem 0.5rem;
}

.hero-stats .stat-value {
    color: #fff;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.hero-stats .stat-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Scroll Indicator */
.scroll-indicator {
    z-index: 3;
}

.scroll-arrow {
    animation: bounce 2s infinite;
    display: inline-block;
    padding: 1rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.scroll-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Product Highlights */
.highlight-card {
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
    height: 100%;
}

.highlight-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15) !important;
    border-color: rgba(187, 10, 48, 0.2);
}

.highlight-icon {
    opacity: 0.9;
}

.highlight-card:hover .highlight-icon i {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

.highlight-features small {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

/* Technical Specifications */
.spec-card {
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.spec-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
}

.spec-item {
    transition: all 0.2s ease;
}

.spec-item:hover {
    background-color: rgba(187, 10, 48, 0.05);
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 8px;
}

.spec-label {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

.spec-value {
    color: var(--color-text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

/* ===============================================
   DYNAMIC GALLERY CAROUSEL STYLES
   =============================================== */

/* Gallery Container */
.gallery-carousel-container {
    position: relative;
}

/* Main Gallery Carousel */
.gallery-main-carousel {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.gallery-main-carousel .carousel-item {
    transition: transform 0.6s ease-in-out;
}

.gallery-main-image {
    transition: all 0.3s ease;
    cursor: zoom-in;
    width: 100%;
    height: 500px;
    object-fit: cover;
}

.gallery-main-image:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

/* Image Info Overlay */
.gallery-info-overlay {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    opacity: 0;
    transition: all 0.3s ease;
    transform: translateY(20px);
}

.gallery-image-container:hover .gallery-info-overlay {
    opacity: 1;
    transform: translateY(0);
}

/* Zoom Icon */
.gallery-zoom-icon {
    opacity: 0;
    transition: all 0.3s ease;
    transform: scale(0.8);
}

.gallery-image-container:hover .gallery-zoom-icon {
    opacity: 1;
    transform: scale(1);
}

.gallery-zoom-icon .btn {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9) !important;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.gallery-zoom-icon .btn:hover {
    background: rgba(255, 255, 255, 1) !important;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Carousel Controls */
.gallery-main-carousel .carousel-control-prev,
.gallery-main-carousel .carousel-control-next {
    width: 5%;
    opacity: 0;
    transition: all 0.3s ease;
}

.gallery-main-carousel:hover .carousel-control-prev,
.gallery-main-carousel:hover .carousel-control-next {
    opacity: 1;
}

.carousel-control-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.carousel-control-icon:hover {
    background: rgba(0, 0, 0, 0.9) !important;
    transform: scale(1.1);
}

/* Carousel Indicators */
.gallery-main-carousel .carousel-indicators {
    margin-bottom: 20px;
}

.gallery-main-carousel .carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 5px;
    background-color: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.gallery-main-carousel .carousel-indicators button.active {
    background-color: var(--audi-red);
    border-color: var(--audi-red);
    transform: scale(1.2);
}

/* Thumbnail Gallery */
.gallery-thumbnails {
    margin-top: 1.5rem;
}

.gallery-thumbnail {
    transition: all 0.3s ease;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
}

.gallery-thumbnail:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--audi-red-light);
}

.gallery-thumbnail.active {
    border-color: var(--audi-red);
    box-shadow: 0 0 0 2px rgba(187, 10, 48, 0.3);
}

.thumbnail-image {
    transition: all 0.3s ease;
    height: 80px;
    width: 100%;
    object-fit: cover;
}

.gallery-thumbnail:hover .thumbnail-image {
    transform: scale(1.1);
    filter: brightness(1.1);
}

.gallery-thumb-active {
    background: linear-gradient(45deg, transparent, rgba(187, 10, 48, 0.2), transparent);
    border: 2px solid var(--audi-red);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-thumbnail.active .gallery-thumb-active {
    opacity: 1;
}

/* Category Badges */
.gallery-thumbnail .badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.7) !important;
    color: white !important;
    border: none;
}

/* Gallery Controls */
.gallery-controls {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(248, 249, 250, 0.5);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.filter-btn {
    border-radius: 25px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 2px solid var(--audi-red);
    color: var(--audi-red);
    background: transparent;
    transition: all 0.3s ease;
    margin: 0 2px;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--audi-red);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(187, 10, 48, 0.3);
}

.gallery-actions .btn {
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.gallery-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Auto Play Button */
#autoPlayToggle {
    position: relative;
    overflow: hidden;
}

#autoPlayToggle.playing {
    background-color: var(--audi-red);
    border-color: var(--audi-red);
    color: white;
}

#autoPlayToggle.playing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===============================================
   MODAL STYLES
   =============================================== */

/* Image Zoom Modal */
#imageZoomModal .modal-content {
    background: rgba(0, 0, 0, 0.9);
    border: none;
}

#zoomImage {
    max-height: 80vh;
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

#zoomImage:hover {
    transform: scale(1.02);
}

/* Fullscreen Gallery Modal */
#galleryFullscreenModal .modal-content {
    background: #000;
}

#fullscreenCarousel .carousel-inner {
    height: calc(100vh - 120px);
}

#fullscreenCarousel .carousel-item {
    height: 100%;
}

#fullscreenCarousel .carousel-control-prev-icon,
#fullscreenCarousel .carousel-control-next-icon {
    background-color: var(--audi-red);
    border-radius: 50%;
    padding: 1rem;
    width: 60px;
    height: 60px;
}

#fullscreenCarousel .carousel-indicators button {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

#fullscreenCarousel .carousel-indicators button.active {
    background-color: var(--audi-red);
    border-color: var(--audi-red);
    transform: scale(1.3);
}

/* ===============================================
   RESPONSIVE DESIGN
   =============================================== */

/* Tablet */
@media (max-width: 768px) {
    .gallery-main-image {
        height: 350px;
    }
    
    .thumbnail-image {
        height: 60px;
    }
    
    .gallery-controls {
        padding: 0.75rem;
    }
    
    .filter-btn {
        font-size: 0.875rem;
        padding: 0.4rem 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .gallery-actions {
        margin-top: 1rem;
    }
    
    .gallery-actions .btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .gallery-main-image {
        height: 280px;
    }
    
    .thumbnail-image {
        height: 50px;
    }
    
    .gallery-thumbnails .col-2 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .gallery-controls .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .gallery-controls .btn-group .btn {
        border-radius: 8px;
        margin: 2px 0;
    }
    
    .gallery-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .gallery-actions .btn {
        width: 100%;
    }
    
    .gallery-info-overlay {
        opacity: 1;
        transform: translateY(0);
        background: linear-gradient(transparent 40%, rgba(0, 0, 0, 0.9));
    }
    
    .gallery-zoom-icon {
        opacity: 1;
        transform: scale(0.9);
    }
}

/* ===============================================
   LOADING STATES
   =============================================== */

.gallery-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 500px;
    background: var(--audi-light-gray);
    border-radius: var(--radius-md);
}

.gallery-loading .spinner-border {
    color: var(--audi-red);
}

/* Image Loading Placeholder */
.gallery-main-image[src=""],
.thumbnail-image[src=""] {
    background: linear-gradient(45deg, #f0f0f0 25%, #e0e0e0 25%, #e0e0e0 50%, #f0f0f0 50%, #f0f0f0 75%, #e0e0e0 75%, #e0e0e0);
    background-size: 20px 20px;
    animation: loading-shimmer 1s linear infinite;
}

@keyframes loading-shimmer {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

/* ===============================================
   ACCESSIBILITY ENHANCEMENTS
   =============================================== */

.gallery-thumbnail:focus,
.filter-btn:focus,
.gallery-zoom-icon .btn:focus {
    outline: 2px solid var(--audi-red);
    outline-offset: 2px;
}

.gallery-main-carousel .carousel-control-prev:focus,
.gallery-main-carousel .carousel-control-next:focus {
    outline: 2px solid var(--audi-red);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===============================================
   LEGACY GALLERY STYLES (FALLBACK)
   =============================================== */

/* Gallery Section */
.gallery-main img,
.gallery-thumb img {
    transition: all 0.3s ease;
    cursor: zoom-in;
}

.gallery-main img:hover,
.gallery-thumb img:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.gallery-thumb {
    overflow: hidden;
    border-radius: 12px;
}

.gallery-thumb img {
    height: 150px;
    width: 100%;
    object-fit: cover;
}

/* Call to Action Section */
.cta-buttons .btn {
    min-width: 160px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.cta-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Modal Styling */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 2rem 2rem 0;
}

.modal-body {
    padding: 1rem 2rem;
}

.modal-footer {
    padding: 0 2rem 2rem;
}

.form-control {
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--audi-red);
    box-shadow: 0 0 0 0.2rem rgba(187, 10, 48, 0.25);
}

/* Breadcrumb Styling */
.breadcrumb {
    background: transparent;
    font-size: 0.9rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--audi-gray);
    content: ">";
}

.breadcrumb a {
    color: var(--audi-red);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--audi-red-hover);
}

/* Badge Styling */
.badge.bg-audi-red {
    background-color: var(--audi-red) !important;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-content > * {
    animation: fadeInUp 0.8s ease-out forwards;
}

.hero-content .badge {
    animation-delay: 0.1s;
}

.hero-content h1 {
    animation-delay: 0.2s;
}

.hero-content p {
    animation-delay: 0.3s;
}

.hero-stats {
    animation-delay: 0.4s;
}

.hero-actions {
    animation-delay: 0.5s;
}

/* Button Styling */
.btn {
    border-radius: 50px;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-danger {
    background: linear-gradient(135deg, var(--audi-red) 0%, var(--audi-red-hover) 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(187, 10, 48, 0.4);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--audi-red-hover) 0%, var(--audi-red) 100%);
    box-shadow: 0 8px 25px rgba(187, 10, 48, 0.6);
    transform: translateY(-2px);
}

.btn-outline-light {
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.btn-outline-light:hover {
    border-color: #fff;
    color: var(--audi-dark);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        min-height: 80vh;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-stats .stat-item {
        padding: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .hero-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .spec-card {
        margin-bottom: 2rem;
    }
    
    .gallery-thumb img {
        height: 120px;
    }
    
    .cta-buttons {
        justify-content: center !important;
    }
    
    .cta-buttons .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 576px) {
    .hero-content {
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-content .lead {
        font-size: 1.1rem;
    }
    
    .hero-stats .col-6 {
        flex: 0 0 50%;
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Loading States */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Hover Effects for Images */
.img-fluid {
    transition: all 0.3s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--audi-red);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--audi-red-hover);
}

/* Section Spacing */
section {
    position: relative;
}

section:not(.hero-section) {
    scroll-margin-top: 100px;
}

/* Text Selection */
::selection {
    background-color: var(--audi-red-light);
    color: var(--audi-red);
}

/* Focus Styles for Accessibility */
.btn:focus,
.form-control:focus,
a:focus {
    outline: 2px solid var(--audi-red);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .hero-section,
    .navbar,
    .top-bar,
    .cta-section,
    .modal {
        display: none !important;
    }
    
    .container {
        max-width: 100% !important;
    }
    
    .spec-card,
    .highlight-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
