/* Mobile PWA Styles for DimeCRM */

/* Touch-friendly buttons globally */
@media (max-width: 767.98px) {
    .btn, .form-select, .form-control {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 38px;
        min-width: 38px;
    }

    /* Reduce table font size on mobile */
    .table {
        font-size: 0.8rem;
    }

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

    /* Kanban columns stack vertically */
    .kanban-board {
        flex-direction: column !important;
    }

    .kanban-column {
        width: 100% !important;
        min-width: unset !important;
        max-width: unset !important;
        margin-bottom: 1rem;
    }

    /* Map takes full width */
    .map-container, #customerMap {
        width: 100% !important;
        height: 60vh !important;
        min-height: 300px;
    }

    /* Page header stacks on mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .page-header > div {
        width: 100%;
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    /* Cards full width */
    .card {
        border-radius: 0.5rem;
    }

    /* Sidebar adjustments */
    .crm-content {
        padding: 1rem 0.75rem;
    }

    /* DataTables responsive */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
        margin-bottom: 0.5rem;
    }

    .dataTables_wrapper .dt-buttons {
        margin-bottom: 0.5rem;
    }

    /* Hide less important table columns on small screens */
    .table .d-mobile-none {
        display: none !important;
    }

    /* Bottom navigation bar */
    .mobile-bottom-nav {
        display: flex !important;
    }

    /* Add bottom padding to content to account for bottom nav */
    .crm-main {
        padding-bottom: 70px;
    }
}

/* Bottom Navigation Bar (hidden on desktop) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bs-body-bg, #ffffff);
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    z-index: 1050;
    align-items: center;
    justify-content: space-around;
    padding: 0 0.5rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    transition: color 0.15s, background 0.15s;
    min-width: 56px;
    min-height: 44px;
}

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

.mobile-bottom-nav .nav-item.active,
.mobile-bottom-nav .nav-item:hover {
    color: var(--bs-primary, #0d6efd);
    background: rgba(13, 110, 253, 0.08);
}

.mobile-bottom-nav .nav-item.active {
    font-weight: 600;
}

/* PWA standalone mode tweaks */
@media (display-mode: standalone) {
    .crm-topbar {
        padding-top: env(safe-area-inset-top, 0);
    }

    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0);
        height: calc(64px + env(safe-area-inset-bottom, 0));
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-bottom-nav {
        height: 48px;
    }

    .mobile-bottom-nav .nav-item {
        font-size: 0.6rem;
    }

    .mobile-bottom-nav .nav-item i {
        font-size: 1rem;
    }
}
