/* Mobile Optimization CSS for NuevoDrive */

/* ============================================================================
   BASE MOBILE STYLES
   ============================================================================ */

/* Enhanced touch targets */
.btn, .nav-link, .dropdown-item, input, button, .card {
    min-height: 44px; /* iOS recommended touch target */
    min-width: 44px;
}

/* Large Sign Up button styling - Enhanced visibility */
.navbar .btn-outline-secondary {
    transition: all 0.3s ease;
    border-width: 2px;
    background-color: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
    border: 2px solid #1a1a1a !important;
    color: #1a1a1a !important;
}

.navbar .btn-outline-secondary:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
    background-color: #ffffff !important;
    color: #0f1419 !important;
}

/* Large Apply Now button styling */
.navbar .btn-primary {
    transition: all 0.3s ease;
    border-width: 2px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.navbar .btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.5);
}

/* Improved text readability on mobile */
@media (max-width: 768px) {
    body {
        font-size: 16px; /* Prevents zoom on iOS */
        line-height: 1.6;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    
    .display-4 { font-size: 2rem; }
    .display-6 { font-size: 1.5rem; }
    .lead { font-size: 1.1rem; }
}

/* ============================================================================
   NAVIGATION MOBILE OPTIMIZATION
   ============================================================================ */

@media (max-width: 991px) {
    .navbar-nav {
        background: var(--bs-body-bg);
        border-radius: 8px;
        padding: 1rem;
        margin-top: 1rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 6px;
        margin-bottom: 0.5rem;
        text-align: center;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: var(--nd-accent) !important;
        color: white !important;
    }
    
    .navbar-nav .btn {
        margin: 0.5rem 0;
        width: 100%;
        padding: 1rem 2rem !important;
        font-size: 1.1rem !important;
        font-weight: 600 !important;
    }
    
    .navbar-nav .btn-outline-secondary {
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(255, 255, 255, 0.15) !important;
        border: 2px solid #ffffff !important;
        color: #ffffff !important;
        backdrop-filter: blur(5px);
    }
    
    .navbar-nav .btn-outline-secondary:hover {
        background-color: #ffffff !important;
        color: #0f1419 !important;
        border-color: #ffffff !important;
    }
    
    .navbar-brand img {
        height: 35px; /* Slightly smaller on mobile */
    }
}

/* ============================================================================
   HERO SECTION WITH BACKGROUND IMAGE
   ============================================================================ */

.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../images/hero-driving-mexico.jpg') center/cover no-repeat;
    z-index: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(10, 13, 18, 0.9) 0%, 
        rgba(26, 29, 41, 0.8) 50%, 
        rgba(15, 20, 25, 0.9) 100%);
    z-index: 2;
}

/* ============================================================================
   HERO SECTION MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .hero-section {
        min-height: 100vh;
        padding: 1rem 0 !important;
        text-align: center;
    }
    
    .hero-background {
        background-position: 65% center; /* Focus on car interior on mobile */
    }
    
    .hero-overlay {
        background: linear-gradient(to bottom, 
            rgba(10, 13, 18, 0.95) 0%, 
            rgba(26, 29, 41, 0.9) 50%, 
            rgba(15, 20, 25, 0.95) 100%);
    }
    
    .hero-section h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
        line-height: 1.2;
    }
    
    .hero-section .lead {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
        line-height: 1.4;
    }
    
    .hero-section .btn {
        width: 100%;
        margin-bottom: 0.75rem;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    .hero-section .badge {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
    
    /* Stack trust signals vertically on mobile */
    .hero-section .d-flex.gap-3 {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .hero-section .badge {
        align-self: center;
        margin-bottom: 0.5rem;
    }
}

/* ============================================================================
   CARDS AND CONTENT MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .card {
        margin-bottom: 1.5rem;
        border-radius: 12px;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .card-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    /* Enhanced spacing for mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .py-5 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    .mb-5 {
        margin-bottom: 2rem !important;
    }
}

/* ============================================================================
   FORMS MOBILE OPTIMIZATION
   ============================================================================ */

@media (max-width: 768px) {
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem;
        min-height: 50px;
        border-radius: 8px;
    }
    
    .input-group .form-control {
        min-height: 50px;
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        border-radius: 8px;
        font-weight: 500;
    }
    
    .btn-lg {
        padding: 1rem 2rem;
        font-size: 1.1rem;
    }
    
    /* File upload improvements */
    .form-control[type="file"] {
        padding: 0.5rem;
    }
    
    /* Multi-column forms to single column */
    .row.g-3 .col-md-6,
    .row.g-4 .col-md-6 {
        margin-bottom: 1rem;
    }
}

/* ============================================================================
   TABLE MOBILE OPTIMIZATION
   ============================================================================ */

@media (max-width: 768px) {
    .table-responsive {
        border-radius: 8px;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }
    
    /* Stack table data vertically on very small screens */
    @media (max-width: 576px) {
        .table,
        .table tbody,
        .table tr,
        .table td {
            display: block;
            width: 100%;
        }
        
        .table thead {
            display: none;
        }
        
        .table tr {
            border: 1px solid #dee2e6;
            margin-bottom: 1rem;
            border-radius: 8px;
            padding: 1rem;
        }
        
        .table td {
            border: none;
            padding: 0.5rem 0;
            position: relative;
            padding-left: 50%;
        }
        
        .table td:before {
            content: attr(data-label) ": ";
            position: absolute;
            left: 0;
            width: 45%;
            font-weight: bold;
            white-space: nowrap;
        }
    }
}

/* ============================================================================
   CHAT WIDGET MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .chat-widget {
        bottom: 20px;
        right: 15px;
        left: 15px;
        width: auto;
        max-width: none;
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .chat-messages {
        height: 250px;
        padding: 1rem;
    }
    
    .chat-input-container {
        padding: 1rem;
    }
    
    .chat-input {
        font-size: 16px; /* Prevents zoom */
    }
    
    .chat-toggle {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
    }
}

