/* ==========================================================================
   Haminja - PWA Smart App Top Banner
   نمایش نوار هوشمند نصب وب‌اپلیکیشن در بالای صفحه موبایل و تبلت
   ========================================================================== */

:root {
    --hmj-banner-height: 60px;
    --hmj-banner-primary: #0F9F8A;
    --hmj-banner-primary-hover: #0b806f;
}

/* بنر اصلی بالای صفحه */
.hmj-smart-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-height: var(--hmj-banner-height);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 159, 138, 0.2);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.09);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    font-family: inherit;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.hmj-smart-banner.d-none,
.hmj-smart-banner[hidden] {
    display: none !important;
}

.hmj-smart-banner.is-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

/* فاصله بالای صفحه در زمان فعال بودن بنر */
body.has-smart-banner {
    padding-top: var(--hmj-banner-height) !important;
}

/* بخش محتوای داخلی */
.hmj-sb-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* دکمه بستن بنر */
.hmj-sb-close {
    background: none;
    border: none;
    color: #8898aa;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.2s;
}

.hmj-sb-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #333;
}

/* آیکون اپلیکیشن */
.hmj-sb-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #ffffff;
}

/* اطلاعات و متن بنر */
.hmj-sb-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
}

.hmj-sb-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #1a202c;
    margin: 0;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hmj-sb-desc {
    font-size: 0.73rem;
    color: #718096;
    margin: 2px 0 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* دکمه نصب اصلی */
.hmj-sb-action {
    flex-shrink: 0;
    margin-right: 8px;
}

.hmj-sb-install-btn {
    background: linear-gradient(135deg, var(--hmj-banner-primary) 0%, var(--hmj-banner-primary-hover) 100%);
    color: #ffffff !important;
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(15, 159, 138, 0.35);
    transition: all 0.2s ease;
    text-decoration: none !important;
    white-space: nowrap;
}

.hmj-sb-install-btn:hover,
.hmj-sb-install-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(15, 159, 138, 0.45);
    color: #ffffff;
}

/* ═══ دیالوگ راهنمای نصب در آیفون (iOS) ═══ */
.hmj-ios-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100001;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    direction: rtl;
}

.hmj-ios-sheet-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.hmj-ios-sheet-card {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    border-radius: 24px 24px 0 0;
    padding: 24px 20px 28px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.hmj-ios-sheet-backdrop.active .hmj-ios-sheet-card {
    transform: translateY(0);
}

.hmj-ios-sheet-handle {
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 4px;
    margin: 0 auto 16px;
}

.hmj-ios-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.hmj-ios-sheet-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hmj-ios-sheet-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hmj-ios-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    border-radius: 14px;
}

.hmj-ios-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--hmj-banner-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
    margin-top: 2px;
}

.hmj-ios-step-text {
    font-size: 0.86rem;
    color: #334155;
    line-height: 1.5;
    margin: 0;
}

.hmj-ios-step-text strong {
    color: #0f172a;
}

.hmj-ios-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #0f172a;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.8rem;
    margin: 0 3px;
}

.hmj-ios-close-btn {
    width: 100%;
    padding: 11px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.hmj-ios-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* مخفی‌سازی کامل در حالت PWA مستقل (Standalone) */
@@media all and (display-mode: standalone) {
    .hmj-smart-banner,
    .hmj-ios-sheet-backdrop {
        display: none !important;
    }
    body.has-smart-banner {
        padding-top: 0 !important;
    }
}
