/*
 * MOBILE RESPONSIVE DESIGN SYSTEM
 * For Pasarmobkas - Clean & Mobile-First
 * Hero Banner: 1980x1080 - Lebar Kesamping (Landscape)
 */

/* ========================================
   RESET & BASE
   ======================================== */

/* Force images to not be cropped on mobile */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
}

/* ========================================
   HERO CAROUSEL - 1980x1080 LEBAR KESAMPING - MOBILE
   ======================================== */

/*
   HERO BANNER SIZE: 1980x1080
   Aspect Ratio: 16:9 (1.777:1) - LEBAR KESAMPING
   Banner lebih lebar secara horizontal, tidak tinggi
*/

/* Extra Small Phones (< 381px) - BANNER LEBAR & PENDEK */
@media (max-width: 380px) {
    .hero-section {
        /* 16:9 aspect ratio - LEBAR KESAMPING */
        aspect-ratio: 16 / 9 !important;
        width: 100vw !important;
        margin-left: calc(-50vw + 50%) !important;
        margin-right: calc(-50vw + 50%) !important;
        border-radius: 0 !important;
        max-height: 140px !important;  /* Pendek, tidak tinggi */
        overflow: hidden !important;
    }

    .hero-swiper {
        aspect-ratio: 16 / 9 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 140px !important;
        border-radius: 0 !important;
    }

    .swiper {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

    .swiper-slide {
        width: 100% !important;
        height: 100% !important;
        aspect-ratio: 16 / 9 !important;
        overflow: hidden !important;
    }

    /* Images fill carousel container - Lebar kesamping */
    .swiper-slide img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center center !important;
        display: block !important;
    }

    /* Hide text overlay on mobile */
    .hero-content {
        display: none !important;
    }

    /* Navigation buttons */
    .swiper-button-prev,
    .swiper-button-next {
        width: 28px !important;
        height: 28px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    .swiper-button-prev {
        left: 6px !important;
    }

    .swiper-button-next {
        right: 6px !important;
    }

    .swiper-button-prev::after,
    .swiper-button-next::after {
        font-size: 12px !important;
    }

    .swiper-pagination {
        bottom: 6px !important;
    }

    .swiper-pagination-bullet {
        width: 5px !important;
        height: 5px !important;
        margin: 0 2px !important;
    }
}

/* Standard Phones (381px - 640px) - BANNER LEBAR KESAMPING */
@media (min-width: 381px) and (max-width: 640px) {
    .hero-section {
        /* 16:9 aspect ratio - LEBAR KESAMPING */
        aspect-ratio: 16 / 9 !important;
        width: 100vw !important;
        margin-left: calc(-50vw + 50%) !important;
        margin-right: calc(-50vw + 50%) !important;
        border-radius: 0 !important;
        max-height: 160px !important;  /* Pendek, lebar kesamping */
        overflow: hidden !important;
    }

    .hero-swiper {
        aspect-ratio: 16 / 9 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 160px !important;
        border-radius: 0 !important;
    }

    .swiper {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

    .swiper-slide {
        width: 100% !important;
        height: 100% !important;
        aspect-ratio: 16 / 9 !important;
        overflow: hidden !important;
    }

    /* Images fill carousel container - Lebar kesamping */
    .swiper-slide img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center center !important;
        display: block !important;
    }

    /* Hide text overlay on mobile */
    .hero-content {
        display: none !important;
    }

    /* Navigation buttons */
    .swiper-button-prev,
    .swiper-button-next {
        width: 32px !important;
        height: 32px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    .swiper-button-prev {
        left: 8px !important;
    }

    .swiper-button-next {
        right: 8px !important;
    }

    .swiper-button-prev::after,
    .swiper-button-next::after {
        font-size: 14px !important;
    }

    .swiper-pagination {
        bottom: 8px !important;
    }

    .swiper-pagination-bullet {
        width: 6px !important;
        height: 6px !important;
        margin: 0 2px !important;
    }
}

/* Tablets (641px - 768px) - BANNER LEBAR KESAMPING */
@media (min-width: 641px) and (max-width: 768px) {
    .hero-section {
        /* 16:9 aspect ratio - LEBAR KESAMPING */
        aspect-ratio: 16 / 9 !important;
        width: 100vw !important;
        margin-left: calc(-50vw + 50%) !important;
        margin-right: calc(-50vw + 50%) !important;
        border-radius: 0 !important;
        max-height: 180px !important;  /* Pendek, lebar kesamping */
        overflow: hidden !important;
    }

    .hero-swiper {
        aspect-ratio: 16 / 9 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 180px !important;
        border-radius: 0 !important;
    }

    .swiper {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

    .swiper-slide {
        width: 100% !important;
        height: 100% !important;
        aspect-ratio: 16 / 9 !important;
        overflow: hidden !important;
    }

    /* Images fill carousel container - Lebar kesamping */
    .swiper-slide img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center center !important;
        display: block !important;
    }

    /* Hide text overlay on tablets */
    .hero-content {
        display: none !important;
    }

    /* Navigation buttons */
    .swiper-button-prev,
    .swiper-button-next {
        width: 36px !important;
        height: 36px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    .swiper-button-prev {
        left: 10px !important;
    }

    .swiper-button-next {
        right: 10px !important;
    }

    .swiper-button-prev::after,
    .swiper-button-next::after {
        font-size: 16px !important;
    }

    .swiper-pagination {
        bottom: 10px !important;
    }

    .swiper-pagination-bullet {
        width: 7px !important;
        height: 7px !important;
        margin: 0 3px !important;
    }
}

/* Large Tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-section {
        aspect-ratio: 16 / 9 !important;
        width: 100% !important;
        max-height: 250px !important;
    }

    .hero-swiper {
        aspect-ratio: 16 / 9 !important;
        width: 100% !important;
        max-height: 250px !important;
    }

    .swiper-slide img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center center !important;
    }
}

/* ========================================
   CAR CARDS - MOBILE OPTIMIZED
   ======================================== */

@media (max-width: 380px) {
    .car-card {
        width: 100% !important;
        margin: 0 !important;
        border-radius: 12px !important;
        overflow: hidden !important;
    }

    .car-card .image-container {
        height: 180px !important;
        border-radius: 12px 12px 0 0 !important;
        background: #f8fafc !important;
    }

    /* IMPORTANT: Images NOT cropped */
    .car-card img,
    .car-card .image-container img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center !important;
        padding: 0.5rem !important;
    }

    .car-card .card-content,
    .car-card .p-4,
    .car-card .p-6 {
        padding: 0.75rem !important;
    }

    .car-card .car-title,
    .car-card h3 {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }

    .car-card .car-price {
        font-size: 1.125rem !important;
    }

    .car-card .car-specs,
    .car-card .spec-item {
        gap: 0.5rem !important;
        font-size: 0.75rem !important;
    }

    .car-card .btn {
        padding: 0.625rem 1rem !important;
        font-size: 0.8125rem !important;
    }

    /* IMPORTANT: Keep buttons side by side (sejajar) on mobile */
    .car-card .car-actions,
    .car-card .flex.gap-2 {
        flex-direction: row !important;
        gap: 0.5rem !important;
    }

    .car-card .car-actions .btn,
    .car-card .flex.gap-2 .btn {
        flex: 1 !important;
        width: auto !important;
    }

    /* WhatsApp button same width as Detail button */
    .car-card .car-actions .btn-whatsapp,
    .car-card .flex.gap-2 .btn-whatsapp {
        flex: 1 !important;
        min-width: 48px !important;
    }
}

@media (min-width: 381px) and (max-width: 640px) {
    .car-card {
        width: 100% !important;
        margin: 0 !important;
        border-radius: 14px !important;
    }

    .car-card .image-container {
        height: 200px !important;
        background: #f8fafc !important;
    }

    /* IMPORTANT: Images NOT cropped */
    .car-card img,
    .car-card .image-container img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center !important;
        padding: 0.75rem !important;
    }

    .car-card .card-content {
        padding: 1rem !important;
    }

    .car-card .car-title,
    .car-card h3 {
        font-size: 1.125rem !important;
    }

    .car-card .car-price {
        font-size: 1.25rem !important;
    }

    /* IMPORTANT: Keep buttons side by side (sejajar) on mobile */
    .car-card .car-actions,
    .car-card .flex.gap-2 {
        flex-direction: row !important;
        gap: 0.5rem !important;
    }

    .car-card .car-actions .btn,
    .car-card .flex.gap-2 .btn {
        flex: 1 !important;
        width: auto !important;
    }

    /* WhatsApp button same width as Detail button */
    .car-card .car-actions .btn-whatsapp,
    .car-card .flex.gap-2 .btn-whatsapp {
        flex: 1 !important;
    }
}

@media (min-width: 641px) and (max-width: 768px) {
    .car-card {
        border-radius: 16px !important;
    }

    .car-card .image-container {
        height: 220px !important;
    }

    /* IMPORTANT: Images NOT cropped */
    .car-card img,
    .car-card .image-container img {
        object-fit: contain !important;
        object-position: center !important;
    }

    /* IMPORTANT: Keep buttons side by side on tablet */
    .car-card .car-actions,
    .car-card .flex.gap-2 {
        flex-direction: row !important;
        gap: 0.5rem !important;
    }

    .car-card .car-actions .btn,
    .car-card .flex.gap-2 .btn {
        flex: 1 !important;
    }

    .car-card .car-actions .btn-whatsapp,
    .car-card .flex.gap-2 .btn-whatsapp {
        flex: 1 !important;
    }
}

/* ========================================
   CAR GRID - RESPONSIVE
   ======================================== */

@media (max-width: 380px) {
    .car-grid,
    .grid.grid-cols-1 {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        padding: 0.75rem !important;
    }
}

@media (min-width: 381px) and (max-width: 640px) {
    .car-grid,
    .grid.grid-cols-1 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }
}

