/* Mobile/PWA optimizations */
:root {
    --safe-area-inset-top: env(safe-area-inset-top);
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
    --safe-area-inset-left: env(safe-area-inset-left);
    --safe-area-inset-right: env(safe-area-inset-right);
}

/* Prevent pull-to-refresh on iOS */
body {
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

/* Improve touch targets for mobile */
button, a, input {
    min-height: 44px;
    min-width: 44px;
}

/* Hide browser UI elements in standalone mode */
@media all and (display-mode: standalone) {
    .browser-only {
        display: none;
    }

    /* Adjust layout for fullscreen */
    .page {
        height: 100vh;
        height: -webkit-fill-available;
    }
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Stack layout vertically on mobile */
    .page {
        display: flex;
        flex-direction: column;
    }
    
    main {
        flex: 1;
        overflow-y: auto;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific styles */
    input, textarea, select {
        font-size: 16px; /* Prevents zoom on focus */
    }
}