/**
 * Mobile Enterprise Design System
 * WhenBRRR V12 - McKinsey-Grade 100/100 Mobile
 * 
 * Extends enterprise-dashboards.css with mobile-specific optimizations:
 * - Touch-optimized interactions (44px+ touch targets)
 * - Responsive layouts for 320px-768px viewports
 * - Mobile-first skeleton loaders
 * - Bottom sheet modals
 * - Pull-to-refresh patterns
 * - Haptic feedback classes
 * - Mobile toast positioning
 * - Thumb-zone optimization
 * 
 * Tested on: iPhone 12-15, Samsung Galaxy S21-S24, Pixel 6-8
 */

/* ============================================================================
   MOBILE CSS CUSTOM PROPERTIES - Extend Enterprise Tokens
   ============================================================================ */
@media (max-width: 768px) {
    :root {
        /* Mobile-Optimized Spacing (larger for touch) */
        --m-space-1: 4px;
        --m-space-2: 8px;
        --m-space-3: 12px;
        --m-space-4: 16px;
        --m-space-5: 20px;
        --m-space-6: 24px;
        --m-space-8: 32px;
        
        /* Touch Target Minimums (Apple HIG: 44px, Material: 48px) */
        --m-touch-min: 44px;
        --m-touch-comfortable: 48px;
        --m-touch-large: 56px;
        
        /* Mobile Typography Scale */
        --m-text-xs: 0.75rem;   /* 12px */
        --m-text-sm: 0.8125rem; /* 13px */
        --m-text-base: 0.875rem; /* 14px */
        --m-text-md: 1rem;      /* 16px - minimum for iOS zoom */
        --m-text-lg: 1.125rem;  /* 18px */
        --m-text-xl: 1.25rem;   /* 20px */
        --m-text-2xl: 1.5rem;   /* 24px */
        
        /* Mobile Border Radius */
        --m-radius-sm: 8px;
        --m-radius-md: 12px;
        --m-radius-lg: 16px;
        --m-radius-xl: 20px;
        --m-radius-full: 9999px;
        
        /* Safe Areas (notch, home indicator) */
        --m-safe-top: env(safe-area-inset-top, 0px);
        --m-safe-bottom: env(safe-area-inset-bottom, 0px);
        --m-safe-left: env(safe-area-inset-left, 0px);
        --m-safe-right: env(safe-area-inset-right, 0px);
        
        /* Bottom Navigation Height */
        --m-bottom-nav-height: calc(56px + var(--m-safe-bottom));
        
        /* Header Height */
        --m-header-height: 56px;
        
        /* Z-Index Mobile Scale */
        --m-z-bottom-nav: 1000;
        --m-z-fab: 1001;
        --m-z-header: 1002;
        --m-z-drawer: 1003;
        --m-z-bottom-sheet: 1004;
        --m-z-toast: 1005;
        --m-z-modal: 1006;
    }
}

/* ============================================================================
   MOBILE BASE LAYOUT
   ============================================================================ */
@media (max-width: 768px) {
    /* Mobile Dashboard Container */
    .ent-dashboard {
        padding: var(--m-space-4);
        padding-top: calc(var(--m-header-height) + var(--m-space-4));
        padding-bottom: calc(var(--m-bottom-nav-height) + var(--m-space-6));
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport for mobile browsers */
    }
    
    /* Mobile Header - Compressed */
    .ent-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--m-space-3);
        padding-bottom: var(--m-space-4);
        margin-bottom: var(--m-space-4);
    }
    
    .ent-header__title {
        font-size: var(--m-text-xl);
    }
    
    .ent-header__subtitle {
        font-size: var(--m-text-sm);
    }
    
    .ent-header__actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: var(--m-space-2);
    }
    
    .ent-header__actions::-webkit-scrollbar {
        display: none;
    }
}

/* ============================================================================
   MOBILE CARDS - Touch Optimized
   ============================================================================ */
