/**
 * pwa.css — PWA スライドインバナー
 * Android: ホーム画面追加ボタン
 * iOS: ホーム画面への追加手順ガイド
 */

/* ========================================
   共通バナー基盤
   ======================================== */
.pwa-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
    padding: env(safe-area-inset-bottom, 0) 0 0;   /* iPhone ホームインジケーター対策 */

    /* 初期状態: 画面下に隠れている */
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.26, 0.64, 1);
    will-change: transform;
}

/* スライドイン表示 */
.pwa-banner.pwa-visible {
    transform: translateY(0);
}

/* バナー内部レイアウト */
.pwa-banner-inner {
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
}

/* ========================================
   上部ドラッグハンドル（見た目のヒント）
   ======================================== */
.pwa-banner::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 12px auto 0;
}

/* ========================================
   閉じるボタン（共通）
   ======================================== */
.pwa-btn-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.pwa-btn-close:hover {
    color: #374151;
    background: #f3f4f6;
}

/* ========================================
   Android バナー
   ======================================== */
.pwa-android-banner .pwa-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* アプリアイコン */
.pwa-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* テキスト部分 */
.pwa-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-banner-text strong {
    display: block;
    font-size: 0.95rem;
    color: #111827;
    font-weight: 700;
    line-height: 1.3;
}

.pwa-banner-text span {
    display: block;
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 追加ボタン */
.pwa-btn-install {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.1s;
}

.pwa-btn-install:hover {
    opacity: 0.9;
}

.pwa-btn-install:active {
    transform: scale(0.96);
}

/* ========================================
   iOS ガイドバナー
   ======================================== */
.pwa-ios-guide .pwa-banner-inner {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* ヘッダー行 */
.pwa-ios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.pwa-ios-header strong {
    font-size: 1rem;
    color: #111827;
    font-weight: 700;
}

/* 手順リスト */
.pwa-ios-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pwa-ios-steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    color: #374151;
    line-height: 1.4;
}

/* ステップ番号バッジ */
.pwa-ios-steps li::before {
    content: counter(step);
    counter-increment: step;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.pwa-ios-steps {
    counter-reset: step;
}

/* 共有アイコン */
.pwa-share-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1.5px solid #6b7280;
    border-radius: 5px;
    font-size: 0.85rem;
    vertical-align: middle;
    line-height: 1;
    margin: 0 1px;
}

/* ========================================
   Android 手動追加バナー（プライベートモード等）
   ======================================== */
.pwa-android-manual .pwa-banner-inner {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* Chrome メニューアイコン（縦3点） */
.pwa-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1.5px solid #6b7280;
    border-radius: 5px;
    font-size: 1rem;
    vertical-align: middle;
    line-height: 1;
    margin: 0 1px;
    letter-spacing: -1px;
}

/* ========================================
   アクセシビリティ
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .pwa-banner {
        transition: none;
    }
}
