/* ============================================================
   CHERI SMS - Mobile & Touch Optimizations
   Created: February 19, 2026
   Only loads when UI_DesignTheme = "modern"
   Responsive enhancements for mobile devices
   ============================================================ */

/* ============================================================
   TOUCH TARGET SIZING - Minimum 44px tap targets
   ============================================================ */

@media (max-width: 768px) {
    /* Buttons - larger tap targets */
    .btn,
    button,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        padding: 10px 16px;
    }

    .btn-sm {
        min-height: 36px;
    }

    /* Form inputs - larger on mobile */
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* Links in lists */
    .list-group-item,
    .dropdown-item {
        min-height: 44px;
        padding: 10px 16px;
    }

    /* Nav links */
    .nav-link {
        padding: 10px 12px;
    }
}


/* ============================================================
   MOBILE LAYOUT ADJUSTMENTS
   ============================================================ */

@media (max-width: 768px) {
    /* Modal full-screen on mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    /* Table responsive wrapper */
    .table-responsive {
        margin: 0 -12px;
        padding: 0 12px;
    }

    /* Card spacing */
    .card {
        margin-bottom: 12px;
    }

    .card-body {
        padding: 12px;
    }

    /* Container padding */
    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Typography scaling */
    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.25rem; }
    h3, .h3 { font-size: 1.125rem; }

    /* Hide non-essential columns on mobile */
    .d-mobile-none {
        display: none !important;
    }
}


/* ============================================================
   MOBILE NAVIGATION
   ============================================================ */

@media (max-width: 768px) {
    /* Bottom navigation bar */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: var(--bg-card, #ffffff);
        border-top: 1px solid var(--border-color, #e2e8f0);
        display: flex;
        align-items: center;
        justify-content: space-around;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .mobile-bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 8px 12px;
        border: none;
        background: none;
        color: var(--text-muted, #94a3b8);
        text-decoration: none;
        font-size: 10px;
        font-weight: 500;
        transition: color 150ms;
    }

    .mobile-bottom-nav-item i {
        font-size: 20px;
    }

    .mobile-bottom-nav-item.active {
        color: var(--primary-color, #6366f1);
    }

    /* Add bottom padding to body for bottom nav */
    body.has-bottom-nav {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0));
    }
}


/* ============================================================
   SWIPE & GESTURE SUPPORT CSS
   ============================================================ */

.swipeable {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.swipe-action-left,
.swipe-action-right {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
}

.swipe-action-left {
    left: 0;
    background: var(--success-color, #10b981);
}

.swipe-action-right {
    right: 0;
    background: var(--danger-color, #ef4444);
}


/* ============================================================
   PULL TO REFRESH
   ============================================================ */

.pull-to-refresh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card, #ffffff);
    transform: translateY(-100%);
    transition: transform 300ms;
    z-index: 999;
}

.pull-to-refresh.visible {
    transform: translateY(0);
}

.pull-to-refresh-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color, #e2e8f0);
    border-top-color: var(--primary-color, #6366f1);
    border-radius: 50%;
    animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
    to { transform: rotate(360deg); }
}


/* ============================================================
   SAFE AREA INSETS (for notched devices)
   ============================================================ */

@supports (padding: env(safe-area-inset-top)) {
    .safe-area-top {
        padding-top: env(safe-area-inset-top);
    }

    .safe-area-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
}


/* ============================================================
   DARK MODE - Mobile specifics
   ============================================================ */

@media (max-width: 768px) {
    [data-theme="dark"] .mobile-bottom-nav {
        background: var(--bg-card, #1e293b);
        border-top-color: var(--border-color, #334155);
    }

    [data-theme="dark"] .pull-to-refresh {
        background: var(--bg-card, #1e293b);
    }
}


/* ============================================================
   PRINT STYLES - Hide mobile elements
   ============================================================ */

@media print {
    .mobile-bottom-nav,
    .pull-to-refresh,
    .quick-actions-fab {
        display: none !important;
    }
}