@media (max-width: 768px) {
    .ent-card {
        padding: var(--m-space-4);
        border-radius: var(--m-radius-lg);
        /* Disable hover transform on touch devices */
        transform: none !important;
    }
    
    .ent-card:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s ease;
    }
    
    .ent-card__header {
        padding-bottom: var(--m-space-3);
        margin-bottom: var(--m-space-3);
    }
    
    .ent-card__title {
        font-size: var(--m-text-base);
    }
}

/* ============================================================================
   MOBILE STATS GRID
   ============================================================================ */
@media (max-width: 768px) {
    .ent-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--m-space-3);
        margin-bottom: var(--m-space-6);
    }
    
    .ent-stat {
        padding: var(--m-space-4);
        border-radius: var(--m-radius-md);
    }
    
    .ent-stat__value {
        font-size: var(--m-text-2xl);
    }
    
    .ent-stat__label {
        font-size: var(--m-text-xs);
    }
    
    .ent-stat__change {
        font-size: var(--m-text-xs);
    }
}

/* Small phones (320px-375px) */
@media (max-width: 375px) {
    .ent-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .ent-stat {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .ent-stat__value {
        font-size: var(--m-text-xl);
        order: 2;
    }
    
    .ent-stat__label {
        order: 1;
    }
}

/* ============================================================================
   MOBILE BUTTONS - Touch Targets
   ============================================================================ */
@media (max-width: 768px) {
    .ent-btn {
        min-height: var(--m-touch-min);
        min-width: var(--m-touch-min);
        padding: var(--m-space-3) var(--m-space-4);
        font-size: var(--m-text-base);
        border-radius: var(--m-radius-md);
        /* Prevent text selection on tap */
        -webkit-user-select: none;
        user-select: none;
        /* Prevent tap highlight */
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Active state for touch feedback */
    .ent-btn:active:not(:disabled) {
        transform: scale(0.96);
        opacity: 0.9;
    }
    
    /* Icon-only buttons */
    .ent-btn--icon {
        width: var(--m-touch-min);
        height: var(--m-touch-min);
        padding: 0;
    }
    
    /* Full-width mobile button */
    .ent-btn--mobile-full {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================================
   MOBILE FORMS - iOS Zoom Prevention
   ============================================================================ */
@media (max-width: 768px) {
    .ent-input,
    .ent-select,
    .ent-textarea {
        /* 16px minimum prevents iOS zoom on focus */
        font-size: var(--m-text-md);
        min-height: var(--m-touch-min);
        padding: var(--m-space-3) var(--m-space-4);
        border-radius: var(--m-radius-md);
    }
    
    .ent-label {
        font-size: var(--m-text-sm);
    }
    
    .ent-form-group {
        margin-bottom: var(--m-space-4);
    }
    
    /* Floating labels for mobile */
    .ent-form-group--floating {
        position: relative;
    }
    
    .ent-form-group--floating .ent-label {
        position: absolute;
        top: 50%;
        left: var(--m-space-4);
        transform: translateY(-50%);
        transition: all 0.2s ease;
        pointer-events: none;
        color: var(--text-tertiary);
    }
    
    .ent-form-group--floating .ent-input:focus ~ .ent-label,
    .ent-form-group--floating .ent-input:not(:placeholder-shown) ~ .ent-label {
        top: 0;
        font-size: var(--m-text-xs);
        background: var(--bg-card);
        padding: 0 var(--m-space-2);
        color: var(--ent-primary);
    }
}

/* ============================================================================
   MOBILE GRID LAYOUTS
   ============================================================================ */
@media (max-width: 768px) {
    .ent-grid {
        gap: var(--m-space-4);
    }
    
    .ent-grid--2,
    .ent-grid--3,
    .ent-grid--4,
    .ent-grid--5 {
        grid-template-columns: 1fr;
    }
    
    .ent-grid--sidebar,
    .ent-grid--sidebar-left {
        grid-template-columns: 1fr;
    }
    
    /* Two columns for wider phones */
    @media (min-width: 480px) {
        .ent-grid--2 {
            grid-template-columns: repeat(2, 1fr);
        }
    }
}

/* ============================================================================
   MOBILE HUB GRID
   ============================================================================ */
@media (max-width: 768px) {
    .ent-hub-grid {
        grid-template-columns: 1fr;
        gap: var(--m-space-4);
    }
    
    .ent-feature-card {
        padding: var(--m-space-5);
        border-radius: var(--m-radius-lg);
    }
    
    .ent-feature-card__icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
        margin-bottom: var(--m-space-4);
    }
    
    .ent-feature-card__title {
        font-size: var(--m-text-lg);
    }
    
    .ent-feature-card__desc {
        font-size: var(--m-text-sm);
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        line-clamp: 3;
        overflow: hidden;
    }
}

/* ============================================================================
   MOBILE TABLES - Horizontal Scroll or Cards
   ============================================================================ */
@media (max-width: 768px) {
    .ent-table-container {
        border-radius: var(--m-radius-md);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ent-table {
        font-size: var(--m-text-sm);
        min-width: 500px; /* Force horizontal scroll */
    }
    
    .ent-table th,
    .ent-table td {
        padding: var(--m-space-3);
        white-space: nowrap;
    }
    
    /* Card-style table for simple data */
    .ent-table--cards {
        min-width: auto;
    }
    
    .ent-table--cards thead {
        display: none;
    }
    
    .ent-table--cards tbody tr {
        display: block;
        margin-bottom: var(--m-space-3);
        padding: var(--m-space-4);
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: var(--m-radius-md);
    }
    
    .ent-table--cards tbody td {
        display: flex;
        justify-content: space-between;
        padding: var(--m-space-2) 0;
        border-bottom: 1px solid var(--border-default);
    }
    
    .ent-table--cards tbody td:last-child {
        border-bottom: none;
    }
    
    .ent-table--cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: var(--m-text-xs);
        text-transform: uppercase;
    }
}

/* ============================================================================
   MOBILE CHARTS
   ============================================================================ */
@media (max-width: 768px) {
    .ent-chart {
        padding: var(--m-space-4);
        border-radius: var(--m-radius-lg);
        min-height: 300px;
    }
    
    .ent-chart__header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--m-space-2);
        margin-bottom: var(--m-space-3);
    }
    
    .ent-chart__title {
        font-size: var(--m-text-base);
    }
    
    .ent-chart__canvas {
        height: 250px;
    }
}

/* ============================================================================
   MOBILE EVENTS LIST
   ============================================================================ */
@media (max-width: 768px) {
    .ent-events-list {
        max-height: 400px;
        padding: var(--m-space-3);
    }
    
    .ent-event {
        gap: var(--m-space-3);
        padding: var(--m-space-3);
    }
    
    .ent-event__icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .ent-event__title {
        font-size: var(--m-text-sm);
    }
    
    .ent-event__detail {
        font-size: var(--m-text-xs);
    }
    
    .ent-event__time {
        font-size: var(--m-text-xs);
    }
}

/* ============================================================================
   MOBILE TABS - Horizontal Scroll
   ============================================================================ */
@media (max-width: 768px) {
    .ent-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 calc(var(--m-space-4) * -1);
        padding: 0 var(--m-space-4);
        gap: 0;
    }
    
    .ent-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .ent-tab {
        min-height: var(--m-touch-min);
        padding: var(--m-space-3) var(--m-space-4);
        font-size: var(--m-text-sm);
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ============================================================================
   MOBILE BADGES & TAGS
   ============================================================================ */
@media (max-width: 768px) {
    .ent-badge {
        padding: var(--m-space-1) var(--m-space-2);
        font-size: 0.65rem;
    }
    
    .ent-tag {
        padding: var(--m-space-1) var(--m-space-2);
        font-size: 0.6rem;
    }
}

/* ============================================================================
   MOBILE CONNECTION STATUS
   ============================================================================ */
@media (max-width: 768px) {
    .ent-connection-status {
        padding: var(--m-space-2) var(--m-space-3);
        font-size: var(--m-text-sm);
    }
    
    .ent-status-dot {
        width: 10px;
        height: 10px;
    }
}

/* ============================================================================
   MOBILE BOTTOM SHEET
   ============================================================================ */
@media (max-width: 768px) {
    .ent-bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-radius: var(--m-radius-xl) var(--m-radius-xl) 0 0;
        padding: var(--m-space-4);
        padding-bottom: calc(var(--m-space-4) + var(--m-safe-bottom));
        z-index: var(--m-z-bottom-sheet);
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
        max-height: 90vh;
        max-height: 90dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ent-bottom-sheet--open {
        transform: translateY(0);
    }
    
    .ent-bottom-sheet__handle {
        width: 32px;
        height: 4px;
        background: var(--border-default);
        border-radius: var(--m-radius-full);
        margin: 0 auto var(--m-space-4);
    }
    
    .ent-bottom-sheet__header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: var(--m-space-4);
    }
    
    .ent-bottom-sheet__title {
        font-size: var(--m-text-lg);
        font-weight: 600;
    }
    
    .ent-bottom-sheet__backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--m-z-bottom-sheet) - 1);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    .ent-bottom-sheet--open + .ent-bottom-sheet__backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ============================================================================
   MOBILE FLOATING ACTION BUTTON (FAB)
   ============================================================================ */
