/**
 * Mobile-First Optimized Styles
 * Focus First Website - Enhanced Mobile Experience
 */

/* ==========================================================================
   MOBILE-FIRST BASE STYLES
   ========================================================================== */

/* Enhanced Touch Targets */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Improved Button Styles for Touch */
.btn, .button, .nav-cta {
    min-height: 48px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px; /* Prevents zoom on iOS */
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.btn:active, .button:active, .nav-cta:active {
    transform: scale(0.98);
}

/* Enhanced Mobile Navigation */
.nav-toggle {
    min-height: 48px;
    min-width: 48px;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle:hover, .nav-toggle:focus {
    background-color: rgba(0, 0, 0, 0.05);
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    background: var(--charcoal);
    border-radius: 1px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
}

/* Enhanced Hamburger Animation */
.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Form Optimizations */
.form-group input,
.form-group textarea,
.form-group select {
    min-height: 48px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    background: #ffffff;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--sky-blue);
    box-shadow: 0 0 0 3px rgba(100, 171, 222, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* Mobile Typography Improvements */
body {
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - MOBILE FIRST
   ========================================================================== */

/* Small Mobile Devices (320px - 374px) */
@media screen and (max-width: 374px) {
    .container {
        padding: 0 16px;
    }
    
    .hero-title {
        font-size: 28px;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 16px;
        margin-bottom: 24px;
    }
    
    .btn, .button {
        width: 100%;
        margin-bottom: 12px;
    }
    
    .card-grid-2,
    .card-grid-3,
    .card-grid-4 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Large Mobile Devices (375px - 479px) */
@media screen and (min-width: 375px) and (max-width: 479px) {
    .hero-title {
        font-size: 32px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 16px;
    }
    
    .hero-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Large Mobile / Small Tablet (480px - 767px) */
@media screen and (min-width: 480px) and (max-width: 767px) {
    .container {
        padding: 0 24px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .card-grid-2 {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .card-grid-3,
    .card-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .hero-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
}

/* Tablet Devices (768px - 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .nav-toggle {
        display: none;
    }
    
    .nav-menu {
        display: flex !important;
        position: static;
        background: none;
        box-shadow: none;
        padding: 0;
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }
    
    .nav-menu li {
        text-align: center;
    }
}
    
    .card-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile Layout Improvements */
@media screen and (max-width: 767px) {
    /* Center align text content on mobile */
    .feature-content,
    .feature-content h2,
    .feature-content p,
    .hero-content,
    .section-content {
        text-align: center;
    }
    
    /* Footer center alignment */
    .footer-content,
    .footer-section {
        text-align: center;
    }
    
    .footer-section h3 {
        margin-bottom: 16px;
    }
    
    .footer-links {
        justify-content: center;
    }
    
    /* Feature sections mobile layout */
    .feature,
    .feature-reverse {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }
    
    .feature-content {
        order: 1;
    }
    
    .feature-image {
        order: 2;
        margin: 0 auto;
    }
    
    /* Cards center alignment */
    .card {
        text-align: center;
    }

/* Mobile Navigation Styles */
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--pure-white);
        flex-direction: column;
        padding: 24px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    }
    
    .nav-menu.active {
        display: flex;
        transform: translateX(0);
    }
    
    .nav-menu a {
        padding: 16px 0;
        font-size: 18px;
        font-weight: 500;
        border-bottom: 1px solid #f1f5f9;
        color: var(--charcoal);
        text-decoration: none;
        transition: color 0.2s ease;
    }
    
    .nav-menu a:hover,
    .nav-menu a:focus {
        color: var(--sky-blue);
    }
    
    .nav-menu .nav-cta {
        margin-top: 24px;
        padding: 16px 24px;
        background: var(--sky-blue);
        color: var(--pure-white);
        border-radius: 8px;
        text-align: center;
        font-weight: 600;
        border-bottom: none;
    }
    
    .nav-menu .nav-cta:hover {
        background: var(--ocean-teal);
        color: var(--pure-white);
    }
    
    /* Dropdown Improvements for Mobile */
    .nav-dropdown {
        width: 100%;
    }
    
    .nav-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
        position: relative;
    }
    
    .nav-dropdown-toggle::after {
        content: '▼';
        font-size: 12px;
        transition: transform 0.2s ease;
    }
    
    .nav-dropdown.active .nav-dropdown-toggle::after {
        transform: rotate(180deg);
    }
    
    .nav-dropdown-menu {
        position: static;
        background: #f8fafc;
        border-radius: 8px;
        margin-top: 12px;
        padding: 12px;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s ease;
    }
    
    .nav-dropdown.active .nav-dropdown-menu {
        max-height: 300px;
    }
    
    .nav-dropdown-menu a {
        padding: 12px 16px;
        font-size: 16px;
        border-bottom: none;
        border-radius: 6px;
        margin-bottom: 4px;
    }
    
    .nav-dropdown-menu a:hover {
        background: var(--pure-white);
    }
}

/* ==========================================================================
   NAVIGATION CONSISTENCY FIXES
   ========================================================================== */

/* Ensure consistent navigation alignment across all pages */
.navbar {
    width: 100%;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    margin: 0 8px;
}

.nav-link, .nav-cta {
    display: inline-block;
    text-align: center;
    white-space: nowrap;
}

/* Desktop navigation alignment */
@media screen and (min-width: 1024px) {
    .nav-menu {
        justify-content: center;
        flex: 1;
        margin-left: 40px;
    }
    
    .nav-cta {
        margin-left: auto;
    }
}

/* ==========================================================================
   MOBILE-SPECIFIC IMPROVEMENTS
   ========================================================================== */

/* Improved Scroll Behavior */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Better Focus States for Mobile */
*:focus {
    outline: 2px solid var(--sky-blue);
    outline-offset: 2px;
}

/* Touch-Friendly Spacing */
.section {
    padding: 40px 0;
}

@media screen and (min-width: 768px) {
    .section {
        padding: 60px 0;
    }
}

/* Mobile-Optimized Cards */
.card {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Mobile Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ==========================================================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================================================== */

/* Skip Link for Mobile */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--sky-blue);
    color: var(--pure-white);
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .btn, .button {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 1px solid var(--charcoal);
    }
}

/* ==========================================================================
   MOBILE FORM ENHANCEMENTS
   ========================================================================== */

/* Better Mobile Form Layout */
.form-grid {
    display: grid;
    gap: 20px;
}

@media screen and (max-width: 767px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
}

/* Mobile-Optimized Input Types */
input[type="email"] {
    inputmode: email;
    autocomplete: email;
}

input[type="tel"] {
    inputmode: tel;
    autocomplete: tel;
}

input[type="url"] {
    inputmode: url;
    autocomplete: url;
}

/* Mobile Success/Error Messages */
.form-message {
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 16px;
    line-height: 1.4;
}

.form-message.success {
    background: #f0fdf4;
    border: 1px solid #22c55e;
    color: #166534;
}

.form-message.error {
    background: #fef2f2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

/* Mobile Loading Button States */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: button-spin 1s linear infinite;
}

@keyframes button-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}