/* ==========================================================================
   PWA Mobile App Install System Stylesheet
   ========================================================================== */

/* ─── Variables ─── */
:root {
    --pwa-primary: #f28222;
    --pwa-primary-hover: #d9701a;
    --pwa-bg-glass: rgba(26, 29, 35, 0.92);
    --pwa-text-light: #ffffff;
    --pwa-text-muted: #a1a7b5;
    --pwa-border: rgba(255, 255, 255, 0.12);
    --pwa-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

/* ─── Floating Install Banner (Bottom Sheet / Pill) ─── */
.pwa-install-banner {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 14px) + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(160%);
    width: calc(100% - 28px);
    max-width: 440px;
    background: var(--pwa-bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--pwa-border);
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: var(--pwa-shadow);
    z-index: 1040; /* Lower than modals (1055) and backdrops (1050) */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    box-sizing: border-box;
}

.pwa-install-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Auto-hide banner whenever any Bootstrap modal or backdrop is active */
body.modal-open .pwa-install-banner {
    transform: translateX(-50%) translateY(160%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Banner Content */
.pwa-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0; /* Prevents text overflow flex bugs */
    flex: 1;
}

.pwa-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

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

.pwa-banner-title {
    color: var(--pwa-text-light);
    font-weight: 700;
    font-size: 0.92rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.pwa-banner-desc {
    color: var(--pwa-text-muted);
    font-size: 0.78rem;
    margin: 2px 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-btn-install {
    background: var(--pwa-primary);
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 7px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 3px 8px rgba(242, 130, 34, 0.35);
    white-space: nowrap;
}

.pwa-btn-install:hover,
.pwa-btn-install:active {
    background: var(--pwa-primary-hover);
    transform: scale(1.02);
    color: #ffffff !important;
}

.pwa-btn-close {
    background: rgba(255, 255, 255, 0.08);
    color: var(--pwa-text-muted);
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    padding: 0;
    flex-shrink: 0;
}

.pwa-btn-close:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

/* ─── Sidebar Install Item ─── */
.sidebar-pwa-item .nav-link {
    background: rgba(242, 130, 34, 0.08);
    border: 1px dashed rgba(242, 130, 34, 0.3);
    color: #f7a252 !important;
    font-weight: 600;
    margin-top: 6px;
}

.sidebar-pwa-item .nav-link:hover {
    background: rgba(242, 130, 34, 0.16);
    color: #ffffff !important;
    border-style: solid;
}

/* ─── iOS Safari Instructions Modal ─── */
.pwa-ios-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1060;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 16px;
    box-sizing: border-box;
}

.pwa-ios-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.pwa-ios-sheet {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: 20px;
    padding: 24px 20px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    text-align: left;
}

.pwa-ios-modal.show .pwa-ios-sheet {
    transform: translateY(0);
}

.pwa-ios-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 14px;
}

.pwa-ios-app-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.pwa-ios-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #191919;
    margin: 0;
}

.pwa-ios-subtitle {
    font-size: 0.82rem;
    color: #777777;
    margin: 2px 0 0 0;
}

.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid #edf2f7;
}

.pwa-ios-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--pwa-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.pwa-ios-step-content {
    font-size: 0.88rem;
    color: #333333;
    font-weight: 500;
    line-height: 1.35;
}

.pwa-ios-step-content strong {
    color: #111827;
}

.pwa-ios-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #007aff;
    font-size: 0.82rem;
    margin: 0 2px;
    vertical-align: middle;
}

.pwa-ios-btn-gotit {
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    background: #111827;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pwa-ios-btn-gotit:hover {
    background: #000000;
}

/* ─── Responsiveness & Edge Cases ─── */
@media (max-width: 380px) {
    .pwa-install-banner {
        width: calc(100% - 16px);
        padding: 10px 12px;
    }
    .pwa-banner-icon {
        width: 38px;
        height: 38px;
    }
    .pwa-banner-title {
        font-size: 0.85rem;
    }
    .pwa-banner-desc {
        font-size: 0.72rem;
    }
    .pwa-btn-install {
        padding: 6px 10px;
        font-size: 0.76rem;
    }
}