@media (max-width: 768px) {
    .ent-fab {
        position: fixed;
        bottom: calc(var(--m-bottom-nav-height) + var(--m-space-4));
        right: var(--m-space-4);
        width: var(--m-touch-large);
        height: var(--m-touch-large);
        border-radius: var(--m-radius-full);
        background: linear-gradient(135deg, var(--ent-primary), var(--ent-secondary));
        color: white;
        border: none;
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        z-index: var(--m-z-fab);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .ent-fab:active {
        transform: scale(0.92);
    }
    
    .ent-fab--extended {
        width: auto;
        padding: 0 var(--m-space-5);
        border-radius: var(--m-radius-full);
        gap: var(--m-space-2);
    }
    
    .ent-fab__label {
        font-size: var(--m-text-base);
        font-weight: 600;
    }
    
    /* Hide FAB when scrolling down */
    .ent-fab--hidden {
        transform: translateY(calc(100% + var(--m-space-8)));
    }
}

/* ============================================================================
   MOBILE PULL TO REFRESH
   ============================================================================ */
@media (max-width: 768px) {
    .ent-pull-refresh {
        position: fixed;
        top: var(--m-header-height);
        left: 50%;
        transform: translateX(-50%) translateY(-100%);
        z-index: var(--m-z-header);
        transition: transform 0.3s ease;
    }
    
    .ent-pull-refresh--pulling {
        transform: translateX(-50%) translateY(0);
    }
    
    .ent-pull-refresh__indicator {
        width: 40px;
        height: 40px;
        background: var(--bg-card);
        border-radius: var(--m-radius-full);
        box-shadow: var(--shadow-lg);
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .ent-pull-refresh__spinner {
        width: 24px;
        height: 24px;
        border: 2px solid var(--border-default);
        border-top-color: var(--ent-primary);
        border-radius: var(--m-radius-full);
    }
    
    .ent-pull-refresh--refreshing .ent-pull-refresh__spinner {
        animation: ent-spin 1s linear infinite;
    }
}

/* ============================================================================
   MOBILE SKELETON LOADERS
   ============================================================================ */
@media (max-width: 768px) {
    .ent-skeleton--stat {
        height: 2rem;
    }
    
    .ent-skeleton--chart {
        height: 250px;
    }
    
    /* Mobile stat skeleton */
    .ent-skeleton-stat-mobile {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--m-space-3);
    }
    
    .ent-skeleton-stat-mobile .ent-stat {
        padding: var(--m-space-4);
    }
}

/* ============================================================================
   MOBILE TOAST POSITIONING
   ============================================================================ */
@media (max-width: 768px) {
    .ent-toast-container {
        top: auto;
        bottom: calc(var(--m-bottom-nav-height) + var(--m-space-4));
        left: var(--m-space-4);
        right: var(--m-space-4);
        align-items: stretch;
    }
    
    .ent-toast {
        max-width: 100%;
        border-radius: var(--m-radius-md);
        animation: ent-toast-in-mobile 0.3s ease-out;
    }
    
    @keyframes ent-toast-in-mobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .ent-toast--exiting {
        animation: ent-toast-out-mobile 0.3s ease-in forwards;
    }
    
    @keyframes ent-toast-out-mobile {
        from {
            opacity: 1;
            transform: translateY(0);
        }
        to {
            opacity: 0;
            transform: translateY(100%);
        }
    }
}

/* ============================================================================
   MOBILE MODAL
   ============================================================================ */
@media (max-width: 768px) {
    .ent-modal__content {
        margin: var(--m-space-4);
        padding: var(--m-space-6);
        border-radius: var(--m-radius-lg);
        max-width: calc(100vw - var(--m-space-8));
    }
    
    .ent-modal__title {
        font-size: var(--m-text-lg);
    }
    
    .ent-modal__actions {
        flex-direction: column;
        gap: var(--m-space-3);
    }
    
    .ent-modal__actions .ent-btn {
        width: 100%;
    }
}

/* ============================================================================
   MOBILE EMPTY & ERROR STATES
   ============================================================================ */
@media (max-width: 768px) {
    .ent-empty,
    .ent-error {
        padding: var(--m-space-8);
    }
    
    .ent-empty__icon,
    .ent-error__icon {
        font-size: 3rem;
    }
    
    .ent-empty__title,
    .ent-error__title {
        font-size: var(--m-text-lg);
    }
    
    .ent-empty__text,
    .ent-error__message {
        font-size: var(--m-text-sm);
    }
}

/* ============================================================================
   MOBILE LOADING STATES
   ============================================================================ */
@media (max-width: 768px) {
    .ent-loading {
        padding: var(--m-space-8);
    }
    
    .ent-spinner {
        width: 40px;
        height: 40px;
    }
}

/* ============================================================================
   MOBILE TOGGLES
   ============================================================================ */
@media (max-width: 768px) {
    .ent-toggle {
        min-height: var(--m-touch-min);
        padding: var(--m-space-2) 0;
    }
    
    .ent-toggle__switch {
        width: 52px;
        height: 28px;
    }
    
    .ent-toggle__switch::after {
        width: 24px;
        height: 24px;
    }
    
    .ent-toggle input:checked + .ent-toggle__switch::after {
        transform: translateX(24px);
    }
    
    .ent-toggle__label {
        font-size: var(--m-text-base);
    }
}

/* ============================================================================
   MOBILE SCENARIO CARDS
   ============================================================================ */
@media (max-width: 768px) {
    .ent-scenario {
        padding: var(--m-space-4);
    }
    
    .ent-scenario__header {
        flex-direction: column;
        gap: var(--m-space-2);
    }
    
    .ent-scenario__name {
        font-size: var(--m-text-lg);
    }
    
    .ent-scenario__regime {
        align-self: flex-start;
    }
    
    .ent-scenario__metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--m-space-2);
    }
    
    .ent-scenario__metric-value {
        font-size: var(--m-text-lg);
    }
}