@media (min-width: 641px) and (max-width: 768px) {
    .car-grid,
    .grid.grid-cols-1,
    .grid.grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .car-grid,
    .grid.grid-cols-2,
    .grid.grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.25rem !important;
    }
}

/* Desktop - 3 columns */
@media (min-width: 1025px) {
    /* Only override specific car-grid containers, not all grids */
    .cars-container-desktop {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem !important;
    }
}

/* Large Desktop - 3 columns */
@media (min-width: 1280px) {
    /* Container desktop override */
    .cars-container-desktop {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2rem !important;
    }
}

/* ========================================
   NAVIGATION - MOBILE
   ======================================== */

@media (max-width: 1024px) {
    .desktop-nav {
        display: none !important;
    }

    .mobile-header {
        display: flex !important;
    }
}

@media (min-width: 1025px) {
    .desktop-nav {
        display: block !important;
    }

    .mobile-header {
        display: none !important;
    }
}

/* ========================================
   PAGINATION - MOBILE
   ======================================== */

@media (max-width: 380px) {
    .pagination {
        gap: 0.25rem !important;
        padding: 0.5rem !important;
    }

    .pagination-btn {
        min-width: 36px !important;
        height: 36px !important;
        font-size: 0.875rem !important;
        padding: 0 !important;
    }

    .pagination-info {
        font-size: 0.75rem !important;
    }
}

