/* ===================================================================
 *  RCFitness PWA - Install Prompt Styles
 *  Modern mobile-native UI with sleek dark glassmorphism & safe-area
 * =================================================================== */

:root {
    --pwa-primary: #e02424;
    --pwa-primary-hover: #c81e1e;
    --pwa-primary-gradient: linear-gradient(135deg, #f02d2d 0%, #b91c1c 100%);
    --pwa-bg: rgba(20, 20, 26, 0.94);
    --pwa-border: rgba(255, 255, 255, 0.12);
    --pwa-text-primary: #ffffff;
    --pwa-text-secondary: rgba(255, 255, 255, 0.72);
    --pwa-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
    --pwa-radius: 20px;
    --pwa-zindex: 999999;
}

/* Prompt Card Container */
.pwa-install-prompt {
    position: fixed;
    bottom: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    right: 16px;
    max-width: 440px;
    margin: 0 auto;
    z-index: var(--pwa-zindex);
    background: var(--pwa-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--pwa-border);
    border-radius: var(--pwa-radius);
    box-shadow: var(--pwa-shadow);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    font-family: 'Exo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--pwa-text-primary);

    /* Animation states */
    transform: translateY(140%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

/* Show state */
.pwa-install-prompt.pwa-show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Hiding state (reverse animation) */
.pwa-install-prompt.pwa-hiding {
    transform: translateY(140%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.7, 0, 0.84, 0), opacity 0.3s ease;
}

/* App Icon */
.pwa-install-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-install-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Prompt Content */
.pwa-install-content {
    flex: 1;
    min-width: 0;
}

.pwa-install-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--pwa-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.1px;
}

.pwa-install-description {
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--pwa-text-secondary);
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Action Group */
.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Install Button */
.pwa-btn-install {
    appearance: none;
    border: none;
    outline: none;
    background: var(--pwa-primary-gradient);
    color: #ffffff !important;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    padding: 7px 14px;
    border-radius: 100px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(224, 36, 36, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pwa-btn-install:hover {
    filter: brightness(1.08);
    box-shadow: 0 6px 18px rgba(224, 36, 36, 0.55);
    transform: translateY(-1px);
}

.pwa-btn-install:active {
    transform: translateY(1px) scale(0.98);
}

/* Close Button */
.pwa-install-close {
    appearance: none;
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.55);
    font-size: 22px;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.pwa-install-close:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.12);
}

.pwa-install-close:active {
    transform: scale(0.92);
}

/* ===================================================================
 *  iOS Add to Home Screen Instructions Modal / Sheet
 * =================================================================== */
.pwa-ios-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: calc(var(--pwa-zindex) + 10);
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pwa-ios-modal.pwa-modal-show {
    opacity: 1;
    pointer-events: auto;
}

.pwa-ios-sheet {
    width: 100%;
    max-width: 480px;
    background: #191920;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px 24px 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-family: 'Exo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-ios-modal.pwa-modal-show .pwa-ios-sheet {
    transform: translateY(0);
}

.pwa-ios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.pwa-ios-title {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
}

.pwa-ios-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
}

.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 14px;
    border-radius: 14px;
}

.pwa-ios-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--pwa-primary-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.pwa-ios-step-text {
    font-size: 13.5px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
}

.pwa-ios-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 2px 6px;
    margin: 0 4px;
    font-weight: 600;
    font-size: 12px;
    color: #ffffff;
}

.pwa-ios-step-icon {
    display: inline-block;
    vertical-align: middle;
    width: 18px;
    height: 18px;
    margin-right: 4px;
    fill: currentColor;
}

.pwa-ios-btn-dismiss {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pwa-ios-btn-dismiss:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* ===================================================================
 *  Desktop View (Subtle bottom-right positioning)
 * =================================================================== */
@media screen and (min-width: 768px) {
    .pwa-install-prompt {
        left: auto;
        right: 24px;
        bottom: 24px;
        max-width: 380px;
        margin: 0;
        padding: 14px 18px;
    }

    .pwa-ios-modal {
        align-items: center;
    }

    .pwa-ios-sheet {
        border-radius: 20px;
        padding-bottom: 24px;
    }
}