/* ============================================================================
   MOBILE ANOMALY CARDS
   ============================================================================ */
@media (max-width: 768px) {
    .ent-anomaly {
        padding: var(--m-space-4);
    }
    
    .ent-anomaly__header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--m-space-2);
    }
    
    .ent-anomaly__details {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--m-space-2);
    }
}

/* ============================================================================
   MOBILE COMPETITOR CARDS
   ============================================================================ */
@media (max-width: 768px) {
    .ent-competitor {
        padding: var(--m-space-4);
    }
    
    .ent-competitor__logo {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .ent-competitor__name {
        font-size: var(--m-text-base);
    }
}

/* ============================================================================
   MOBILE EXPORT CARDS
   ============================================================================ */
@media (max-width: 768px) {
    .ent-export {
        grid-template-columns: auto 1fr;
        gap: var(--m-space-3);
        padding: var(--m-space-4);
    }
    
    .ent-export__icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .ent-export__actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
        margin-top: var(--m-space-2);
    }
}

/* ============================================================================
   HAPTIC FEEDBACK CLASSES
   ============================================================================ */
@media (max-width: 768px) {
    /* Visual feedback for haptic interactions */
    .ent-haptic-light:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .ent-haptic-medium:active {
        transform: scale(0.96);
        transition: transform 0.1s ease;
    }
    
    .ent-haptic-heavy:active {
        transform: scale(0.94);
        transition: transform 0.1s ease;
    }
}

