/* ==========================================================================
   TailoTek Mobile Responsive & PWA Design System
   ========================================================================== */

/* 1. Global Viewport & Alignment Fixes */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 767.98px) {
    /* Safe padding so content doesn't get covered by mobile bottom bar */
    .app-main {
        padding-bottom: 74px !important;
    }
    
    .app-topbar {
        height: 56px !important;
        padding: 0 0.85rem !important;
    }

    .app-content {
        padding: 0.75rem !important;
    }

    .card-custom {
        border-radius: 12px !important;
        padding: 0.85rem !important;
        margin-bottom: 0.85rem !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
    }

    /* Minimalist typography & Text Wrapping (no cutoffs) */
    body, p, span, div, strong, small, a, td, th, label {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .font-monospace {
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
        letter-spacing: -0.01em;
    }

    /* Headings responsiveness - clean minimalist scaling */
    h1, .h1 { font-size: 1.45rem !important; line-height: 1.25 !important; }
    h2, .h2 { font-size: 1.3rem !important; line-height: 1.25 !important; }
    h3, .h3 { font-size: 1.15rem !important; line-height: 1.25 !important; }
    h4, .h4 { font-size: 1.05rem !important; line-height: 1.3 !important; }
    h5, .h5 { font-size: 0.95rem !important; line-height: 1.3 !important; }
    h6, .h6 { font-size: 0.85rem !important; line-height: 1.35 !important; }

    /* Stat values responsive scaling */
    .stat-value {
        font-size: 1.4rem !important;
        line-height: 1.15 !important;
    }

    .stat-icon {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.15rem !important;
        border-radius: 10px !important;
    }

    /* Inputs: 16px to prevent iOS auto-zoom, clean minimalist borders */
    input.form-control, select.form-select, textarea.form-control {
        font-size: 16px !important;
        padding: 0.55rem 0.75rem !important;
        border-radius: 8px !important;
    }

    /* Tables smooth responsive card wrapper */
    .table-responsive {
        border-radius: 10px;
        box-shadow: inset 0 0 2px rgba(0,0,0,0.03);
        margin-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .table-custom thead th {
        font-size: 0.68rem !important;
        padding: 0.55rem 0.5rem !important;
        white-space: nowrap;
    }

    .table-custom tbody td {
        font-size: 0.8rem !important;
        padding: 0.65rem 0.5rem !important;
    }

    /* Badges & Pills */
    .badge {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.55rem !important;
        font-weight: 600;
        letter-spacing: 0.01em;
    }

    /* Buttons touch targets */
    .btn {
        padding: 0.48rem 0.85rem !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
    }

    .btn-sm, .btn-xs {
        padding: 0.25rem 0.55rem !important;
        font-size: 0.75rem !important;
    }

    /* Modal adjustments on mobile */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 14px !important;
    }
}

/* 2. Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1040;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

@media (max-width: 767.98px) {
    .mobile-bottom-nav {
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 0 4px;
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 12px;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
    position: relative;
}

.mobile-nav-item i {
    font-size: 1.15rem;
    margin-bottom: 2px;
    transition: transform 0.2s ease;
}

.mobile-nav-item:hover, .mobile-nav-item:focus {
    color: #cbd5e1;
}

.mobile-nav-item.active {
    color: #818cf8;
}

.mobile-nav-item.active i {
    transform: translateY(-2px);
    color: #6366f1;
}

.mobile-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 16px;
    height: 3px;
    background: #6366f1;
    border-radius: 3px;
}

/* 3. Floating WhatsApp Assistance Button */
.whatsapp-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 54px;
    height: 54px;
    background: #25D366;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    box-shadow: 0 4px 18px rgba(37, 211, 102, 0.5);
    z-index: 1030;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.whatsapp-floating-btn:hover {
    color: #ffffff;
    background: #20ba5a;
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.65);
}

@media (max-width: 767.98px) {
    .whatsapp-floating-btn {
        bottom: 74px; /* Placed cleanly above mobile bottom nav */
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
}

/* Ripple animation for WhatsApp Button */
.whatsapp-floating-btn::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.4);
    z-index: -1;
    animation: waPulse 2s infinite;
}

@keyframes waPulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

/* 4. PWA Install Prompt Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 440px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 12px 16px;
    z-index: 1055;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 25px rgba(5, 150, 105, 0.35);
    animation: pwaSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 767.98px) {
    .pwa-install-banner {
        bottom: 74px; /* Appears above mobile navigation */
        width: calc(100% - 20px);
    }
}

@keyframes pwaSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 40px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-icon-box {
    flex-shrink: 0;
}

.pwa-text {
    flex-grow: 1;
    min-width: 0;
}

.pwa-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.pwa-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* 5. Device Camera Capture Trigger Button Styles */
.btn-device-camera {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #6366f1;
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-device-camera:hover {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
    transform: translateY(-1px);
}
