/**
 * McKinsey Mobile Premium Components
 * WhenBRRR V12 - Enterprise-Grade Mobile Experience
 * 
 * Premium mobile components that deliver McKinsey-quality UX.
 * Builds on mobile-enterprise-tokens.css for consistent theming.
 * 
 * Component Categories:
 *   1. Touch Interaction Feedback
 *   2. Premium Cards & Surfaces
 *   3. Navigation Components
 *   4. Bottom Sheets & Modals
 *   5. Form Elements
 *   6. Loading & Skeleton States
 *   7. Gesture Utilities
 *   8. Micro-Animations
 *   9. Toast & Notifications
 *   10. Status Indicators
 * 
 * Tested on: iPhone 12-15, Samsung Galaxy S21-S24, Pixel 6-8
 */

/* ============================================================================
   1. TOUCH INTERACTION FEEDBACK
   Premium tap, press, and gesture feedback
   ============================================================================ */
@media (max-width: 768px) {
    /* Base touch feedback - Ripple effect container */
    .m-touch-feedback {
        position: relative;
        overflow: hidden;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        cursor: pointer;
    }
    
    .m-touch-feedback::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: var(--m-color-tap-overlay);
        transform: translate(-50%, -50%);
        transition: width var(--m-duration-normal) var(--m-ease-out),
                    height var(--m-duration-normal) var(--m-ease-out),
                    opacity var(--m-duration-normal) var(--m-ease-out);
        pointer-events: none;
    }
    
    .m-touch-feedback:active::after {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
    
    /* Scale feedback - Subtle press effect */
    .m-press-scale {
        transition: transform var(--m-duration-fast) var(--m-ease-out);
        -webkit-tap-highlight-color: transparent;
    }
    
    .m-press-scale:active {
        transform: scale(0.97);
    }
    
    /* Bounce feedback - iOS-style spring */
    .m-press-bounce {
        transition: transform var(--m-duration-normal) var(--m-ease-spring);
        -webkit-tap-highlight-color: transparent;
    }
    
    .m-press-bounce:active {
        transform: scale(0.95);
    }
    
    /* Opacity feedback - Subtle highlight */
    .m-press-opacity {
        transition: opacity var(--m-duration-fast) var(--m-ease-out);
        -webkit-tap-highlight-color: transparent;
    }
    
    .m-press-opacity:active {
        opacity: 0.7;
    }
    
    /* Background highlight feedback */
    .m-press-highlight {
        transition: background-color var(--m-duration-fast) var(--m-ease-out);
        -webkit-tap-highlight-color: transparent;
    }
    
    .m-press-highlight:active {
        background-color: var(--m-color-tap-overlay);
    }
    
    /* Long press indicator */
    .m-long-press-indicator {
        position: relative;
    }
    
    .m-long-press-indicator::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        border: 2px solid transparent;
        transition: border-color var(--m-duration-slow) var(--m-ease-out);
    }
    
    .m-long-press-indicator.is-pressing::before {
        border-color: var(--color-primary, #667eea);
        animation: m-pulse-border var(--m-long-press-duration) var(--m-ease-out);
    }
    
    @keyframes m-pulse-border {
        0% { opacity: 0.3; }
        100% { opacity: 1; }
    }
}

/* ============================================================================
   2. PREMIUM CARDS & SURFACES
   McKinsey-grade card components
   ============================================================================ */
