/**
 * PWA Install Banner Styles
 * Sticky top banner for install prompt
 */

/* =====================================================
   Sticky Install Banner
   ===================================================== */
.pwa-install-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.pwa-install-banner.pwa-install-banner--visible {
    transform: translateY(0);
}

.pwa-install-banner__content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.pwa-install-banner__icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
    background: #fff;
    object-fit: cover;
}

.pwa-install-banner__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pwa-install-banner__text strong {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-install-banner__text span {
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.pwa-install-banner__button {
    background: #fff;
    color: #667eea;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pwa-install-banner__button:hover {
    background: #f0f0f0;
    transform: scale(1.02);
}

.pwa-install-banner__button:active {
    transform: scale(0.98);
}

.pwa-install-banner__close {
    background: transparent;
    border: none;
    color: #fff;
    padding: 4px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-install-banner__close:hover {
    opacity: 1;
}

/* =====================================================
   iOS Install Instructions - Animated Bottom Sheet
   ===================================================== */
.pwa-ios-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
}

.pwa-ios-prompt__backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: pwa-ios-fade-in 0.25s ease;
    z-index: 1;
}

@keyframes pwa-ios-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pwa-ios-prompt__sheet {
    position: relative;
    z-index: 2;
    background: #f2f2f7;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 420px;
    padding: 12px 24px 34px;
    padding-bottom: calc(34px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    animation: pwa-ios-sheet-up 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@keyframes pwa-ios-sheet-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.pwa-ios-prompt__handle {
    width: 36px;
    height: 5px;
    background: #c7c7cc;
    border-radius: 3px;
    margin: 0 auto 16px;
}

.pwa-ios-prompt__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(60,60,67,0.18);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #3c3c43;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
    padding: 0;
    line-height: 1;
}

/* Header */
.pwa-ios-prompt__header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    padding-right: 30px;
}

.pwa-ios-prompt__header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1c1c1e;
    letter-spacing: -0.3px;
}

.pwa-ios-prompt__header p {
    margin: 2px 0 0;
    font-size: 13px;
    color: #86868b;
}

/* Step indicator dots */
.pwa-ios-prompt__dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.pwa-ios-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c7c7cc;
    transition: all 0.3s ease;
}

.pwa-ios-dot.active {
    background: #007AFF;
    width: 24px;
    border-radius: 4px;
}

.pwa-ios-dot.done {
    background: #34C759;
}

/* Step containers */
.pwa-ios-step {
    display: none;
    animation: pwa-ios-step-in 0.35s ease;
}

.pwa-ios-step.active {
    display: block;
}

@keyframes pwa-ios-step-in {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Visual mockup area */
.pwa-ios-step__visual {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pwa-ios-step__mockup {
    position: relative;
    width: 100%;
}

/* Step label text */
.pwa-ios-step__label {
    text-align: center;
    font-size: 16px;
    color: #1c1c1e;
    line-height: 1.5;
    margin-bottom: 20px;
}

.pwa-ios-step__label strong {
    color: #007AFF;
}

/* Safari bottom bar mockup */
.pwa-ios-safari-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: #f9f9f9;
    border-radius: 14px;
    padding: 12px 16px;
    border: 1px solid #e5e5ea;
}

/* Bounce animation for share icon */
.pwa-ios-bounce {
    animation: pwa-ios-bounce-anim 1.2s ease-in-out infinite;
}

@keyframes pwa-ios-bounce-anim {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

/* Share sheet mockup (Step 2) */
.pwa-ios-sharesheet {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e5ea;
}

.pwa-ios-sharesheet__row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #fff;
    font-size: 15px;
    color: #1c1c1e;
    border-bottom: 0.5px solid #e5e5ea;
}

.pwa-ios-sharesheet__row:last-child {
    border-bottom: none;
}

.pwa-ios-sharesheet__option {
    background: #e8f0fe;
    animation: pwa-ios-highlight 1.5s ease-in-out infinite;
}

@keyframes pwa-ios-highlight {
    0%, 100% { background: #e8f0fe; }
    50% { background: #d0e2ff; }
}

.pwa-ios-sharesheet__option span {
    font-weight: 600;
    color: #007AFF;
}

/* Confirm screen mockup (Step 3) */
.pwa-ios-confirm {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e5ea;
    background: #fff;
}

.pwa-ios-confirm__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 0.5px solid #e5e5ea;
    font-size: 15px;
}

.pwa-ios-confirm__cancel { color: #007AFF; }
.pwa-ios-confirm__title { font-weight: 600; color: #1c1c1e; font-size: 14px; }
.pwa-ios-confirm__add {
    color: #007AFF;
    font-weight: 700;
    font-size: 16px;
}

.pwa-ios-pulse {
    animation: pwa-ios-pulse-anim 1.2s ease-in-out infinite;
}

@keyframes pwa-ios-pulse-anim {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.pwa-ios-confirm__app {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    font-size: 15px;
    color: #1c1c1e;
}

.pwa-ios-confirm__icon {
    width: 48px;
    height: 48px;
    border-radius: 11px;
    background: #f2f2f7;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Next/Done button */
.pwa-ios-prompt__next {
    display: block;
    width: 100%;
    padding: 15px;
    background: #007AFF;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: -0.2px;
    transition: background 0.15s;
}

.pwa-ios-prompt__next:active {
    background: #0062cc;
}

/* =====================================================
   Responsive Adjustments
   ===================================================== */
@media (max-width: 480px) {
    .pwa-install-banner {
        padding: 10px 12px;
    }
    
    .pwa-install-banner__icon {
        width: 36px;
        height: 36px;
    }
    
    .pwa-install-banner__text strong {
        font-size: 13px;
    }
    
    .pwa-install-banner__text span {
        font-size: 11px;
    }
    
    .pwa-install-banner__button {
        padding: 6px 14px;
        font-size: 13px;
    }
}

/* =====================================================
   Hide banner when app is installed (standalone mode)
   ===================================================== */
@media (display-mode: standalone) {
    .pwa-install-banner {
        display: none !important;
    }
}

/* =====================================================
   Hide banner on desktop - only show on mobile/tablet
   ===================================================== */
@media (min-width: 1025px) {
    .pwa-install-banner {
        display: none !important;
    }
    
    .pwa-ios-prompt {
        display: none !important;
    }
}

/* =====================================================
   Admin bar adjustment
   ===================================================== */
.admin-bar .pwa-install-banner {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .pwa-install-banner {
        top: 46px;
    }
}

/* =====================================================
   Shortcode Button
   ===================================================== */
.pwa-install-shortcode-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-install-shortcode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.pwa-install-shortcode-btn:active {
    transform: translateY(0);
}