@media (min-width: 381px) and (max-width: 640px) {
    .pagination {
        gap: 0.375rem !important;
        padding: 0.625rem !important;
    }

    .pagination-btn {
        min-width: 40px !important;
        height: 40px !important;
        font-size: 0.875rem !important;
    }

    .pagination-info {
        font-size: 0.875rem !important;
    }
}

/* ========================================
   FORMS - MOBILE
   ======================================== */

@media (max-width: 640px) {
    .form-container {
        padding: 1rem !important;
        border-radius: 16px !important;
    }

    .form-group {
        margin-bottom: 0.875rem !important;
    }

    .form-label {
        font-size: 0.875rem !important;
        margin-bottom: 0.375rem !important;
    }

    .form-input,
    .form-select,
    .form-textarea,
    input,
    select,
    textarea {
        padding: 0.75rem !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
    }

    .form-textarea,
    textarea {
        min-height: 100px !important;
    }

    .form-btn,
    .btn {
        padding: 0.875rem 1.5rem !important;
        font-size: 1rem !important;
        border-radius: 12px !important;
    }

    .file-upload-wrapper {
        padding: 1.5rem 1rem !important;
        border-radius: 12px !important;
    }

    .file-upload-icon {
        font-size: 2rem !important;
        width: 56px !important;
        height: 56px !important;
    }

    .file-upload-text {
        font-size: 0.875rem !important;
    }
}

