/* ========================================
   MOBILE-FRIENDLY STYLES - ALL PAGES
   Touch-Optimized, Responsive, Beautiful
   ======================================== */

/* ========================================
   GLOBAL MOBILE OPTIMIZATIONS
   ======================================== */

/* Touch-friendly elements */
@media (max-width: 768px) {
    /* Larger touch targets */
    .btn,
    a.btn,
    button {
        min-height: 48px;
        padding: 12px 20px !important;
        font-size: 16px !important;
    }
    
    /* Prevent zoom on input focus */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* Better spacing */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Readable text */
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    h4 {
        font-size: 1.1rem !important;
    }
}

/* ========================================
   IMAGE GALLERY - MOBILE FRIENDLY
   ======================================== */

@media (max-width: 768px) {
    /* Main gallery image */
    #mainImage {
        width: 100% !important;
        height: 250px !important;
        object-fit: cover !important;
        border-radius: 10px !important;
    }
    
    /* Thumbnail gallery */
    .thumbnail-gallery {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding: 10px 0;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    
    .thumbnail-gallery::-webkit-scrollbar {
        height: 4px;
    }
    
    .thumbnail-gallery::-webkit-scrollbar-thumb {
        background: #667eea;
        border-radius: 4px;
    }
    
    .thumbnail-gallery img {
        width: 80px !important;
        height: 80px !important;
        object-fit: cover !important;
        border-radius: 8px !important;
        flex-shrink: 0;
        scroll-snap-align: start;
        cursor: pointer;
        border: 2px solid transparent;
        transition: all 0.3s;
    }
    
    .thumbnail-gallery img.active,
    .thumbnail-gallery img:active {
        border-color: #667eea;
        transform: scale(1.05);
    }
    
    /* Gallery container */
    .car-gallery {
        margin-bottom: 20px;
    }
    
    /* Image zoom on tap */
    .image-zoom-container {
        position: relative;
        overflow: hidden;
        border-radius: 10px;
        background: #f8f9fa;
    }
}

