/**
 * PWA Install Prompt - Bottom Sheet Banner Styles
 * Mobile-first design with smooth animations
 * 
 * @package WP_News_MCQ_Generator
 * @version 7.3.5
 */

/* ========================================================================
   BOTTOM SHEET BANNER
   ======================================================================== */

.nm-pwa-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 24px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    /* iOS safe area */
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
    z-index: 9998;

    /* Slide-up animation */
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Mobile-first: full width */
    width: 100%;
}

.nm-pwa-banner.show {
    transform: translateY(0);
}

/* ========================================================================
   BANNER STRUCTURE
   ======================================================================== */

.nm-pwa-content {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.nm-pwa-icon {
    font-size: 48px;
    line-height: 1;
    flex-shrink: 0;
    animation: fadeIn 0.6s ease 0.2s backwards;
}

.nm-pwa-text {
    flex: 1;
    min-width: 0;
}

.nm-pwa-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 8px 0;
    color: #ffffff;
}

.nm-pwa-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

/* ========================================================================
   BENEFITS LIST
   ======================================================================== */

.nm-pwa-benefits {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
}

.nm-pwa-benefits li {
    padding: 0;
    margin: 0;
    opacity: 0.95;
}

.nm-pwa-benefits li::before {
    content: '';
    /* Checkmark handled by ✓ in HTML */
}

/* ========================================================================
   ACTION BUTTONS
   ======================================================================== */

.nm-pwa-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.nm-pwa-install,
.nm-pwa-later {
    flex: 1;
    min-width: 140px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;

    /* Mobile-first: touch-friendly */
    min-height: 48px;
}

.nm-pwa-install {
    background: #ffffff;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nm-pwa-install:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.nm-pwa-install:active {
    transform: translateY(0);
}

.nm-pwa-later {
    background: transparent;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.nm-pwa-later:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
}

/* ========================================================================
   CLOSE BUTTON
   ======================================================================== */

.nm-pwa-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}

.nm-pwa-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================================================
   iOS-SPECIFIC STYLES
   ======================================================================== */

.nm-pwa-banner.nm-pwa-ios {
    background: linear-gradient(135deg, #667eea 0%, #5dade2 100%);
}

.nm-pwa-ios-steps {
    list-style: decimal;
    padding-left: 20px;
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    opacity: 0.95;
}

.nm-pwa-ios-steps li {
    padding: 4px 0;
}

.nm-ios-icon {
    display: inline-block;
    font-size: 18px;
    vertical-align: middle;
    margin-left: 4px;
}

/* ========================================================================
   ANIMATIONS
   ======================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* ========================================================================
   DESKTOP ADAPTATION (>768px)
   ======================================================================== */

@media (min-width: 769px) {
    .nm-pwa-banner {
        left: auto;
        right: 24px;
        bottom: 24px;
        max-width: 480px;
        border-radius: 12px;
        padding: 28px 24px;
    }

    .nm-pwa-icon {
        font-size: 56px;
    }

    .nm-pwa-title {
        font-size: 22px;
    }

    .nm-pwa-subtitle,
    .nm-pwa-benefits {
        font-size: 15px;
    }

    .nm-pwa-actions {
        gap: 16px;
    }

    .nm-pwa-install,
    .nm-pwa-later {
        min-width: 160px;
        padding: 16px 28px;
    }
}

/* ========================================================================
   TABLET (768px)
   ======================================================================== */

@media (max-width: 768px) {
    .nm-pwa-banner {
        border-radius: 16px 16px 0 0;
    }
}

/* ========================================================================
   MOBILE (480px AND BELOW)
   ======================================================================== */

@media (max-width: 480px) {
    .nm-pwa-banner {
        padding: 20px 16px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .nm-pwa-content {
        gap: 12px;
        margin-bottom: 16px;
    }

    .nm-pwa-icon {
        font-size: 40px;
    }

    .nm-pwa-title {
        font-size: 18px;
    }

    .nm-pwa-subtitle,
    .nm-pwa-benefits {
        font-size: 13px;
    }

    .nm-pwa-actions {
        flex-direction: column;
        gap: 10px;
    }

    .nm-pwa-install,
    .nm-pwa-later {
        width: 100%;
        min-width: auto;
    }

    .nm-pwa-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}

/* ========================================================================
   VERY SMALL SCREENS (320px)
   ======================================================================== */

@media (max-width: 320px) {
    .nm-pwa-banner {
        padding: 16px 12px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .nm-pwa-icon {
        font-size: 36px;
    }

    .nm-pwa-title {
        font-size: 16px;
    }

    .nm-pwa-subtitle,
    .nm-pwa-benefits {
        font-size: 12px;
        line-height: 1.6;
    }
}

/* ========================================================================
   DARK MODE (SYSTEM PREFERENCE)
   ======================================================================== */

@media (prefers-color-scheme: dark) {

    /* Keep gradient vibrant, but can adjust if needed */
    .nm-pwa-banner {
        /* Gradient already dark-friendly */
    }
}

/* ========================================================================
   HIGH CONTRAST MODE
   ======================================================================== */

@media (prefers-contrast: high) {
    .nm-pwa-banner {
        background: #000000;
        border: 2px solid #ffffff;
    }

    .nm-pwa-install {
        background: #ffffff;
        color: #000000;
        border: 2px solid #000000;
    }

    .nm-pwa-later {
        border-color: #ffffff;
        border-width: 2px;
    }
}

/* ========================================================================
   REDUCED MOTION
   ======================================================================== */

@media (prefers-reduced-motion: reduce) {

    .nm-pwa-banner,
    .nm-pwa-icon,
    .nm-pwa-install,
    .nm-pwa-later,
    .nm-pwa-close {
        animation: none;
        transition: none;
    }

    .nm-pwa-banner.show {
        transform: translateY(0);
    }
}

/* ========================================================================
   ACCESSIBILITY - FOCUS STATES
   ======================================================================== */

.nm-pwa-install:focus,
.nm-pwa-later:focus,
.nm-pwa-close:focus {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
}

/* High contrast focus */
@media (prefers-contrast: high) {

    .nm-pwa-install:focus,
    .nm-pwa-later:focus,
    .nm-pwa-close:focus {
        outline-color: #ffff00;
    }
}

/* ========================================================================
   LANDSCAPE MODE ON SMALL SCREENS
   ======================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .nm-pwa-banner {
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nm-pwa-content {
        margin-bottom: 12px;
    }

    .nm-pwa-icon {
        font-size: 32px;
    }

    .nm-pwa-title {
        font-size: 16px;
        margin-bottom: 4px;
    }

    .nm-pwa-subtitle {
        margin-bottom: 8px;
        font-size: 12px;
    }

    .nm-pwa-benefits {
        font-size: 12px;
        line-height: 1.5;
    }
}

/* ========================================================================
   PRINT STYLES (HIDE BANNER)
   ======================================================================== */

@media print {
    .nm-pwa-banner {
        display: none !important;
    }
}

/* ========================================================================
   LOADING STATE (OPTIONAL)
   ======================================================================== */

.nm-pwa-banner.loading .nm-pwa-install {
    position: relative;
    color: transparent;
}

.nm-pwa-banner.loading .nm-pwa-install::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}