/* Native Mobile App Experience */
/* This CSS creates an iOS/Android app-like experience on mobile devices */

/* Mobile-only styles (hidden on desktop) */
@media (max-width: 991px) {
    /* Remove default desktop navbar on mobile */
    .navbar-custom {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        background: white !important;
        border-bottom: 1px solid #e5e7eb;
        padding: 0.75rem 1rem !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }

    /* Compact mobile header */
    .navbar-custom .container-fluid {
        padding: 0;
    }

    .navbar-custom .navbar-brand {
        font-size: 1.25rem !important;
        font-weight: 700;
        margin: 0;
    }

    /* Always show navbar collapse on mobile */
    .navbar-custom .navbar-collapse {
        display: flex !important;
        position: static;
        background: transparent;
        padding: 0;
        margin: 0;
        border: none;
        flex-basis: auto;
    }

    /* Show navbar nav items on mobile (user dropdown) */
    .navbar-custom .navbar-nav {
        display: flex !important;
        flex-direction: row;
        align-items: center;
    }

    /* Hide hamburger menu entirely on mobile */
    .navbar-custom .navbar-toggler {
        display: none;
    }

    /* Hide regular nav links on mobile, but keep user dropdown */
    .navbar-custom .navbar-nav > .nav-item:not(.dropdown) {
        display: none;
    }

    .navbar-custom .navbar-collapse.show,
    .navbar-custom .navbar-collapse.collapsing {
        display: flex;
        flex-direction: column;
    }

    /* Mobile menu items - app-like */
    .navbar-custom .nav-link {
        font-size: 1.125rem !important;
        padding: 1rem 1.25rem !important;
        margin: 0.25rem 0 !important;
        border-radius: 12px;
        background: #f9fafb;
        border: 1px solid #e5e7eb;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .navbar-custom .nav-link:active {
        background: #f3f4f6;
        transform: scale(0.98);
    }

    /* Add body padding for fixed header */
    body {
        padding-top: 60px;
        padding-bottom: 80px; /* Space for bottom nav */
    }

    /* Native Mobile Bottom Navigation */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
        z-index: 1020;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
        justify-content: space-around;
        align-items: center;
    }

    .mobile-bottom-nav .nav-item {
        flex: 1;
        text-align: center;
    }

    .mobile-bottom-nav .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.5rem;
        color: #6b7280;
        text-decoration: none;
        font-size: 0.7rem;
        font-weight: 500;
        transition: all 0.2s ease;
        border-radius: 8px;
    }

    .mobile-bottom-nav .nav-link i {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .mobile-bottom-nav .nav-link.active {
        color: #2563eb;
    }

    .mobile-bottom-nav .nav-link:active {
        transform: scale(0.95);
        background: #f3f4f6;
    }

    /* Card-based layout for mobile */
    .card {
        border-radius: 16px !important;
        border: none !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
        margin-bottom: 1rem;
        overflow: hidden;
    }

    /* App-like containers */
    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Native-style buttons */
    .btn {
        border-radius: 12px !important;
        font-weight: 600;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        border: none;
        box-shadow: 0 1px 3px rgba(0,0,0,0.12);
        transition: all 0.2s ease;
        width: 100%;
    }

    .btn:active {
        transform: scale(0.98);
        box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    }

    .btn-primary {
        background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    }

    .btn-outline-primary {
        border: 2px solid #2563eb !important;
        background: white;
        color: #2563eb;
    }

    /* iOS-style form inputs */
    .form-control,
    .form-select {
        border-radius: 12px !important;
        border: 1px solid #e5e7eb;
        background: #f9fafb;
        padding: 1rem 1.25rem;
        font-size: 16px; /* Prevents zoom on iOS */
        transition: all 0.2s ease;
    }

    .form-control:focus,
    .form-select:focus {
        background: white;
        border-color: #2563eb;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    }

    /* App-style sections */
    section {
        padding: 1.5rem 0;
    }

    /* Pricing cards - app style */
    .pricing-card {
        border-radius: 20px !important;
        border: 2px solid #e5e7eb !important;
        background: white;
        margin-bottom: 1.5rem;
        transition: all 0.3s ease;
        overflow: hidden;
    }

    .pricing-card.border-primary {
        border-color: #2563eb !important;
        box-shadow: 0 4px 16px rgba(37, 99, 235, 0.15);
        transform: scale(1.02);
    }

    .pricing-card:active {
        transform: scale(0.98);
    }

    /* Dashboard stats - app style */
    .stat-card {
        background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
        border-radius: 16px;
        padding: 1.5rem;
        border: 1px solid #e5e7eb;
        margin-bottom: 1rem;
    }

    .stat-card h3 {
        font-size: 2rem;
        font-weight: 700;
        color: #111827;
        margin-bottom: 0.25rem;
    }

    .stat-card p {
        font-size: 0.875rem;
        color: #6b7280;
        margin: 0;
    }

    /* Image processing area */
    .upload-area {
        border: 2px dashed #cbd5e1;
        border-radius: 16px;
        padding: 3rem 1.5rem;
        text-align: center;
        background: #f9fafb;
        transition: all 0.3s ease;
        cursor: pointer;
    }

    .upload-area:active {
        background: #f3f4f6;
        border-color: #2563eb;
    }

    .upload-area.drag-over {
        border-color: #2563eb;
        background: #eff6ff;
    }

    /* Processing history - app style */
    .history-item {
        display: flex;
        align-items: center;
        padding: 1rem;
        background: white;
        border-radius: 12px;
        margin-bottom: 0.75rem;
        border: 1px solid #e5e7eb;
        transition: all 0.2s ease;
    }

    .history-item:active {
        transform: scale(0.98);
        background: #f9fafb;
    }

    .history-item img {
        width: 60px;
        height: 60px;
        object-fit: cover;
        border-radius: 8px;
        margin-right: 1rem;
    }

    /* Modal - full screen on mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        border-radius: 0;
        border: none;
        height: 100%;
    }

    .modal-header {
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        border-bottom: 1px solid #e5e7eb;
        padding: 1rem 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    /* Pull-to-refresh indicator */
    .pull-to-refresh {
        position: fixed;
        top: 60px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .pull-to-refresh.active {
        opacity: 1;
    }

    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide scrollbar but keep functionality */
    ::-webkit-scrollbar {
        width: 0px;
        background: transparent;
    }

    /* Tab bar style navigation */
    .nav-tabs {
        border: none;
        background: #f9fafb;
        border-radius: 12px;
        padding: 0.25rem;
        margin-bottom: 1.5rem;
    }

    .nav-tabs .nav-link {
        border: none;
        border-radius: 8px;
        padding: 0.75rem 1rem;
        color: #6b7280;
        font-weight: 600;
        transition: all 0.2s ease;
        margin: 0;
    }

    .nav-tabs .nav-link.active {
        background: white;
        color: #111827;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    /* Hero sections - mobile app style */
    .hero-section {
        background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
        border-radius: 0 0 32px 32px;
        padding: 2rem 0 3rem 0 !important;
        margin-bottom: 1.5rem;
        min-height: auto !important;
    }

    /* Floating action button */
    .fab {
        position: fixed;
        bottom: 90px; /* Above bottom nav */
        right: 1rem;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
        z-index: 1010;
        border: none;
        font-size: 1.5rem;
        transition: all 0.3s ease;
    }

    .fab:active {
        transform: scale(0.95);
    }

    /* Badge notifications */
    .notification-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        background: #ef4444;
        color: white;
        border-radius: 10px;
        padding: 0.125rem 0.375rem;
        font-size: 0.65rem;
        font-weight: 700;
        min-width: 18px;
        text-align: center;
    }

    /* Loading states */
    .skeleton {
        background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
        background-size: 200% 100%;
        animation: loading 1.5s ease-in-out infinite;
        border-radius: 8px;
    }

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

    /* Haptic feedback simulation */
    .haptic {
        transition: all 0.1s ease;
    }

    .haptic:active {
        transform: scale(0.97);
    }

    /* Safe area support for notched devices */
    @supports (padding: max(0px)) {
        body {
            padding-top: max(60px, env(safe-area-inset-top));
            padding-bottom: max(80px, env(safe-area-inset-bottom));
        }

        .mobile-bottom-nav {
            padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
        }
    }

    /* Reduce animations for users who prefer reduced motion */
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }

    /* Dark mode support (system preference) */
    @media (prefers-color-scheme: dark) {
        /* Optional: Add dark mode styles here if needed */
    }
}

/* Desktop: hide mobile-only elements */
@media (min-width: 992px) {
    .mobile-bottom-nav,
    .fab {
        display: none !important;
    }

    body {
        padding-top: 0;
        padding-bottom: 0;
    }
}
