/**
 * Car Show Page - Custom Styles
 * Modern, premium design system
 * Tailwind-inspired but custom for better control
 */

/* ===== CSS VARIABLES (Design Tokens) ===== */
:root {
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== FORM INPUTS ===== */
.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--gray-900);
    background-color: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-600);
    ring: 2px;
    ring-color: var(--primary-100);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-field:hover:not(:focus) {
    border-color: var(--gray-400);
}

/* ===== BOOKING CALENDAR (FLATPICKR) ===== */
.flatpickr-day.booking-day-booked,
.flatpickr-day.booking-day-booked:hover,
.flatpickr-day.booking-day-booked:focus,
.flatpickr-day.booking-day-booked.disabled,
.flatpickr-day.booking-day-booked.disabled:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.flatpickr-day.booking-day-available,
.flatpickr-day.booking-day-available:hover,
.flatpickr-day.booking-day-available:focus {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

/* ===== BUTTONS ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    color: white;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:focus {
    outline: none;
    ring: 3px;
    ring-color: var(--primary-100);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--gray-700);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-outline:focus {
    outline: none;
    ring: 2px;
    ring-color: var(--primary-100);
}

/* ===== GALLERY ENHANCEMENTS ===== */
#mainGalleryImage {
    transition: opacity 200ms ease-in-out, transform 120ms ease-out;
}

/* Ensure gallery overlay controls position reliably (do not depend on utility classes). */
.car-gallery-main {
    position: relative;
}

.car-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

.car-gallery-arrow--prev {
    left: 12px;
}

.car-gallery-arrow--next {
    right: 12px;
    left: auto;
}

@media (min-width: 768px) {
    .car-gallery-arrow {
        width: 44px;
        height: 44px;
    }
}

/* Desktop hover zoom for car gallery (zoom follows cursor) */
.car-gallery-zoom-container {
    overflow: hidden;
}

.car-gallery-zoom-target {
    transform-origin: var(--car-zoom-x, 50%) var(--car-zoom-y, 50%);
    will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
    .car-gallery-zoom-container:hover .car-gallery-zoom-target {
        transform: scale(1.8);
        cursor: zoom-in;
    }
}

/* Mobile fullscreen viewer (tap image to zoom + swipe prev/next) */
.car-mobile-viewer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    touch-action: none;
}

.car-mobile-viewer.is-open {
    display: flex;
}

.car-mobile-viewer__img {
    max-width: 100vw;
    max-height: 100vh;
    user-select: none;
    -webkit-user-drag: none;
    will-change: transform;
    transform: translate3d(var(--car-viewer-tx, 0px), var(--car-viewer-ty, 0px), 0) scale(var(--car-viewer-scale, 1));
}

.thumbnail-btn {
    transition: all 150ms ease-in-out;
}

.thumbnail-btn:focus {
    outline: none;
    ring: 2px;
    ring-offset: 2px;
    ring-color: var(--primary-600);
}

/* Lightbox modal */
#lightboxModal {
    backdrop-filter: blur(4px);
}

#lightboxImage {
    transition: opacity 150ms ease-in-out;
}

/* ===== MOBILE STICKY CTA ===== */
.mobile-sticky-cta {
    transition: transform 300ms ease-in-out;
    transform: translateY(100%);
}

.mobile-sticky-cta.visible {
    transform: translateY(0);
}

/* ===== RESPONSIVE UTILITIES ===== */
@media (max-width: 1023px) {
    .lg\:sticky {
        position: static !important;
    }
}

/* ===== ACCESSIBILITY ===== */
*:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== LAZY LOAD FADE IN ===== */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 300ms ease-in;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* ===== PROSE CONTENT ===== */
.prose {
    line-height: 1.75;
    color: var(--gray-700);
}

.prose p {
    margin-bottom: 1rem;
}

.prose ul, .prose ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