@media (max-width: 768px) {
    /* Premium card base */
    .m-card-premium {
        background: var(--color-surface, #ffffff);
        border-radius: var(--m-radius-card);
        padding: var(--m-space-card);
        box-shadow: var(--m-shadow-card);
        border: 1px solid var(--color-border, rgba(0, 0, 0, 0.06));
        transition: transform var(--m-duration-normal) var(--m-ease-out),
                    box-shadow var(--m-duration-normal) var(--m-ease-out);
    }
    
    .m-card-premium:active {
        transform: scale(0.98);
        box-shadow: var(--m-shadow-xs);
    }
    
    /* Glass card - Frosted glass effect */
    .m-card-glass {
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(var(--m-blur-md)) saturate(180%);
        -webkit-backdrop-filter: blur(var(--m-blur-md)) saturate(180%);
        border-radius: var(--m-radius-card);
        padding: var(--m-space-card);
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: var(--m-shadow-sm);
    }
    
    [data-theme="dark"] .m-card-glass {
        background: rgba(30, 30, 40, 0.85);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Metric card - For KPI displays */
    .m-card-metric {
        background: linear-gradient(135deg, 
            var(--color-surface, #ffffff) 0%, 
            var(--color-surface-alt, #f8fafc) 100%);
        border-radius: var(--m-radius-card);
        padding: var(--m-space-5);
        border: 1px solid var(--color-border, rgba(0, 0, 0, 0.06));
        position: relative;
        overflow: hidden;
    }
    
    .m-card-metric::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, 
            var(--color-primary, #667eea), 
            var(--color-secondary, #764ba2));
    }
    
    .m-card-metric__value {
        font-size: var(--m-text-3xl);
        font-weight: 700;
        line-height: var(--m-leading-tight);
        letter-spacing: var(--m-tracking-tight);
        color: var(--color-text, #1f2937);
    }
    
    .m-card-metric__label {
        font-size: var(--m-text-xs);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: var(--m-tracking-wide);
        color: var(--color-text-muted, #6b7280);
        margin-top: var(--m-space-1);
    }
    
    .m-card-metric__trend {
        display: inline-flex;
        align-items: center;
        gap: var(--m-space-1);
        font-size: var(--m-text-sm);
        font-weight: 600;
        margin-top: var(--m-space-2);
    }
    
    .m-card-metric__trend--up {
        color: var(--color-success, #10b981);
    }
    
    .m-card-metric__trend--down {
        color: var(--color-error, #ef4444);
    }
    
    /* Interactive card - For tappable actions */
    .m-card-interactive {
        background: var(--color-surface, #ffffff);
        border-radius: var(--m-radius-card);
        padding: var(--m-space-card);
        border: 1px solid var(--color-border, rgba(0, 0, 0, 0.06));
        display: flex;
        align-items: center;
        gap: var(--m-space-4);
        min-height: var(--m-touch-xl);
        cursor: pointer;
        transition: all var(--m-duration-fast) var(--m-ease-out);
        -webkit-tap-highlight-color: transparent;
    }
    
    .m-card-interactive:active {
        background: var(--color-surface-alt, #f8fafc);
        transform: scale(0.98);
    }
    
    .m-card-interactive__icon {
        width: 48px;
        height: 48px;
        border-radius: var(--m-radius-lg);
        background: linear-gradient(135deg, 
            rgba(102, 126, 234, 0.1), 
            rgba(118, 75, 162, 0.1));
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .m-card-interactive__content {
        flex: 1;
        min-width: 0;
    }
    
    .m-card-interactive__title {
        font-size: var(--m-text-base);
        font-weight: 600;
        color: var(--color-text, #1f2937);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .m-card-interactive__subtitle {
        font-size: var(--m-text-sm);
        color: var(--color-text-muted, #6b7280);
        margin-top: var(--m-space-0-5);
    }
    
    .m-card-interactive__chevron {
        color: var(--color-text-muted, #6b7280);
        flex-shrink: 0;
        transition: transform var(--m-duration-fast) var(--m-ease-out);
    }
    
    .m-card-interactive:active .m-card-interactive__chevron {
        transform: translateX(2px);
    }
}

/* ============================================================================
   3. NAVIGATION COMPONENTS
   Mobile navigation elements
   ============================================================================ */
@media (max-width: 768px) {
    /* Premium bottom nav */
    .m-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--m-bottom-nav-height);
        background: var(--color-surface, #ffffff);
        border-top: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding-bottom: var(--m-safe-bottom);
        z-index: var(--m-z-bottom-nav);
        box-shadow: var(--m-shadow-header);
    }
    
    [data-theme="dark"] .m-bottom-nav {
        background: var(--color-surface, #1f2937);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .m-bottom-nav__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--m-space-1);
        padding: var(--m-space-2);
        min-width: 64px;
        min-height: var(--m-touch-min);
        color: var(--color-text-muted, #6b7280);
        text-decoration: none;
        font-size: var(--m-text-2xs);
        font-weight: 500;
        transition: color var(--m-duration-fast) var(--m-ease-out);
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }
    
    .m-bottom-nav__item:active {
        color: var(--color-primary, #667eea);
    }
    
    .m-bottom-nav__item.is-active {
        color: var(--color-primary, #667eea);
    }
    
    .m-bottom-nav__item.is-active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 32px;
        height: 3px;
        background: var(--color-primary, #667eea);
        border-radius: 0 0 var(--m-radius-full) var(--m-radius-full);
    }
    
    .m-bottom-nav__icon {
        width: 24px;
        height: 24px;
        transition: transform var(--m-duration-fast) var(--m-ease-spring);
    }
    
    .m-bottom-nav__item:active .m-bottom-nav__icon {
        transform: scale(0.9);
    }
    
    .m-bottom-nav__item.is-active .m-bottom-nav__icon {
        transform: scale(1.1);
    }
    
    .m-bottom-nav__badge {
        position: absolute;
        top: var(--m-space-1);
        right: var(--m-space-2);
        min-width: 18px;
        height: 18px;
        padding: 0 var(--m-space-1);
        background: var(--color-error, #ef4444);
        color: white;
        border-radius: var(--m-radius-full);
        font-size: 10px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Premium header */
    .m-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: var(--m-header-height);
        padding-top: var(--m-safe-top);
        background: var(--color-surface, #ffffff);
        border-bottom: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
        display: flex;
        align-items: center;
        padding-left: var(--m-space-4);
        padding-right: var(--m-space-4);
        z-index: var(--m-z-header);
        box-shadow: var(--m-shadow-header);
    }
    
    [data-theme="dark"] .m-header {
        background: var(--color-surface, #1f2937);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .m-header__leading {
        display: flex;
        align-items: center;
        gap: var(--m-space-2);
        flex-shrink: 0;
    }
    
    .m-header__title {
        flex: 1;
        font-size: var(--m-text-lg);
        font-weight: 600;
        color: var(--color-text, #1f2937);
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .m-header__trailing {
        display: flex;
        align-items: center;
        gap: var(--m-space-2);
        flex-shrink: 0;
    }
    
    /* Scrollable tabs */
    .m-tabs-scroll {
        display: flex;
        overflow-x: auto;
        gap: var(--m-space-1);
        padding: var(--m-space-2) var(--m-space-4);
        margin: 0 calc(var(--m-space-4) * -1);
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }
    
    .m-tabs-scroll::-webkit-scrollbar {
        display: none;
    }
    
    .m-tab {
        flex-shrink: 0;
        padding: var(--m-space-2) var(--m-space-4);
        min-height: var(--m-touch-min);
        border-radius: var(--m-radius-full);
        font-size: var(--m-text-sm);
        font-weight: 500;
        color: var(--color-text-muted, #6b7280);
        background: transparent;
        border: none;
        cursor: pointer;
        transition: all var(--m-duration-fast) var(--m-ease-out);
        -webkit-tap-highlight-color: transparent;
        scroll-snap-align: start;
    }
    
    .m-tab:active {
        background: var(--color-surface-alt, #f3f4f6);
    }
    
    .m-tab.is-active {
        background: var(--color-primary, #667eea);
        color: white;
    }
}

/* ============================================================================
   4. BOTTOM SHEETS & MODALS
   iOS-style presentation
   ============================================================================ */
@media (max-width: 768px) {
    /* Bottom sheet */
    .m-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 90vh;
        max-height: 90dvh;
        background: var(--color-surface, #ffffff);
        border-radius: var(--m-radius-sheet);
        padding: var(--m-space-4);
        padding-bottom: calc(var(--m-space-4) + var(--m-safe-bottom));
        z-index: var(--m-z-sheet);
        transform: translateY(100%);
        transition: transform var(--m-duration-slow) var(--m-ease-sheet);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: var(--m-shadow-sheet);
    }
    
    [data-theme="dark"] .m-sheet {
        background: var(--color-surface, #1f2937);
    }
    
    .m-sheet.is-open {
        transform: translateY(0);
    }
    
    .m-sheet__handle {
        width: 36px;
        height: 5px;
        background: var(--color-border, rgba(0, 0, 0, 0.15));
        border-radius: var(--m-radius-full);
        margin: 0 auto var(--m-space-4);
        cursor: grab;
    }
    
    .m-sheet__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: var(--m-space-4);
    }
    
    .m-sheet__title {
        font-size: var(--m-text-xl);
        font-weight: 600;
        color: var(--color-text, #1f2937);
    }
    
    .m-sheet__close {
        width: var(--m-touch-min);
        height: var(--m-touch-min);
        border-radius: var(--m-radius-full);
        background: var(--color-surface-alt, #f3f4f6);
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .m-sheet__close:active {
        background: var(--color-border, #e5e7eb);
    }
    
    /* Sheet backdrop */
    .m-sheet-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--m-z-sheet) - 1);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--m-duration-normal) var(--m-ease-out);
    }
    
    .m-sheet-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }
    
    /* Action sheet */
    .m-action-sheet {
        padding: var(--m-space-2);
    }
    
    .m-action-sheet__item {
        width: 100%;
        padding: var(--m-space-4);
        min-height: var(--m-touch-lg);
        border-radius: var(--m-radius-md);
        background: transparent;
        border: none;
        font-size: var(--m-text-md);
        font-weight: 500;
        color: var(--color-text, #1f2937);
        text-align: center;
        cursor: pointer;
        transition: background var(--m-duration-fast) var(--m-ease-out);
        -webkit-tap-highlight-color: transparent;
    }
    
    .m-action-sheet__item:active {
        background: var(--color-surface-alt, #f3f4f6);
    }
    
    .m-action-sheet__item--destructive {
        color: var(--color-error, #ef4444);
    }
    
    .m-action-sheet__cancel {
        margin-top: var(--m-space-2);
        background: var(--color-surface-alt, #f3f4f6);
        font-weight: 600;
    }
    
    /* Modal - Centered presentation */
    .m-modal {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.9);
        width: calc(100% - var(--m-space-8));
        max-width: 360px;
        max-height: calc(100vh - var(--m-space-16));
        background: var(--color-surface, #ffffff);
        border-radius: var(--m-radius-modal);
        padding: var(--m-space-5);
        z-index: var(--m-z-modal);
        opacity: 0;
        pointer-events: none;
        transition: transform var(--m-duration-normal) var(--m-ease-modal),
                    opacity var(--m-duration-normal) var(--m-ease-out);
        overflow-y: auto;
    }
    
    [data-theme="dark"] .m-modal {
        background: var(--color-surface, #1f2937);
    }
    
    .m-modal.is-open {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        pointer-events: auto;
    }
}

/* ============================================================================
   5. FORM ELEMENTS
   Touch-optimized inputs
   ============================================================================ */
@media (max-width: 768px) {
    /* Premium input */
    .m-input {
        width: 100%;
        min-height: var(--m-touch-lg);
        padding: var(--m-space-3) var(--m-space-4);
        font-size: var(--m-text-md); /* 16px - prevents iOS zoom */
        line-height: var(--m-leading-normal);
        color: var(--color-text, #1f2937);
        background: var(--color-surface, #ffffff);
        border: 2px solid var(--color-border, #e5e7eb);
        border-radius: var(--m-radius-input);
        outline: none;
        transition: border-color var(--m-duration-fast) var(--m-ease-out),
                    box-shadow var(--m-duration-fast) var(--m-ease-out);
        -webkit-appearance: none;
        appearance: none;
    }
    
    .m-input:focus {
        border-color: var(--color-primary, #667eea);
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    }
    
    .m-input::placeholder {
        color: var(--color-text-muted, #9ca3af);
    }
    
    [data-theme="dark"] .m-input {
        background: var(--color-surface, #1f2937);
        border-color: rgba(255, 255, 255, 0.2);
        color: white;
    }
    
    /* Floating label input */
    .m-input-group {
        position: relative;
        margin-bottom: var(--m-space-4);
    }
    
    .m-input-group .m-input {
        padding-top: var(--m-space-5);
    }
    
    .m-input-group__label {
        position: absolute;
        top: 50%;
        left: var(--m-space-4);
        transform: translateY(-50%);
        font-size: var(--m-text-md);
        color: var(--color-text-muted, #9ca3af);
        pointer-events: none;
        transition: all var(--m-duration-fast) var(--m-ease-out);
    }
    
    .m-input-group .m-input:focus ~ .m-input-group__label,
    .m-input-group .m-input:not(:placeholder-shown) ~ .m-input-group__label {
        top: var(--m-space-2);
        transform: translateY(0);
        font-size: var(--m-text-xs);
        color: var(--color-primary, #667eea);
    }
    
    /* Premium button */
    .m-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--m-space-2);
        min-height: var(--m-touch-lg);
        padding: var(--m-space-3) var(--m-space-5);
        font-size: var(--m-text-base);
        font-weight: 600;
        border-radius: var(--m-radius-button);
        border: none;
        cursor: pointer;
        transition: all var(--m-duration-fast) var(--m-ease-out);
        -webkit-tap-highlight-color: transparent;
    }
    
    .m-btn:active {
        transform: scale(0.97);
    }
    
    .m-btn--primary {
        background: linear-gradient(135deg, 
            var(--color-primary, #667eea), 
            var(--color-secondary, #764ba2));
        color: white;
        box-shadow: var(--m-shadow-fab);
    }
    
    .m-btn--primary:active {
        box-shadow: var(--m-shadow-sm);
    }
    
    .m-btn--secondary {
        background: var(--color-surface-alt, #f3f4f6);
        color: var(--color-text, #1f2937);
    }
    
    .m-btn--ghost {
        background: transparent;
        color: var(--color-primary, #667eea);
    }
    
    .m-btn--full {
        width: 100%;
    }
    
    .m-btn--icon {
        width: var(--m-touch-lg);
        height: var(--m-touch-lg);
        padding: 0;
        border-radius: var(--m-radius-full);
    }
    
    /* Select */
    .m-select {
        width: 100%;
        min-height: var(--m-touch-lg);
        padding: var(--m-space-3) var(--m-space-10) var(--m-space-3) var(--m-space-4);
        font-size: var(--m-text-md);
        color: var(--color-text, #1f2937);
        background: var(--color-surface, #ffffff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E") no-repeat right var(--m-space-4) center;
        border: 2px solid var(--color-border, #e5e7eb);
        border-radius: var(--m-radius-input);
        -webkit-appearance: none;
        appearance: none;
        cursor: pointer;
    }
    
    .m-select:focus {
        border-color: var(--color-primary, #667eea);
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
        outline: none;
    }
}

/* ============================================================================
   6. LOADING & SKELETON STATES
   Premium loading experiences
   ============================================================================ */
@media (max-width: 768px) {
    /* Shimmer skeleton */
    .m-skeleton {
        background: linear-gradient(
            90deg,
            var(--color-surface-alt, #f3f4f6) 25%,
            var(--color-border, #e5e7eb) 50%,
            var(--color-surface-alt, #f3f4f6) 75%
        );
        background-size: 200% 100%;
        animation: m-shimmer 1.5s infinite ease-in-out;
        border-radius: var(--m-radius-md);
    }
    
    @keyframes m-shimmer {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
    
    .m-skeleton--text {
        height: var(--m-space-4);
        margin-bottom: var(--m-space-2);
    }
    
    .m-skeleton--text:last-child {
        width: 70%;
    }
    
    .m-skeleton--avatar {
        width: 48px;
        height: 48px;
        border-radius: var(--m-radius-full);
    }
    
    .m-skeleton--card {
        height: 120px;
        border-radius: var(--m-radius-card);
    }
    
    .m-skeleton--button {
        height: var(--m-touch-lg);
        border-radius: var(--m-radius-button);
    }
    
    /* Spinner */
    .m-spinner {
        width: 32px;
        height: 32px;
        border: 3px solid var(--color-border, #e5e7eb);
        border-top-color: var(--color-primary, #667eea);
        border-radius: 50%;
        animation: m-spin 0.8s linear infinite;
    }
    
    @keyframes m-spin {
        to { transform: rotate(360deg); }
    }
    
    .m-spinner--sm {
        width: 20px;
        height: 20px;
        border-width: 2px;
    }
    
    .m-spinner--lg {
        width: 48px;
        height: 48px;
        border-width: 4px;
    }
    
    /* Pull to refresh */
    .m-pull-refresh {
        position: fixed;
        top: var(--m-header-height);
        left: 50%;
        transform: translateX(-50%) translateY(-100%);
        z-index: var(--m-z-sticky);
        transition: transform var(--m-duration-normal) var(--m-ease-out);
    }
    
    .m-pull-refresh.is-pulling {
        transform: translateX(-50%) translateY(var(--m-space-4));
    }
    
    .m-pull-refresh__indicator {
        width: 40px;
        height: 40px;
        background: var(--color-surface, #ffffff);
        border-radius: var(--m-radius-full);
        box-shadow: var(--m-shadow-lg);
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .m-pull-refresh.is-refreshing .m-pull-refresh__indicator {
        animation: m-spin 0.8s linear infinite;
    }
}

/* ============================================================================
   7. GESTURE UTILITIES
   Classes for gesture-aware interactions
   ============================================================================ */
@media (max-width: 768px) {
    /* Swipe container */
    .m-swipe {
        touch-action: pan-y;
        overflow: hidden;
    }
    
    .m-swipe--x {
        touch-action: pan-x;
    }
    
    /* Draggable */
    .m-draggable {
        touch-action: none;
        user-select: none;
        cursor: grab;
    }
    
    .m-draggable:active {
        cursor: grabbing;
    }
    
    /* Scroll snap */
    .m-snap-x {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .m-snap-x > * {
        scroll-snap-align: start;
    }
    
    .m-snap-center > * {
        scroll-snap-align: center;
    }
    
    /* Momentum scroll */
    .m-momentum {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Disable scroll */
    .m-no-scroll {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
    }
    
    /* Swipe indicator dots */
    .m-swipe-dots {
        display: flex;
        justify-content: center;
        gap: var(--m-space-2);
        padding: var(--m-space-3);
    }
    
    .m-swipe-dot {
        width: 8px;
        height: 8px;
        border-radius: var(--m-radius-full);
        background: var(--color-border, #e5e7eb);
        transition: all var(--m-duration-normal) var(--m-ease-out);
    }
    
    .m-swipe-dot.is-active {
        width: 24px;
        background: var(--color-primary, #667eea);
    }
}

/* ============================================================================
   8. MICRO-ANIMATIONS
   Premium motion design
   ============================================================================ */
@media (max-width: 768px) {
    /* Fade in up */
    .m-animate-fade-up {
        animation: m-fade-up var(--m-duration-normal) var(--m-ease-out) forwards;
    }
    
    @keyframes m-fade-up {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Scale in */
    .m-animate-scale-in {
        animation: m-scale-in var(--m-duration-normal) var(--m-ease-spring) forwards;
    }
    
    @keyframes m-scale-in {
        from {
            opacity: 0;
            transform: scale(0.9);
        }
        to {
            opacity: 1;
            transform: scale(1);
        }
    }
    
    /* Slide in from right */
    .m-animate-slide-right {
        animation: m-slide-right var(--m-duration-slow) var(--m-ease-expo-out) forwards;
    }
    
    @keyframes m-slide-right {
        from {
            opacity: 0;
            transform: translateX(100%);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    /* Bounce */
    .m-animate-bounce {
        animation: m-bounce var(--m-duration-slow) var(--m-ease-bounce);
    }
    
    @keyframes m-bounce {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-10px); }
    }
    
    /* Pulse */
    .m-animate-pulse {
        animation: m-pulse 2s var(--m-ease-in-out) infinite;
    }
    
    @keyframes m-pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.5; }
    }
    
    /* Stagger children */
    .m-stagger > *:nth-child(1) { animation-delay: 0ms; }
    .m-stagger > *:nth-child(2) { animation-delay: 50ms; }
    .m-stagger > *:nth-child(3) { animation-delay: 100ms; }
    .m-stagger > *:nth-child(4) { animation-delay: 150ms; }
    .m-stagger > *:nth-child(5) { animation-delay: 200ms; }
    .m-stagger > *:nth-child(6) { animation-delay: 250ms; }
}

/* ============================================================================
   9. TOAST & NOTIFICATIONS
   Mobile-optimized alerts
   ============================================================================ */
@media (max-width: 768px) {
    /* Toast container */
    .m-toast-container {
        position: fixed;
        bottom: calc(var(--m-bottom-nav-height-safe) + var(--m-space-4));
        left: var(--m-space-4);
        right: var(--m-space-4);
        z-index: var(--m-z-toast);
        display: flex;
        flex-direction: column;
        gap: var(--m-space-2);
        pointer-events: none;
    }
    
    /* Toast */
    .m-toast {
        display: flex;
        align-items: center;
        gap: var(--m-space-3);
        padding: var(--m-space-3) var(--m-space-4);
        background: var(--color-text, #1f2937);
        color: white;
        border-radius: var(--m-radius-lg);
        box-shadow: var(--m-shadow-toast);
        pointer-events: auto;
        animation: m-toast-in var(--m-duration-normal) var(--m-ease-spring);
    }
    
    @keyframes m-toast-in {
        from {
            opacity: 0;
            transform: translateY(20px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
    
    .m-toast.is-exiting {
        animation: m-toast-out var(--m-duration-fast) var(--m-ease-in) forwards;
    }
    
    @keyframes m-toast-out {
        to {
            opacity: 0;
            transform: translateY(10px) scale(0.95);
        }
    }
    
    .m-toast__icon {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
    }
    
    .m-toast__message {
        flex: 1;
        font-size: var(--m-text-sm);
        font-weight: 500;
    }
    
    .m-toast__action {
        flex-shrink: 0;
        padding: var(--m-space-1) var(--m-space-2);
        font-size: var(--m-text-sm);
        font-weight: 600;
        color: var(--color-primary-light, #818cf8);
        background: transparent;
        border: none;
        cursor: pointer;
    }
    
    .m-toast--success {
        background: var(--color-success, #10b981);
    }
    
    .m-toast--error {
        background: var(--color-error, #ef4444);
    }
    
    .m-toast--warning {
        background: var(--color-warning, #f59e0b);
        color: var(--color-text, #1f2937);
    }
}

/* ============================================================================
   10. STATUS INDICATORS
   Connection & state indicators
   ============================================================================ */
@media (max-width: 768px) {
    /* Connection status */
    .m-connection-status {
        display: flex;
        align-items: center;
        gap: var(--m-space-2);
        padding: var(--m-space-2) var(--m-space-3);
        font-size: var(--m-text-xs);
        font-weight: 500;
    }
    
    .m-connection-dot {
        width: 8px;
        height: 8px;
        border-radius: var(--m-radius-full);
        background: var(--color-success, #10b981);
    }
    
    .m-connection-dot--offline {
        background: var(--color-error, #ef4444);
    }
    
    .m-connection-dot--syncing {
        background: var(--color-warning, #f59e0b);
        animation: m-pulse 1s ease-in-out infinite;
    }
    
    /* Regime badges */
    .m-badge-regime {
        display: inline-flex;
        align-items: center;
        gap: var(--m-space-1);
        padding: var(--m-space-1) var(--m-space-3);
        font-size: var(--m-text-xs);
        font-weight: 600;
        border-radius: var(--m-radius-full);
    }
    
    .m-badge-regime--high-tide {
        background: rgba(16, 185, 129, 0.15);
        color: var(--color-success, #10b981);
    }
    
    .m-badge-regime--tailwind {
        background: rgba(59, 130, 246, 0.15);
        color: var(--color-primary, #3b82f6);
    }
    
    .m-badge-regime--neutral {
        background: rgba(245, 158, 11, 0.15);
        color: var(--color-warning, #f59e0b);
    }
    
    .m-badge-regime--low-tide {
        background: rgba(239, 68, 68, 0.15);
        color: var(--color-error, #ef4444);
    }
    
    /* Progress indicator */
    .m-progress {
        height: 6px;
        background: var(--color-surface-alt, #f3f4f6);
        border-radius: var(--m-radius-full);
        overflow: hidden;
    }
    
    .m-progress__bar {
        height: 100%;
        background: linear-gradient(90deg, 
            var(--color-primary, #667eea), 
            var(--color-secondary, #764ba2));
        border-radius: var(--m-radius-full);
        transition: width var(--m-duration-slow) var(--m-ease-out);
    }
    
    .m-progress--indeterminate .m-progress__bar {
        width: 30%;
        animation: m-progress-indeterminate 1.5s infinite ease-in-out;
    }
    
    @keyframes m-progress-indeterminate {
        0% { transform: translateX(-100%); }
        100% { transform: translateX(400%); }
    }
}

/* ============================================================================
   REDUCED MOTION
   Respect user preferences
   ============================================================================ */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .m-skeleton,
    .m-spinner,
    .m-animate-fade-up,
    .m-animate-scale-in,
    .m-animate-slide-right,
    .m-animate-bounce,
    .m-animate-pulse,
    .m-toast,
    .m-progress--indeterminate .m-progress__bar {
        animation: none !important;
        transition: none !important;
    }
    
    .m-press-scale:active,
    .m-press-bounce:active {
        transform: none;
    }
}