/* ========================================
   FILTER SECTION - MOBILE
   ======================================== */

@media (max-width: 640px) {
    .filter-section {
        padding: 1rem !important;
        border-radius: 16px !important;
    }

    .filter-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .filter-group {
        margin-bottom: 0.5rem !important;
    }

    .filter-label {
        font-size: 0.875rem !important;
        margin-bottom: 0.375rem !important;
    }
}

/* ========================================
   FOOTER - MOBILE
   ======================================== */

@media (max-width: 640px) {
    .footer {
        padding: 2rem 1rem 1rem !important;
    }

    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .footer-title {
        font-size: 1rem !important;
    }

    .footer-link {
        font-size: 0.875rem !important;
    }

    .footer-bottom {
        flex-direction: column !important;
        gap: 1rem !important;
        text-align: center !important;
    }
}

/* ========================================
   ABOUT SECTION - MOBILE
   ======================================== */

@media (max-width: 640px) {
    .about-section {
        padding: 2rem 1rem !important;
    }

    .about-content {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .about-title {
        font-size: 1.5rem !important;
    }

    .about-text {
        font-size: 0.9375rem !important;
    }

    .feature-card {
        padding: 1rem !important;
    }

    .feature-icon {
        width: 48px !important;
        height: 48px !important;
    }

    .feature-title {
        font-size: 0.9375rem !important;
    }

    .feature-text {
        font-size: 0.8125rem !important;
    }
}

/* ========================================
   CONTACT SECTION - MOBILE
   ======================================== */

@media (max-width: 640px) {
    .contact-section {
        padding: 2rem 1rem !important;
    }

    .contact-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .contact-info-card {
        padding: 1rem !important;
    }

    .contact-title {
        font-size: 1.25rem !important;
    }

    .contact-item {
        font-size: 0.875rem !important;
    }

    .contact-form {
        padding: 1rem !important;
    }
}

/* ========================================
   SKELETON LOADING - MOBILE
   ======================================== */

@media (max-width: 640px) {
    .skeleton-car-card {
        border-radius: 12px !important;
    }

    .skeleton-car-card .skeleton-image {
        height: 180px !important;
        border-radius: 12px 12px 0 0 !important;
    }

    .skeleton-car-card .skeleton-content {
        padding: 0.75rem !important;
    }

    .skeleton-car-card .skeleton-title {
        height: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    .skeleton-car-card .skeleton-text {
        height: 0.75rem !important;
    }
}

/* ========================================
   UTILITIES - MOBILE
   ======================================== */

@media (max-width: 640px) {
    /* Container */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Section padding */
    section {
        padding: 2rem 1rem !important;
    }

    /* Spacing */
    .gap-2 {
        gap: 0.5rem !important;
    }

    .gap-3 {
        gap: 0.75rem !important;
    }

    .gap-4 {
        gap: 1rem !important;
    }

    .gap-6 {
        gap: 1.5rem !important;
    }

    /* Text sizes */
    .text-xs {
        font-size: 0.75rem !important;
    }

    .text-sm {
        font-size: 0.875rem !important;
    }

    .text-base {
        font-size: 1rem !important;
    }

    .text-lg {
        font-size: 1.125rem !important;
    }

    .text-xl {
        font-size: 1.25rem !important;
    }

    .text-2xl {
        font-size: 1.5rem !important;
    }

    /* Paddings */
    .p-2 {
        padding: 0.5rem !important;
    }

    .p-3 {
        padding: 0.75rem !important;
    }

    .p-4 {
        padding: 1rem !important;
    }

    .p-6 {
        padding: 1.5rem !important;
    }

    /* Margins */
    .mb-2 {
        margin-bottom: 0.5rem !important;
    }

    .mb-3 {
        margin-bottom: 0.75rem !important;
    }

    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-6 {
        margin-bottom: 1.5rem !important;
    }

    /* Border radius */
    .rounded-lg {
        border-radius: 8px !important;
    }

    .rounded-xl {
        border-radius: 12px !important;
    }

    .rounded-2xl {
        border-radius: 16px !important;
    }
}

/* ========================================
   CAR DETAIL PAGE - MOBILE FIX
   ======================================== */

@media (max-width: 768px) {
    /* Fix main car image - not cropped */
    .car-detail-page .main-image {
        object-fit: contain !important;
        object-position: center !important;
        height: 250px !important;
    }

    /* Fix thumbnail images */
    .car-detail-page .thumbnail-image {
        object-fit: contain !important;
        object-position: center !important;
    }

    /* Fix gallery images */
    .car-detail-page img,
    .gallery-image,
    .carousel-image {
        object-fit: contain !important;
        object-position: center !important;
    }
}

/* Action buttons on car detail - side by side on mobile */
@media (max-width: 768px) {
    .quick-actions-mobile {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.75rem !important;
    }

    .quick-actions-mobile .btn {
        flex: 1 !important;
        width: auto !important;
    }
}

/* ========================================
   GLOBAL IMAGE FIX - ALL PAGES
   ======================================== */

@media (max-width: 768px) {
    /* Fix ALL hero banners across all pages */
    .hero img,
    .hero-banner img,
    .page-hero img,
    .section-hero img,
    .banner img,
    [class*="hero"] img,
    [class*="banner"] img {
        object-fit: contain !important;
        object-position: center !important;
    }

    /* Fix ALL carousel images */
    .carousel img,
    .swiper img,
    .slider img,
    .gallery img,
    [class*="carousel"] img,
    [class*="swiper"] img,
    [class*="slider"] img {
        object-fit: contain !important;
        object-position: center !important;
    }

    /* Fix ALL card images */
    .card img,
    .item-card img,
    .product-card img,
    [class*="-card"] img {
        object-fit: contain !important;
        object-position: center !important;
    }

    /* Fix ALL content images */
    .content img,
    article img,
    .post-content img,
    .description img {
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }
}

/* ========================================
   HIDE TEXT OVERLAYS ON MOBILE - ALL PAGES
   ======================================== */

@media (max-width: 768px) {
    /* Hide hero content overlays on all pages */
    .hero-content,
    .banner-content,
    .page-hero-content,
    .section-hero-content,
    [class*="hero"] .content,
    [class*="banner"] .content {
        display: none !important;
    }

    /* Show only images */
    .hero-section,
    .banner-section,
    .page-hero,
    .section-hero {
        position: relative !important;
    }
}

/* ========================================
   LANDSCAPE MODE
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        aspect-ratio: 11 / 6 !important;
        max-height: 200px !important;
    }

    .car-card .image-container {
        height: 140px !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .mobile-header,
    .hero-section,
    .pagination,
    .btn {
        display: none !important;
    }

    .car-card {
        page-break-inside: avoid;
    }
}