/* ===== TAILWIND-LITE UTILITIES (for car detail page) ===== */
.container { max-width: 1600px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.min-h-screen { min-height: 100vh; }
.max-w-xs { max-width: 20rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-full { max-width: 100%; }
.max-h-screen { max-height: 100vh; }
.max-h-\[90vh\] { max-height: 90vh; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex-1 { flex: 1 1 0%; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.text-center { text-align: center; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }
.space-y-8 > :not([hidden]) ~ :not([hidden]) { margin-top: 2rem; }
.space-x-2 > :not([hidden]) ~ :not([hidden]) { margin-left: 0.5rem; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.pt-0 { padding-top: 0; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-6 { padding-bottom: 1.5rem; }
.pb-0 { padding-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.leading-relaxed { line-height: 1.625; }

.text-gray-900 { color: var(--gray-900); }
.text-gray-700 { color: var(--gray-700); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-400 { color: var(--gray-400); }
.text-gray-300 { color: var(--gray-300); }
.text-blue-700 { color: #1d4ed8; }
.text-blue-600 { color: #2563eb; }
.text-amber-700 { color: #b45309; }
.text-amber-500 { color: #f59e0b; }
.text-amber-400 { color: #fbbf24; }
.text-green-700 { color: #15803d; }
.text-white { color: #fff; }

.bg-white { background-color: #fff; }
.bg-gray-50 { background-color: var(--gray-50); }
.bg-gray-100 { background-color: var(--gray-100); }
.bg-blue-50 { background-color: var(--primary-50); }
.bg-amber-50 { background-color: #fffbeb; }
.bg-amber-500 { background-color: #f59e0b; }
.bg-blue-100 { background-color: #dbeafe; }
.bg-green-100 { background-color: #dcfce7; }
.bg-green-50 { background-color: #f0fdf4; }
.bg-purple-100 { background-color: #f3e8ff; }
.bg-orange-100 { background-color: #ffedd5; }
.bg-black\/60 { background-color: rgba(0, 0, 0, 0.6); }
.bg-white\/90 { background-color: rgba(255, 255, 255, 0.9); }
.bg-white\/20 { background-color: rgba(255, 255, 255, 0.2); }
.bg-white\/10 { background-color: rgba(255, 255, 255, 0.1); }
.bg-gray-50\/50 { background-color: rgba(249, 250, 251, 0.5); }
.bg-blue-50\/30 { background-color: rgba(239, 246, 255, 0.3); }

.border { border-width: 1px; border-style: solid; }
.border-t { border-top-width: 1px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-style: solid; }
.border-gray-100 { border-color: var(--gray-100); }
.border-gray-200 { border-color: var(--gray-200); }
.border-gray-300 { border-color: var(--gray-300); }
.border-gray-400 { border-color: var(--gray-400); }
.border-blue-300 { border-color: #93c5fd; }
.border-blue-600 { border-color: #2563eb; }

.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.top-4 { top: 1rem; }
.top-1\/2 { top: 50%; }
.right-0 { right: 0; }
.right-4 { right: 1rem; }
.bottom-0 { bottom: 0; }
.bottom-4 { bottom: 1rem; }
.left-0 { left: 0; }
.left-4 { left: 1rem; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }
.z-\[100\] { z-index: 100; }

.w-2 { width: 0.5rem; }
.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-10 { width: 2.5rem; }
.w-24 { width: 6rem; }
.w-11 { width: 2.75rem; }
.w-12 { width: 3rem; }
.w-16 { width: 4rem; }
.w-20 { width: 5rem; }
.w-full { width: 100%; }
.h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-10 { height: 2.5rem; }
.h-24 { height: 6rem; }
.h-11 { height: 2.75rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.h-full { height: 100%; }

.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.cursor-pointer { cursor: pointer; }
.transition { transition: all var(--transition-fast); }
.transition-all { transition: all 200ms ease; }
.transition-colors { transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease; }
.transition-transform { transition: transform 300ms ease; }
.duration-300 { transition-duration: 300ms; }
.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }

.aspect-video { aspect-ratio: 16 / 9; }
.rounded-lg { border-radius: var(--radius-lg); }
.border-2 { border-width: 2px; }

.group:hover .group-hover\:opacity-100 { opacity: 1; }
.group:hover .group-hover\:scale-105 { transform: scale(1.05); }
.focus\:opacity-100:focus { opacity: 1; }
.hover\:text-gray-900:hover { color: var(--gray-900); }
.hover\:text-blue-700:hover { color: #1d4ed8; }
.hover\:border-blue-300:hover { border-color: #93c5fd; }
.hover\:border-gray-400:hover { border-color: var(--gray-400); }
.hover\:shadow-md:hover { box-shadow: var(--shadow-md); }
.hover\:bg-white:hover { background-color: #fff; }
.hover\:bg-blue-50\/30:hover { background-color: rgba(239, 246, 255, 0.3); }
.hover\:bg-gray-50:hover { background-color: var(--gray-50); }

.backdrop-blur-sm { backdrop-filter: blur(4px); }

.-translate-y-1\/2 { transform: translateY(-50%); }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-1 { grid-column: span 1 / span 1; }

.last\:border-0:last-child { border-width: 0; }
.last\:pb-0:last-child { padding-bottom: 0; }

@media (min-width: 768px) {
    .md\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
    .md\:p-8 { padding: 2rem; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:flex { display: flex; }
    .md\:hidden { display: none !important; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:col-span-2 { grid-column: span 2 / span 2; }
    .lg\:col-span-1 { grid-column: span 1 / span 1; }
    .lg\:sticky { position: sticky !important; }
    .lg\:top-24 { top: 6rem; }
    .lg\:hidden { display: none !important; }
}
