/* PWA Install — frontend UI styles.
 * Shared theme color exposed as --pwa-theme on <html> (set by config bridge).
 * Three top-level blocks: Android bottom sheet, iOS overlay (also used by ios-other modal),
 * and shared utility classes (copy row, hint).
 */

/* ===== Android bottom sheet ===== */
.pwa-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0));
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    font-family: inherit;
    color: #111;
}

.pwa-sheet--open {
    transform: translateY(0);
}

.pwa-sheet__row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.pwa-sheet__icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    flex: 0 0 56px;
    background: #fafafa;
}

.pwa-sheet__title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 2px;
    color: #111;
}

.pwa-sheet__subtitle {
    font-size: 13px;
    color: #666;
    margin: 0;
}

.pwa-sheet__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pwa-sheet__btn {
    flex: 1;
    min-width: 96px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.pwa-sheet__btn--primary {
    background: var(--pwa-theme, #007BFF);
    color: #fff;
    flex: 2;
}

.pwa-sheet__btn--ghost {
    background: transparent;
    color: #888;
}

.pwa-sheet__btn--outline {
    background: #f3f4f6;
    color: #333;
}

.pwa-sheet__hint {
    font-size: 12px;
    color: #999;
    margin: 10px 0 0;
    text-align: center;
    display: none;
    line-height: 1.4;
}

.pwa-sheet__hint--visible {
    display: block;
}

/* ===== iOS overlay (Safari + non-Safari share most styles) ===== */
.pwa-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.25s ease;
    font-family: inherit;
}

.pwa-overlay--open {
    opacity: 1;
}

.pwa-overlay__card {
    background: #fff;
    border-radius: 16px;
    max-width: 380px;
    width: 100%;
    padding: 20px 20px 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    color: #111;
}

.pwa-overlay__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}

.pwa-overlay__icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    margin: 0 auto 12px;
    display: block;
    background: #fafafa;
}

.pwa-overlay__title {
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 14px;
    color: #111;
}

.pwa-overlay__divider {
    height: 1px;
    background: #eee;
    margin: 14px 0;
}

.pwa-overlay__step {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.pwa-overlay__num {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    background: var(--pwa-theme, #007BFF);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.pwa-overlay__step-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.45;
}

.pwa-overlay__inline-icon {
    display: inline-block;
    vertical-align: middle;
    width: 18px;
    height: 18px;
    color: var(--pwa-theme, #007BFF);
}

.pwa-overlay__arrow {
    text-align: center;
    font-size: 28px;
    color: var(--pwa-theme, #007BFF);
    margin: 8px 0;
    animation: pwaArrowBounceDown 1.2s ease-in-out infinite;
}

.pwa-overlay__arrow--up {
    animation-name: pwaArrowBounceUp;
}

@keyframes pwaArrowBounceDown {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(8px); }
}

@keyframes pwaArrowBounceUp {
    0%, 100% { transform: translateY(0) rotate(180deg); }
    50%      { transform: translateY(-8px) rotate(180deg); }
}

.pwa-overlay__actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.pwa-overlay__btn {
    flex: 1;
    min-width: 90px;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.pwa-overlay__btn--primary {
    background: var(--pwa-theme, #007BFF);
    color: #fff;
}

.pwa-overlay__btn--outline {
    background: #f3f4f6;
    color: #333;
}

.pwa-overlay__btn--ghost {
    background: transparent;
    color: #999;
}

.pwa-overlay__body {
    font-size: 14px;
    color: #444;
    line-height: 1.5;
    text-align: center;
    margin: 8px 0 16px;
}

.pwa-overlay__copy-row {
    display: flex;
    gap: 6px;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 14px;
    align-items: center;
}

.pwa-overlay__url {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 12px;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    outline: none;
    min-width: 0;
}

.pwa-overlay__copy-btn {
    background: var(--pwa-theme, #007BFF);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    flex: 0 0 auto;
    font-family: inherit;
}

.pwa-overlay__copy-btn--success {
    background: #28a745;
}