/* ============================================================================
   CALCULATOR MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .calculator-container .row > div {
        margin-bottom: 1rem;
    }
    
    .calculator-result {
        padding: 1.5rem;
        border-radius: 12px;
        text-align: center;
    }
    
    .calculator-result h3 {
        font-size: 1.5rem;
    }
    
    .calculator-result .display-6 {
        font-size: 1.75rem;
    }
}

/* ============================================================================
   TESTIMONIALS MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .testimonial-card {
        margin-bottom: 1.5rem;
    }
    
    .testimonial-text {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    .testimonial-author {
        margin-top: 1rem;
    }
}

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

@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem;
        max-width: none;
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 1.5rem;
        border-bottom: 1px solid #dee2e6;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        padding: 1rem 1.5rem;
    }
}

/* ============================================================================
   COMPETITIVE ADVANTAGE PAGE MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .comparison-matrix {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .comparison-matrix table {
        min-width: 600px;
    }
    
    .competitor-cards .col-lg-4 {
        margin-bottom: 1.5rem;
    }
    
    .why-we-win .col-md-6 {
        margin-bottom: 1.5rem;
    }
}

/* ============================================================================
   DASHBOARD MOBILE
   ============================================================================ */

@media (max-width: 768px) {
    .dashboard-stats .col-md-3 {
        margin-bottom: 1rem;
    }
    
    .dashboard-card {
        text-align: center;
        padding: 1.5rem;
    }
    
    .dashboard-number {
        font-size: 1.75rem;
    }
    
    .application-filters {
        margin-bottom: 1.5rem;
    }
    
    .application-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

/* Mobile-specific utility classes */
@media (max-width: 768px) {
    .mobile-center { text-align: center !important; }
    .mobile-full-width { width: 100% !important; }
    .mobile-hide { display: none !important; }
    .mobile-show { display: block !important; }
    .mobile-spacing { margin: 1rem 0 !important; }
    .mobile-padding { padding: 1rem !important; }
}

/* Touch-friendly improvements */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Smooth scrolling for mobile */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Improved focus states for accessibility */
    .form-control:focus,
    .btn:focus,
    .nav-link:focus {
        outline: 2px solid var(--nd-accent);
        outline-offset: 2px;
    }
}

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

/* Reduce animations on mobile for better performance */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Hardware acceleration for smooth scrolling */
.card, .btn, .navbar, .modal, .hero-background {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ============================================================================
   PERFORMANCE OPTIMIZATIONS FOR MOBILE
   ============================================================================ */

/* Optimize background image loading */
@media (max-width: 768px) {
    .hero-background {
        background-image: url('../images/hero-driving-mexico.jpg');
        background-attachment: scroll; /* Better performance on mobile */
        will-change: transform;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .hero-background {
        background-attachment: scroll;
    }
    
    .card:hover {
        transform: none;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    .btn:hover {
        transform: none;
    }
}