/* ==========================================================================
   ImotiPazar.bg Top Application Install Bar & Modal (v17.0)
   ========================================================================== */

/* Ако сайтът вече е отворен като инсталирано приложение (Standalone), скриваме лентата напълно! */
@media all and (display-mode: standalone), all and (display-mode: window-controls-overlay) {
    #ip-pwa-topbar,
    #ip-pwa-modal {
        display: none !important;
    }
}

#ip-pwa-topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 99990;
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    color: #ffffff;
    border-bottom: 2px solid #22c55e;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 8px 14px;
    box-sizing: border-box;
    display: none; /* Показва се автоматично от JS за всички браузъри, ако не е в standalone режим */
    animation: ipPwaSlideDown 0.35s ease-out;
}

@keyframes ipPwaSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.ip-pwa-container {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ip-pwa-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ip-pwa-logo {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    flex-shrink: 0;
    border: 1px solid rgba(34, 197, 94, 0.6);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.ip-pwa-texts {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ip-pwa-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ip-pwa-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.45);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 999px;
    font-weight: 700;
    text-transform: uppercase;
}

.ip-pwa-subtitle {
    font-size: 11.5px;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.ip-pwa-install-btn {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 12px rgba(34, 197, 94, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.ip-pwa-install-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(34, 197, 94, 0.65);
}

.ip-pwa-close-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}

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

/* Инструкционен модал за браузъри без директен WebAPK prompt (Mozilla / iOS Safari / след отказване) */
#ip-pwa-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: system-ui, -apple-system, sans-serif;
}

.ip-pwa-modal-card {
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid rgba(34, 197, 94, 0.45);
    border-radius: 16px;
    max-width: 440px;
    width: 100%;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    position: relative;
}

.ip-pwa-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.ip-pwa-modal-header img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
}

.ip-pwa-modal-steps {
    background: rgba(15, 23, 42, 0.65);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 14px 0;
    font-size: 13.5px;
    line-height: 1.6;
    color: #e2e8f0;
}

.ip-pwa-modal-steps ol {
    margin: 0;
    padding-left: 20px;
}

.ip-pwa-modal-steps li {
    margin-bottom: 8px;
}

@media (max-width: 640px) {
    #ip-pwa-topbar {
        padding: 7px 10px;
    }
    .ip-pwa-logo {
        width: 34px;
        height: 34px;
    }
    .ip-pwa-title {
        font-size: 12.5px;
    }
    .ip-pwa-subtitle {
        font-size: 11px;
    }
    .ip-pwa-install-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}
