/**
 * BD WebApp - Install Prompt & UI Styles
 */

/* ─────────────────────── Install Prompt ─────────────────────── */

#bd-webapp-install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#bd-webapp-install-prompt.bd-webapp-prompt-visible {
    transform: translateY(0);
    pointer-events: auto;
}

.bd-webapp-prompt-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto 16px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (max-width: 640px) {
    .bd-webapp-prompt-inner {
        margin: 0 8px 8px;
        border-radius: 12px;
        padding: 12px 16px;
    }
}

.bd-webapp-prompt-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.bd-webapp-prompt-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
    object-fit: cover;
}

.bd-webapp-prompt-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bd-webapp-prompt-text strong {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bd-webapp-prompt-text span {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bd-webapp-prompt-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.bd-webapp-btn-install {
    padding: 8px 20px;
    background: #2196F3;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
    font-family: inherit;
}

.bd-webapp-btn-install:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.bd-webapp-btn-install:active {
    transform: translateY(0);
}

.bd-webapp-btn-dismiss {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    line-height: 1;
    font-family: inherit;
}

.bd-webapp-btn-dismiss:hover {
    background: #f0f0f0;
    color: #333;
}

/* ─────────────────────── Push Permission Prompt ─────────────────────── */

#bd-webapp-push-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999998;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#bd-webapp-push-prompt.bd-webapp-prompt-visible {
    transform: translateY(0);
    pointer-events: auto;
}

.bd-webapp-push-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

/* ─────────────────────── Update Banner ─────────────────────── */

.bd-webapp-update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999998;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.bd-webapp-update-banner.bd-webapp-update-visible {
    transform: translateY(0);
    pointer-events: auto;
}

.bd-webapp-update-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 20px;
    background: #323232;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
}

.bd-webapp-btn-update {
    padding: 4px 16px;
    background: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.bd-webapp-btn-update:hover {
    background: #43A047;
}

/* ─────────────────────── Connectivity Indicator ─────────────────────── */

.bd-webapp-connectivity {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 999997;
    padding: 8px 20px;
    border-radius: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    display: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.bd-webapp-connectivity.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.bd-webapp-connectivity.bd-webapp-online {
    background: #E8F5E9;
    color: #2E7D32;
}

.bd-webapp-connectivity.bd-webapp-offline {
    background: #FFF3E0;
    color: #E65100;
}

.bd-webapp-connectivity-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.bd-webapp-connectivity-dot.online {
    background: #4CAF50;
}

.bd-webapp-connectivity-dot.offline {
    background: #FF9800;
    animation: bd-webapp-pulse 2s infinite;
}

@keyframes bd-webapp-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ─────────────────────── iOS Install Instructions ─────────────────────── */

.bd-webapp-ios-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    max-width: 340px;
    width: calc(100% - 32px);
    padding: 16px 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-align: center;
}

.bd-webapp-ios-prompt p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

.bd-webapp-ios-prompt .share-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin: 0 2px;
}

/* ─────────────────────── Dark mode support ─────────────────────── */

@media (prefers-color-scheme: dark) {
    .bd-webapp-prompt-inner {
        background: #2d2d2d;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .bd-webapp-prompt-text strong {
        color: #f0f0f0;
    }

    .bd-webapp-prompt-text span {
        color: #aaa;
    }

    .bd-webapp-btn-dismiss:hover {
        background: #444;
        color: #fff;
    }

    .bd-webapp-connectivity.bd-webapp-online {
        background: #1B5E20;
        color: #A5D6A7;
    }

    .bd-webapp-connectivity.bd-webapp-offline {
        background: #BF360C;
        color: #FFCC80;
    }

    .bd-webapp-ios-prompt {
        background: #2d2d2d;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .bd-webapp-ios-prompt p {
        color: #aaa;
    }

    .bd-webapp-push-icon-wrap {
        background: linear-gradient(135deg, #7c8cf8, #9b6fc0);
    }
}

/* ─────────────────────── Reduced motion ─────────────────────── */

@media (prefers-reduced-motion: reduce) {

    #bd-webapp-install-prompt,
    #bd-webapp-push-prompt,
    .bd-webapp-update-banner,
    .bd-webapp-connectivity {
        transition: none;
    }

    @keyframes bd-webapp-pulse {

        0%,
        100% {
            opacity: 1;
        }
    }
}