/* Custom styles for LicensePilot.AI - Mobile First Performance Optimized */

/* Critical brand colors and fonts above the fold */
:root {
    --brand-blue: #2563eb;
    --brand-dark: #1e40af;
    --touch-target: 44px;
    --border-radius: 8px;
    --shadow-smooth: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Performance: Critical CSS for above-the-fold content */
.hero-section {
    min-height: 100vh;
    will-change: transform;
}

/* Critical button styles for CTAs */
.cta-button {
    min-height: var(--touch-target);
    min-width: 200px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    touch-action: manipulation;
}

/* Form focus states */
input:focus,
select:focus,
textarea:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Button hover animations */
.btn-primary {
    background-color: var(--brand-blue);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--brand-dark);
    transform: translateY(-1px);
}

/* Card hover effects */
.license-card {
    transition: all 0.3s ease;
}

.license-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Alert styles */
.alert {
    border-radius: 8px;
}

.alert-success {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-error {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

/* Mobile-First Responsive Design (Primary breakpoint: 375px - 428px) */
@media (max-width: 640px) {
    /* Critical mobile hero optimizations */
    .text-4xl, .text-5xl, .text-6xl, .text-7xl {
        font-size: clamp(2rem, 8vw, 3rem);
        line-height: 1.1;
        letter-spacing: -0.02em;
    }
    
    .text-xl, .text-2xl {
        font-size: clamp(1.125rem, 4vw, 1.5rem);
        line-height: 1.4;
    }
    
    /* Mobile hero padding - reduce for smaller screens */
    .py-20, .py-24, .py-32 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    /* Touch-optimized CTAs */
    button, .btn, a[data-test], a[data-conversion] {
        min-height: var(--touch-target);
        min-width: var(--touch-target);
        padding: 12px 20px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    /* Improved mobile form inputs */
    input[type="email"],
    input[type="password"], 
    input[type="text"],
    select {
        min-height: var(--touch-target);
        font-size: 16px; /* Critical: prevents iOS zoom */
        padding: 12px 16px;
        border-radius: var(--border-radius);
    }
    
    /* Mobile grid fixes */
    .grid-cols-2, .grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Mobile flexbox improvements */
    .flex.flex-col.sm\\:flex-row,
    .flex.flex-wrap.gap-3,
    .flex.flex-wrap.gap-4 {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    /* Mobile container padding */
    .px-4 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .px-8 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Performance: Reduce animations on mobile */
    .animate-pulse,
    .animate-bounce {
        animation-duration: 2s;
    }
}

@media (max-width: 768px) {
    /* Tablet responsive fixes */
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Form validation states */
.border-red-300 {
    border-color: #fca5a5;
}

.border-red-300:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Custom scrollbar for mobile */
@media (max-width: 640px) {
    .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* Additional mobile enhancements */
@media (max-width: 768px) {
    /* Tablet responsive fixes */
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Better mobile button layouts */
    .flex.flex-wrap.gap-3 {
        flex-direction: column;
        align-items: stretch;
    }
    
    .flex.flex-wrap.gap-3 > * {
        width: 100%;
        text-align: center;
    }
}

/* Touch interaction improvements */
@media (hover: none) and (pointer: coarse) {
    /* This targets touch devices */
    .hover\\:shadow-md:hover {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }
    
    .transition {
        transition-duration: 0.15s; /* Faster transitions on touch */
    }
}

/* Universal touch target optimization */
button,
a[role="button"],
input[type="submit"],
input[type="button"],
.btn,
[data-test],
[data-conversion] {
    min-height: var(--touch-target);
    min-width: var(--touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Conversion Rate Optimizations */
.sticky-cta {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    display: none;
}

@media (max-width: 768px) {
    .sticky-cta {
        display: block;
        animation: slideUp 0.3s ease-out;
    }
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Performance: Optimize scrolling */
.overflow-y-auto,
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* Performance: Contain layout shifts */
img, video {
    height: auto;
    max-width: 100%;
}

/* Loading state optimizations */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Core Web Vitals optimization: Reduce CLS */
.hero-background {
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
}

/* Performance: GPU acceleration for animations */
.animate-pulse,
.animate-bounce,
.hover\\:scale-105:hover {
    will-change: transform;
    transform: translateZ(0);
}