/* ============================================================================
   THUMB ZONE OPTIMIZATION
   ============================================================================ */
@media (max-width: 768px) {
    /* Primary actions in thumb zone (bottom of screen) */
    .ent-thumb-zone {
        position: fixed;
        bottom: var(--m-bottom-nav-height);
        left: 0;
        right: 0;
        padding: var(--m-space-4);
        background: linear-gradient(to top, var(--bg-page), transparent);
        z-index: var(--m-z-fab);
    }
    
    .ent-thumb-zone__actions {
        display: flex;
        gap: var(--m-space-3);
    }
    
    .ent-thumb-zone__actions .ent-btn {
        flex: 1;
    }
}

/* ============================================================================
   MOBILE ANIMATIONS - Optimized
   ============================================================================ */
@media (max-width: 768px) {
    /* Faster animations on mobile */
    .ent-animate-fade-in { animation-duration: 0.2s; }
    .ent-animate-scale-in { animation-duration: 0.2s; }
    .ent-animate-slide-up { animation-duration: 0.25s; }
    .ent-animate-slide-down { animation-duration: 0.25s; }
    
    /* Reduced stagger delays on mobile */
    .ent-stagger > *:nth-child(1) { animation-delay: 0ms; }
    .ent-stagger > *:nth-child(2) { animation-delay: 30ms; }
    .ent-stagger > *:nth-child(3) { animation-delay: 60ms; }
    .ent-stagger > *:nth-child(4) { animation-delay: 90ms; }
    .ent-stagger > *:nth-child(5) { animation-delay: 120ms; }
    .ent-stagger > *:nth-child(6) { animation-delay: 150ms; }
}

