/* Install Prompt & iOS Instructions - PWA Install Modal Styles */
/* Used by: InstallPromptManager.js, IOSInstructionsRenderer.js */

/* ============================================
   INSTALL PROMPT OVERLAY (Main Install Modal)
   ============================================ */

/* Full-screen overlay backdrop */
.install-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 1rem;
    /* Safe area handling for notched devices */
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    animation: fadeIn 0.3s ease;
}

/* Main install prompt container */
.install-prompt {
    background: var(--surface, #ffffff);
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0, 0, 0, 0.2));
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

/* Dark mode support */
[data-theme="dark"] .install-prompt {
    background: var(--surface, #1a1a1a);
    border: 1px solid var(--border, #333);
}

/* Prompt header section */
.install-prompt-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.install-prompt-header i {
    font-size: 1.5rem;
    color: var(--primary, #a855f7);
}

.install-prompt-header h3 {
    flex: 1;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text, #0f172a);
}

/* Close button in header */
.install-prompt-header .close-prompt {
    background: transparent;
    border: none;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    /* Ensure tappable on mobile */
    min-width: 44px;
    min-height: 44px;
}

.install-prompt-header .close-prompt:hover {
    background: var(--surface-hover, #f1f5f9);
    color: var(--text, #0f172a);
}

.install-prompt-header .close-prompt:active {
    transform: scale(0.95);
}

/* Prompt body with description and benefits */
.install-prompt-body {
    padding: 1.25rem;
}

.install-prompt-body p {
    margin: 0 0 1.25rem;
    color: var(--text-secondary, #64748b);
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* Install benefits grid */
.install-benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.benefit {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--surface-accent, #f8fafc);
    border-radius: var(--radius-md, 0.5rem);
    transition: all 0.2s ease;
}

[data-theme="dark"] .benefit {
    background: var(--surface-accent, #252525);
}

.benefit i {
    font-size: 1.5rem;
    color: var(--primary, #a855f7);
}

.benefit span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text, #0f172a);
    line-height: 1.3;
}

/* Prompt action buttons */
.install-prompt-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border, #e2e8f0);
}

/* Primary install button */
.install-prompt-actions .install-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: var(--primary, #a855f7);
    color: white;
    border: none;
    border-radius: var(--radius-md, 0.5rem);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Ensure tappable on mobile */
    min-height: 48px;
}

.install-prompt-actions .install-button:hover {
    background: var(--primary-light, #c084fc);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.install-prompt-actions .install-button:active {
    transform: translateY(0);
}

/* Dismiss button */
.install-prompt-actions .dismiss-button {
    flex: 1;
    padding: 0.875rem 1.25rem;
    background: var(--surface, #f8fafc);
    color: var(--text-secondary, #64748b);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-md, 0.5rem);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Ensure tappable on mobile */
    min-height: 48px;
}

.install-prompt-actions .dismiss-button:hover {
    background: var(--surface-hover, #f1f5f9);
    color: var(--text, #0f172a);
}

.install-prompt-actions .dismiss-button:active {
    transform: scale(0.98);
}

[data-theme="dark"] .install-prompt-actions .dismiss-button {
    background: var(--surface-accent, #252525);
    border-color: var(--border, #333);
}

/* ============================================
   iOS INSTRUCTIONS OVERLAY (Manual Install)
   ============================================ */

/* Full-screen overlay for iOS instructions */
.install-instructions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    padding: 1rem;
    /* Safe area handling for notched devices */
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    animation: fadeIn 0.3s ease;
}

/* iOS instructions container */
.install-instructions {
    background: var(--surface, #ffffff);
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0, 0, 0, 0.2));
    width: 100%;
    max-width: 360px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

[data-theme="dark"] .install-instructions {
    background: var(--surface, #1a1a1a);
    border: 1px solid var(--border, #333);
}

/* Instructions header */
.instructions-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.instructions-header i {
    font-size: 1.5rem;
    color: var(--primary, #a855f7);
}

.instructions-header h3 {
    flex: 1;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text, #0f172a);
}

/* Close button for instructions */
.instructions-header .close-instructions {
    background: transparent;
    border: none;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    /* Ensure tappable on mobile */
    min-width: 44px;
    min-height: 44px;
}

.instructions-header .close-instructions:hover {
    background: var(--surface-hover, #f1f5f9);
    color: var(--text, #0f172a);
}

/* Instructions body with steps */
.instructions-body {
    padding: 1.25rem;
}

/* Individual instruction step */
.instruction-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-accent, #f8fafc);
    border-radius: var(--radius-md, 0.5rem);
    margin-bottom: 0.75rem;
}

.instruction-step:last-child {
    margin-bottom: 0;
}

[data-theme="dark"] .instruction-step {
    background: var(--surface-accent, #252525);
}

/* Step number circle */
.step-number {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary, #a855f7);
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 50%;
}

/* Step content */
.step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-content p {
    margin: 0;
    color: var(--text, #0f172a);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.step-content p strong {
    color: var(--primary, #a855f7);
}

/* iOS-specific icons for share/add to home screen */
.step-content i {
    font-size: 1.25rem;
    color: var(--primary, #a855f7);
}

.step-content .share-icon,
.step-content .home-icon,
.step-content .check-icon {
    color: var(--primary, #a855f7);
}

/* Instructions action button */
.instructions-actions {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border, #e2e8f0);
}

.got-it-button {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: var(--primary, #a855f7);
    color: white;
    border: none;
    border-radius: var(--radius-md, 0.5rem);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Ensure tappable on mobile */
    min-height: 48px;
}

.got-it-button:hover {
    background: var(--primary-light, #c084fc);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.got-it-button:active {
    transform: translateY(0);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

@media (max-width: 480px) {
    /* Adjust prompt for smaller screens */
    .install-prompt,
    .install-instructions {
        max-width: 100%;
        margin: 0.5rem;
        border-radius: var(--radius-md, 0.5rem);
    }
    
    /* Stack benefits vertically on very small screens */
    .install-benefits {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .benefit {
        flex-direction: row;
        text-align: left;
        padding: 0.75rem 1rem;
    }
    
    .benefit i {
        font-size: 1.25rem;
    }
    
    .benefit span {
        font-size: 0.875rem;
    }
    
    /* Stack action buttons on small screens */
    .install-prompt-actions {
        flex-direction: column;
    }
    
    .install-prompt-actions .install-button,
    .install-prompt-actions .dismiss-button {
        width: 100%;
    }
}

/* Tablet adjustments */
@media (min-width: 481px) and (max-width: 768px) {
    .install-prompt,
    .install-instructions {
        max-width: 380px;
    }
}

/* ============================================
   ACCESSIBILITY & REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .install-prompt-overlay,
    .install-instructions-overlay,
    .install-prompt,
    .install-instructions {
        animation: none;
    }
    
    .install-prompt-actions .install-button:hover,
    .install-prompt-actions .dismiss-button:hover,
    .got-it-button:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .install-prompt,
    .install-instructions {
        border: 2px solid var(--text, #0f172a);
    }
    
    .install-prompt-actions .install-button,
    .got-it-button {
        border: 2px solid currentColor;
    }
}
