/* Mobile and Tablet Optimization Styles for Deyoung Engineering MMS */

/* Mobile-first responsive design enhancements */

/* Touch-friendly interactions */
@media (max-width: 768px) {
    /* Increase touch targets for mobile */
    .touch-target {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger buttons on mobile */
    .btn-mobile {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    /* Better spacing on mobile */
    .mobile-spacing {
        margin-bottom: 1rem;
    }

    /* Improved form inputs for mobile */
    .mobile-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }

    /* Stack grid items vertically on mobile */
    .grid-mobile-stack {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Hide desktop-only elements on mobile */
    .desktop-only {
        display: none !important;
    }

    /* Show mobile-only elements */
    .mobile-only {
        display: block !important;
    }
}

/* Tablet-specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .tablet-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tablet-text {
        font-size: 0.95rem;
    }
}

/* Modal improvements for mobile */
.mobile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
}

.mobile-modal-content {
    background: #0f172a;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(16px);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    margin-top: 2rem;
}

/* Swipe gestures support */
.swipe-container {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* Mobile navigation improvements */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem;
    z-index: 100;
    display: none;
}

@media (max-width: 768px) {
    .mobile-nav {
        display: flex;
    }

    /* Hide main navigation on mobile when bottom nav is active */
    .main-nav-mobile-hidden {
        display: none;
    }
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.75rem;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.mobile-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

/* Table responsiveness improvements */
@media (max-width: 768px) {
    .responsive-table {
        font-size: 0.875rem;
    }

    .responsive-table th,
    .responsive-table td {
        padding: 0.5rem;
    }

    /* Card layout for table rows on mobile */
    .table-mobile-cards .table-row {
        display: block;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .table-mobile-cards .table-row:not(:last-child) {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .table-mobile-cards .cell-label {
        font-weight: 600;
        color: #94a3b8;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.25rem;
    }

    .table-mobile-cards .cell-value {
        color: #f1f5f9;
        margin-bottom: 0.75rem;
    }
}

/* Form improvements for mobile */
@media (max-width: 768px) {
    .mobile-form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .mobile-form-section {
        margin-bottom: 1.5rem;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 0.5rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-form-section h3 {
        margin-bottom: 1rem;
        color: #f1f5f9;
        font-size: 1.125rem;
        font-weight: 600;
    }
}

/* Loading states for mobile */
.mobile-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #94a3b8;
}

.mobile-loading i {
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* Notification improvements for mobile */
@media (max-width: 768px) {
    .mobile-toast {
        position: fixed;
        bottom: 4rem;
        left: 1rem;
        right: 1rem;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 0.5rem;
        padding: 1rem;
        z-index: 1000;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .mobile-toast.show {
        transform: translateY(0);
    }

    .mobile-toast.success {
        border-color: rgba(34, 197, 94, 0.5);
        background: rgba(34, 197, 94, 0.1);
    }

    .mobile-toast.error {
        border-color: rgba(239, 68, 68, 0.5);
        background: rgba(239, 68, 68, 0.1);
    }
}

/* Improved focus states for mobile */
@media (max-width: 768px) {
    .mobile-focus:focus {
        outline: 2px solid #3b82f6;
        outline-offset: 2px;
        border-radius: 0.375rem;
    }

    /* Better keyboard navigation */
    .mobile-focus:focus-visible {
        outline: 2px solid #3b82f6;
        outline-offset: 2px;
    }
}

/* Safe area support for devices with notches */
@supports (padding: max(0px)) {
    .safe-area-top {
        padding-top: max(1rem, env(safe-area-inset-top));
    }

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

    .safe-area-left {
        padding-left: max(1rem, env(safe-area-inset-left));
    }

    .safe-area-right {
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    /* Reduce motion for better performance on mobile */
    .mobile-perf * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }

    /* Disable hover effects on touch devices */
    @media (hover: none) {
        .hover-mobile-none:hover {
            transform: none !important;
            background: none !important;
        }
    }
}

/* Dark mode optimizations for mobile */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .dark-mobile-enhanced {
        background: #0f172a;
        color: #f1f5f9;
    }
}

/* Print styles for mobile (hide unnecessary elements when printing) */
@media print {
    .no-print {
        display: none !important;
    }

    .print-break {
        page-break-before: always;
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    /* Larger focus indicators */
    .mobile-accessibility:focus {
        outline: 3px solid #3b82f6;
        outline-offset: 3px;
    }

    /* Better contrast for links */
    .mobile-accessibility-link {
        text-decoration: underline;
        text-decoration-color: #3b82f6;
    }

    /* Skip links for screen readers */
    .mobile-skip-link {
        position: absolute;
        top: -40px;
        left: 6px;
        background: #3b82f6;
        color: white;
        padding: 8px;
        text-decoration: none;
        border-radius: 4px;
        z-index: 100;
    }

    .mobile-skip-link:focus {
        top: 6px;
    }
}