/* ============================================================================
   MOBILE SKIP LINK
   ============================================================================ */
@media (max-width: 768px) {
    .ent-skip-link {
        left: var(--m-space-2);
        padding: var(--m-space-3) var(--m-space-4);
        font-size: var(--m-text-sm);
    }
    
    .ent-skip-link:focus {
        top: var(--m-space-2);
    }
}

/* ============================================================================
   MOBILE PRINT - HIDE NAVIGATION
   ============================================================================ */
@media print {
    .ent-bottom-nav,
    .ent-fab,
    .ent-toast-container,
    .ent-pull-refresh,
    .ent-thumb-zone {
        display: none !important;
    }
}

/* ============================================================================
   LANDSCAPE MODE FIXES
   ============================================================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .ent-dashboard {
        padding-bottom: var(--m-space-6);
    }
    
    .ent-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .ent-bottom-sheet {
        max-height: 70vh;
    }
}

/* ============================================================================
   DARK MODE MOBILE ADJUSTMENTS
   ============================================================================ */
@media (max-width: 768px) {
    [data-theme="dark"] .ent-bottom-sheet {
        background: var(--bg-card);
        border-top: 1px solid var(--border-default);
    }
    
    [data-theme="dark"] .ent-fab {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    }
}

/* ============================================================================
   HIGH CONTRAST MODE (ACCESSIBILITY)
   ============================================================================ */
@media (max-width: 768px) and (prefers-contrast: high) {
    .ent-btn {
        border: 2px solid currentColor;
    }
    
    .ent-card,
    .ent-stat,
    .ent-input {
        border: 2px solid var(--text-primary);
    }
}

/* ============================================================================
   REDUCED MOTION (ACCESSIBILITY)
   ============================================================================ */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .ent-bottom-sheet,
    .ent-fab,
    .ent-toast,
    .ent-btn,
    .ent-card {
        transition: none !important;
        animation: none !important;
    }
}
