/* ===== PWA Install Prompt Banner ===== */
.pwa-install-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 1rem 1.5rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.4s ease-out;
    direction: rtl;
}

.pwa-install-banner.show {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pwa-install-banner .pwa-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

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

.pwa-install-banner .pwa-text h6 {
    margin: 0 0 2px 0;
    font-weight: 700;
    font-size: 0.95rem;
}

.pwa-install-banner .pwa-text p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.85;
}

.pwa-install-banner .btn-install {
    background: #fff;
    color: #667eea;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.pwa-install-banner .btn-install:hover {
    transform: scale(1.05);
}

.pwa-install-banner .btn-dismiss {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.pwa-install-banner .btn-dismiss:hover {
    color: #fff;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ===== PWA Bottom Navigation (Standalone Mode Only) ===== */
.pwa-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: var(--bg-white, #fff);
    border-top: 1px solid var(--border-color, #e2e8f0);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    direction: rtl;
}

/* Only show in standalone PWA mode for client users */
@media (display-mode: standalone) {
    body.pwa-client .pwa-bottom-nav {
        display: block;
    }

    body.pwa-client .content-wrapper,
    body.pwa-client main {
        padding-bottom: 70px;
    }

    /* Hide regular sidebar for clients in PWA */
    body.pwa-client .sidebar {
        display: none;
    }

    body.pwa-client .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

/* iOS standalone detection fallback */
body.pwa-standalone.pwa-client .pwa-bottom-nav {
    display: block;
}

body.pwa-standalone.pwa-client .content-wrapper,
body.pwa-standalone.pwa-client main {
    padding-bottom: 70px;
}

body.pwa-standalone.pwa-client .sidebar {
    display: none;
}

body.pwa-standalone.pwa-client .main-content {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

.pwa-bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    max-width: 600px;
    margin: 0 auto;
}

.pwa-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted, #94a3b8);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
    position: relative;
    min-width: 56px;
}

.pwa-nav-item i {
    font-size: 1.35rem;
    margin-bottom: 2px;
}

.pwa-nav-item.active {
    color: #667eea;
}

.pwa-nav-item:hover,
.pwa-nav-item:focus {
    color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}

.pwa-nav-item .pwa-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(30%);
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
}

/* Dark theme */
.dark-theme .pwa-bottom-nav {
    background: #1a1a2e;
    border-top-color: #2d2d44;
}

.dark-theme .pwa-nav-item {
    color: #8892b0;
}

.dark-theme .pwa-nav-item.active,
.dark-theme .pwa-nav-item:hover {
    color: #818cf8;
    background: rgba(129, 140, 248, 0.1);
}

/* Push notification opt-in card (for client dashboard) */
.push-optin-card {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    border: 1px solid #667eea40;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.push-optin-card .optin-icon {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.push-optin-card .btn-enable-push {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.push-optin-card .btn-enable-push:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

/* Pull to refresh indicator */
.pull-to-refresh {
    display: none;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #667eea;
    color: #fff;
    padding: 8px 20px;
    border-radius: 0 0 12px 12px;
    font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pull-to-refresh.visible {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-100%); }
    to { transform: translateX(-50%) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-install-banner,
    .pull-to-refresh,
    .pwa-nav-item,
    .btn-install {
        animation: none;
        transition: none;
    }
}