/* ========================================
   CAR DETAILS PAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Car title and price */
    .car-title-section {
        padding: 15px;
        background: white;
        margin-bottom: 15px;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .car-title-section h1 {
        font-size: 1.5rem !important;
        margin-bottom: 10px;
    }
    
    .car-price {
        font-size: 1.75rem !important;
        font-weight: 800;
        color: #667eea;
    }
    
    /* Action buttons - stacked */
    .action-buttons .row {
        margin: 0 -5px;
    }
    
    .action-buttons .col-lg-3,
    .action-buttons .col-md-6 {
        padding: 0 5px;
        margin-bottom: 10px;
    }
    
    .action-buttons .btn {
        padding: 15px 10px !important;
        font-size: 14px !important;
        white-space: nowrap;
    }
    
    /* Specifications grid */
    .specifications-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .spec-item {
        background: #f8f9fa;
        padding: 12px;
        border-radius: 8px;
        text-align: center;
    }
    
    .spec-item i {
        font-size: 1.5rem;
        color: #667eea;
        margin-bottom: 8px;
        display: block;
    }
    
    .spec-item .spec-label {
        font-size: 0.75rem;
        color: #64748b;
        display: block;
        margin-bottom: 4px;
    }
    
    .spec-item .spec-value {
        font-size: 0.95rem;
        font-weight: 600;
        color: #1e293b;
    }
    
    /* Features list */
    .features-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .feature-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px;
        background: #f8f9fa;
        border-radius: 6px;
        font-size: 0.85rem;
    }
    
    .feature-item i {
        color: #10b981;
        font-size: 0.9rem;
    }
    
    /* EMI Calculator - mobile */
    .emi-calculator {
        background: white;
        border-radius: 10px;
        padding: 20px;
        margin-bottom: 20px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .emi-calculator .form-label {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
    
    .emi-calculator .form-control,
    .emi-calculator .form-select {
        font-size: 16px;
        padding: 12px;
    }
    
    .emi-result {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        padding: 20px;
        border-radius: 10px;
        text-align: center;
        margin-top: 15px;
    }
    
    .emi-amount {
        font-size: 2rem !important;
        font-weight: 800;
        margin: 10px 0;
    }
    
    /* Similar cars - horizontal scroll */
    .similar-cars-scroll {
        display: flex;
        overflow-x: auto;
        gap: 15px;
        padding: 10px 0;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    
    .similar-cars-scroll::-webkit-scrollbar {
        height: 4px;
    }
    
    .similar-cars-scroll .car-card {
        min-width: 280px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
}

/* ========================================
   CARS LISTING PAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Filter toggle button */
    .filter-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
        width: 60px;
        height: 60px;
        border-radius: 50%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
        font-size: 1.5rem;
    }
    
    /* Mobile filter sidebar */
    .filter-sidebar-mobile {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: white;
        z-index: 1050;
        overflow-y: auto;
        transition: left 0.3s;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .filter-sidebar-mobile.show {
        left: 0;
    }
    
    .filter-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        display: none;
    }
    
    .filter-overlay.show {
        display: block;
    }
    
    /* Car cards - full width */
    .car-grid-item {
        width: 100%;
    }
    
    .car-card {
        margin-bottom: 15px;
    }
    
    .car-card img {
        height: 200px !important;
    }
}

/* ========================================
   HOMEPAGE - MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Hero section */
    .modern-hero {
        min-height: 400px !important;
    }
    
    .modern-hero h1 {
        font-size: 1.75rem !important;
    }
    
    .modern-hero p {
        font-size: 1rem !important;
    }
    
    .modern-hero .btn {
        padding: 12px 30px !important;
        font-size: 1rem !important;
    }
    
    /* Quick search */
    .quick-search {
        margin-top: 0 !important;
        border-radius: 0 !important;
        padding: 20px 15px !important;
    }
    
    .quick-search .row {
        gap: 10px;
    }
    
    .quick-search .col-md-3 {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Featured cars - 1 column */
    .modern-car-card {
        margin-bottom: 20px;
    }
    
    .modern-car-card .car-image {
        height: 200px !important;
    }
    
    /* Brand grid - 3 columns */
    .brand-box {
        padding: 15px 10px !important;
    }
    
    .brand-box img {
        height: 40px !important;
    }
    
    .brand-box h6 {
        font-size: 0.85rem !important;
    }
    
    /* Customer gallery */
    .gallery-card img {
        height: 300px !important;
    }
    
    /* CTA section */
    .cta-section {
        padding: 40px 20px !important;
        border-radius: 0 !important;
        text-align: center !important;
    }
    
    .cta-section h2 {
        font-size: 1.5rem !important;
    }
    
    .cta-section p {
        font-size: 1rem !important;
    }
}

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

@media (max-width: 768px) {
    .form-modern .form-control,
    .form-modern .form-select,
    .form-modern textarea {
        font-size: 16px !important;
        padding: 12px 15px !important;
        border-radius: 8px !important;
    }
    
    .form-modern .form-label {
        font-size: 0.95rem !important;
        margin-bottom: 8px !important;
    }
    
    .form-modern .btn {
        width: 100%;
        padding: 15px !important;
        font-size: 1rem !important;
    }
}

/* ========================================
   MODALS - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 15px;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 20px 15px;
    }
    
    .modal-footer {
        padding: 15px;
    }
    
    .modal-title {
        font-size: 1.1rem !important;
    }
}

/* ========================================
   TABLES - MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }
    
    /* Card-based table for mobile */
    .mobile-table-card {
        background: white;
        border-radius: 10px;
        padding: 15px;
        margin-bottom: 15px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .mobile-table-card .row {
        margin-bottom: 10px;
    }
    
    .mobile-table-card .label {
        font-weight: 600;
        color: #64748b;
        font-size: 0.85rem;
    }
    
    .mobile-table-card .value {
        color: #1e293b;
        font-size: 0.95rem;
    }
}

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

@media (max-width: 768px) {
    /* Top bar - hide on mobile */
    .top-bar {
        display: none;
    }
    
    /* Navbar */
    .navbar {
        padding: 10px 0;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-brand img {
        height: 35px !important;
    }
    
    .navbar-toggler {
        padding: 8px 12px;
        font-size: 1.2rem;
    }
    
    .navbar-collapse {
        margin-top: 15px;
    }
    
    .navbar-nav .nav-link {
        padding: 12px 15px;
        font-size: 1rem;
        border-bottom: 1px solid #f1f5f9;
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    /* Call button in navbar */
    .navbar .btn {
        width: 100%;
        margin-top: 10px;
    }
}

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

@media (max-width: 768px) {
    footer {
        padding: 30px 0 15px !important;
    }
    
    footer .row > div {
        margin-bottom: 25px;
    }
    
    footer h5 {
        font-size: 1.1rem !important;
        margin-bottom: 15px !important;
    }
    
    footer ul li {
        margin-bottom: 10px;
    }
    
    footer .social-links a {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* ========================================
   UTILITY CLASSES - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }
    
    .mobile-show {
        display: block !important;
    }
    
    .mobile-text-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-no-padding {
        padding: 0 !important;
    }
    
    .mobile-no-margin {
        margin: 0 !important;
    }
}

/* ========================================
   TOUCH INTERACTIONS
   ======================================== */

/* Remove hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {
    .car-card:hover,
    .modern-car-card:hover,
    .brand-box:hover,
    .feature-box:hover {
        transform: none !important;
    }
    
    /* Add tap effect instead */
    .car-card:active,
    .modern-car-card:active,
    .brand-box:active,
    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    /* Reduce animations on mobile */
    * {
        animation-duration: 0.3s !important;
    }
    
    /* Optimize images */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }
}

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

@media (max-width: 768px) and (orientation: landscape) {
    .modern-hero {
        min-height: 300px !important;
    }
    
    #mainImage {
        height: 200px !important;
    }
    
    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
}

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

@media print {
    .navbar,
    .footer,
    .action-buttons,
    .btn,
    .filter-sidebar,
    .quick-search {
        display: none !important;
    }
    
    .container {
        max-width: 100% !important;
    }
}
