/* PWA Bottom Navigation Bar - Mobile App Style */
:root {
    --pwa-nav-height: 60px;
    --pwa-nav-bg: #ffffff;
    --pwa-nav-active: #2d3f5e;
    --pwa-nav-inactive: #94a3b8;
    --pwa-nav-border: #e2e8f0;
    --pwa-nav-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

/* Only show on mobile/PWA */
.pwa-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--pwa-nav-height);
    background: var(--pwa-nav-bg);
    border-top: 1px solid var(--pwa-nav-border);
    box-shadow: var(--pwa-nav-shadow);
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: transform 0.3s ease;
}

.pwa-bottom-nav-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: calc(var(--pwa-nav-height) + env(safe-area-inset-bottom, 0px));
    max-width: 500px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.pwa-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    text-decoration: none;
    color: var(--pwa-nav-inactive);
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    position: relative;
}

.pwa-bottom-nav-item:hover,
.pwa-bottom-nav-item:active {
    color: var(--pwa-nav-active);
    text-decoration: none;
}

.pwa-bottom-nav-item.active {
    color: var(--pwa-nav-active);
}

.pwa-bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--pwa-nav-active);
    border-radius: 0 0 3px 3px;
}

.pwa-bottom-nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
}

.pwa-bottom-nav-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.8;
}

.pwa-bottom-nav-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-top: 1px;
    white-space: nowrap;
}

/* Notification badge */
.pwa-bottom-nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 16px);
    min-width: 16px;
    height: 16px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* Add bottom padding to main content so nav doesn't overlap */
@media (max-width: 768px) {
    .pwa-bottom-nav {
        display: flex;
    }
    
    /* Push page content up */
    body #wrapper,
    body #content,
    body .content {
        padding-bottom: calc(var(--pwa-nav-height) + env(safe-area-inset-bottom, 0px) + 10px) !important;
    }
    
    /* For admin area */
    body #wrapper {
        padding-bottom: calc(var(--pwa-nav-height) + env(safe-area-inset-bottom, 0px) + 10px) !important;
    }
}

/* Show in PWA standalone mode */
@media (display-mode: standalone) {
    .pwa-bottom-nav {
        display: flex !important;
    }
    
    body #wrapper,
    body #content,
    body .content {
        padding-bottom: calc(var(--pwa-nav-height) + env(safe-area-inset-bottom, 0px) + 10px) !important;
    }
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
    :root {
        --pwa-nav-bg: #1e293b;
        --pwa-nav-active: #60a5fa;
        --pwa-nav-inactive: #64748b;
        --pwa-nav-border: #334155;
        --pwa-nav-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    }
}
/* ===== Call button on /admin/leads (PWA tel: dialer) ===== */
.pwa-call-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.pwa-call-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff !important;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    flex: 0 0 auto;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    transition: background 0.15s, transform 0.1s;
}
.pwa-call-btn:hover,
.pwa-call-btn:active {
    background: #15803d;
    color: #fff !important;
    text-decoration: none;
}
.pwa-call-btn:active {
    transform: scale(0.92);
}
.pwa-call-phone a {
    color: inherit;
}
/* Bigger touch target on mobile / installed PWA */
@media (max-width: 768px), (display-mode: standalone) {
    .pwa-call-btn {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
}
