/* ============================================
   IRONCREST SOFTWARE - MOBILE iOS EXPERIENCE
   Native iOS-style mobile interface
   ============================================ */

/* Only apply on mobile devices */
@media (max-width: 768px) {
    
    /* ============================================
       iOS SAFE AREAS & VARIABLES
       ============================================ */
    :root {
        --mobile-header-height: 56px;
        --mobile-bottom-nav-height: 80px;
        --mobile-safe-area-top: env(safe-area-inset-top, 0px);
        --mobile-safe-area-bottom: env(safe-area-inset-bottom, 0px);
        --ios-blue: #007AFF;
        --ios-gray: #8E8E93;
        --ios-light-gray: #F2F2F7;
        --ios-separator: rgba(60, 60, 67, 0.12);
    }
    
    /* ============================================
       BODY & LAYOUT ADJUSTMENTS
       ============================================ */
    body {
        padding-bottom: calc(var(--mobile-bottom-nav-height) + var(--mobile-safe-area-bottom));
        overflow-x: hidden;
    }
    
    /* Hide desktop navigation completely */
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: calc(var(--mobile-header-height) + var(--mobile-safe-area-top));
        padding-top: var(--mobile-safe-area-top);
        background: #FFFFFF !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--ios-separator);
        z-index: 1000;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }
    
    .nav-container {
        height: var(--mobile-header-height);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 16px;
    }
    
    /* Hide desktop menu items */
    .nav-menu,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    /* Center logo in header */
    .logo {
        margin: 0;
    }
    
    .logo-img {
        height: 40px !important;
        width: auto !important;
    }
    
    /* ============================================
       iOS BOTTOM NAVIGATION BAR
       ============================================ */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(var(--mobile-bottom-nav-height) + var(--mobile-safe-area-bottom));
        padding-bottom: var(--mobile-safe-area-bottom);
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--ios-separator);
        z-index: 1000;
        display: flex;
        align-items: flex-start;
        justify-content: space-around;
        padding-top: 8px;
    }
    
    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        text-decoration: none;
        color: var(--ios-gray);
        transition: color 0.2s ease;
        padding: 4px 0;
        cursor: pointer;
        border: none;
        background: none;
        font-family: var(--font-secondary);
    }
    
    .mobile-nav-item.active {
        color: var(--ios-blue);
    }
    
    .mobile-nav-item:active {
        opacity: 0.6;
        transform: scale(0.95);
    }
    
    .mobile-nav-icon {
        font-size: 24px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-nav-label {
        font-size: 10px;
        font-weight: 500;
        letter-spacing: -0.2px;
    }
    
    /* ============================================
       MORE DRAWER (iOS STYLE)
       ============================================ */
    .mobile-drawer-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 2000;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-drawer-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .mobile-drawer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--color-white);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
        z-index: 2001;
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(var(--mobile-safe-area-bottom) + 20px);
    }
    
    .mobile-drawer.active {
        transform: translateY(0);
    }
    
    .mobile-drawer-header {
        position: sticky;
        top: 0;
        background: var(--color-white);
        padding: 16px 20px 12px;
        border-bottom: 1px solid var(--ios-separator);
        z-index: 1;
    }
    
    .mobile-drawer-handle {
        width: 36px;
        height: 5px;
        background: var(--ios-gray);
        border-radius: 3px;
        margin: 0 auto 12px;
        opacity: 0.3;
    }
    
    .mobile-drawer-title {
        font-family: var(--font-primary);
        font-size: 20px;
        font-weight: 700;
        color: var(--color-text-dark);
        margin: 0;
        text-align: center;
    }
    
    .mobile-drawer-close {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--ios-light-gray);
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--ios-gray);
        font-size: 18px;
        cursor: pointer;
        transition: background 0.2s ease;
    }
    
    .mobile-drawer-close:active {
        background: rgba(0, 0, 0, 0.1);
    }
    
    .mobile-drawer-content {
        padding: 8px 0;
    }
    
    .mobile-drawer-section {
        margin-bottom: 24px;
    }
    
    .mobile-drawer-section-title {
        font-family: var(--font-primary);
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--ios-gray);
        padding: 8px 20px;
        margin: 0;
    }
    
    .mobile-drawer-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .mobile-drawer-item {
        border-bottom: 1px solid var(--ios-separator);
    }
    
    .mobile-drawer-item:last-child {
        border-bottom: none;
    }
    
    .mobile-drawer-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 20px;
        text-decoration: none;
        color: var(--color-text-dark);
        font-family: var(--font-secondary);
        font-size: 16px;
        font-weight: 400;
        transition: background 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-drawer-link:active {
        background: var(--ios-light-gray);
    }
    
    .mobile-drawer-link-icon {
        color: var(--ios-blue);
        margin-right: 12px;
        font-size: 20px;
        width: 24px;
        text-align: center;
    }
    
    .mobile-drawer-link-text {
        flex: 1;
    }
    
    .mobile-drawer-link-chevron {
        color: var(--ios-gray);
        font-size: 14px;
        opacity: 0.5;
    }
    
    /* ============================================
       CONTENT SPACING ADJUSTMENTS
       ============================================ */
    .hero {
        padding-top: calc(var(--mobile-header-height) + var(--mobile-safe-area-top) + 40px);
        padding-bottom: 40px;
    }
    
    /* Adjust all main content to account for fixed header */
    main,
    .page-content {
        padding-top: calc(var(--mobile-header-height) + var(--mobile-safe-area-top));
    }
    
    /* ============================================
       SMOOTH SCROLLING & TOUCH OPTIMIZATION
       ============================================ */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }
    
    a, button {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    }
    
    /* Smooth momentum scrolling */
    body,
    .mobile-drawer {
        -webkit-overflow-scrolling: touch;
    }
    
    /* ============================================
       HIDE ELEMENTS NOT NEEDED ON MOBILE
       ============================================ */
    .desktop-only {
        display: none !important;
    }
    
    /* ============================================
       ACCESSIBILITY
       ============================================ */
    @media (prefers-reduced-motion: reduce) {
        .mobile-drawer,
        .mobile-drawer-overlay,
        .mobile-nav-item {
            transition: none;
        }
    }
}

/* ============================================
   TABLET & DESKTOP - HIDE MOBILE NAV
   ============================================ */
@media (min-width: 769px) {
    .mobile-bottom-nav,
    .mobile-drawer-overlay,
    .mobile-drawer {
        display: none !important;
    }
}
