/**
 * PWA Install Prompt Styles
 * Responsive, accessible, and non-intrusive design
 */

/* ===================================
   Utility Classes
   =================================== */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* ===================================
   PWA Install Banner (Desktop & Android)
   =================================== */

.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    border-top: 1px solid #e5e7eb;
}

.pwa-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}

.pwa-banner-icon img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pwa-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-banner-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: #111827;
}

.pwa-banner-description {
    margin: 4px 0 0;
    font-size: 14px;
    line-height: 1.4;
    color: #6b7280;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.pwa-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-banner-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.pwa-banner-close:hover {
    color: #4b5563;
    background: #f3f4f6;
}

/* ===================================
   PWA iOS Modal
   =================================== */

.pwa-ios-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pwa-ios-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.pwa-ios-content {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.pwa-ios-header {
    padding: 32px 24px 24px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.pwa-ios-icon {
    margin-bottom: 16px;
}

.pwa-ios-icon img {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-ios-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}

.pwa-ios-subtitle {
    margin: 8px 0 0;
    font-size: 15px;
    color: #6b7280;
    line-height: 1.5;
}

.pwa-ios-body {
    padding: 24px;
}

.pwa-ios-steps {
    margin-bottom: 24px;
}

.pwa-ios-step {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

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

.pwa-ios-step-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4252b2 0%, #5865d4 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.pwa-ios-step-content {
    flex: 1;
    padding-top: 4px;
}

.pwa-ios-step-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #374151;
}

.pwa-ios-step-text strong {
    color: #111827;
    font-weight: 600;
}

.pwa-ios-share-icon,
.pwa-ios-add-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin: 0 2px;
    color: #4252b2;
}

.pwa-ios-share-icon svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.pwa-ios-add-icon svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
}

.pwa-ios-benefits {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
}

.pwa-ios-benefits-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.pwa-ios-benefits-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.pwa-ios-benefits-list li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #4b5563;
}

.pwa-ios-benefits-list li:last-child {
    margin-bottom: 0;
}

.pwa-ios-footer {
    padding: 24px;
    border-top: 1px solid #e5e7eb;
}

.pwa-ios-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.pwa-ios-close:hover {
    color: #4b5563;
    background: #f3f4f6;
}

/* ===================================
   Button Styles
   =================================== */

.pwa-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.pwa-btn-primary {
    background: #4252b2;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pwa-btn-primary:hover {
    background: #3642a0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

.pwa-btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.pwa-btn-secondary:hover {
    background: #e5e7eb;
    color: #4b5563;
}

.pwa-btn-text {
    background: none;
    color: #6b7280;
    padding: 8px 16px;
}

.pwa-btn-text:hover {
    color: #4b5563;
    background: #f3f4f6;
}

.pwa-btn-block {
    width: 100%;
    margin-bottom: 8px;
}

.pwa-btn-block:last-child {
    margin-bottom: 0;
}

/* ===================================
   Responsive Design
   =================================== */

/* Mobile Phones */
@media (max-width: 640px) {
    .pwa-banner-content {
        flex-wrap: wrap;
        padding: 14px 16px 14px 16px;
        padding-top: 32px; /* Space for close button */
    }
    
    .pwa-banner-icon img {
        width: 40px;
        height: 40px;
    }
    
    .pwa-banner-text {
        flex: 1 1 100%;
        order: 2;
    }
    
    .pwa-banner-title {
        font-size: 15px;
    }
    
    .pwa-banner-description {
        font-size: 13px;
    }
    
    .pwa-banner-actions {
        flex: 1 1 100%;
        order: 3;
        margin-top: 12px;
        width: 100%;
    }
    
    .pwa-banner-actions .pwa-btn {
        width: 100%;
        font-size: 14px;
        padding: 10px 16px;
    }
    
    .pwa-banner-close {
        top: 6px;
        right: 6px;
    }
    
    /* iOS Modal Mobile */
    .pwa-ios-modal {
        padding: 0;
        align-items: flex-end;
    }
    
    .pwa-ios-content {
        border-radius: 20px 20px 0 0;
        max-height: 85vh;
    }
    
    .pwa-ios-header {
        padding: 24px 20px 20px;
    }
    
    .pwa-ios-body {
        padding: 20px;
    }
    
    .pwa-ios-footer {
        padding: 20px;
    }
}

/* Desktop - Position banner as a slide-in from bottom right */
@media (min-width: 1025px) {
    .pwa-install-banner {
        left: auto;
        right: 20px;
        bottom: 20px;
        max-width: 480px;
        border-radius: 12px;
        border: 1px solid #e5e7eb;
    }
    
    .pwa-banner-content {
        padding: 20px;
    }
}

/* ===================================
   Dark Mode Support (Optional)
   =================================== */

@media (prefers-color-scheme: dark) {
    .pwa-ios-content {
        background: #1f2937;
    }
    
    .pwa-ios-header {
        border-bottom-color: #374151;
    }
    
    .pwa-ios-title {
        color: #f9fafb;
    }
    
    .pwa-ios-subtitle {
        color: #9ca3af;
    }
    
    .pwa-ios-step-text {
        color: #d1d5db;
    }
    
    .pwa-ios-step-text strong {
        color: #f9fafb;
    }
    
    .pwa-ios-benefits {
        background: #111827;
    }
    
    .pwa-ios-benefits-title {
        color: #f9fafb;
    }
    
    .pwa-ios-benefits-list li {
        color: #9ca3af;
    }
    
    .pwa-ios-footer {
        border-top-color: #374151;
    }
    
    .pwa-ios-close:hover {
        background: #374151;
        color: #d1d5db;
    }
    
    .pwa-btn-text:hover {
        background: #374151;
        color: #d1d5db;
    }
}

/* ===================================
   Accessibility
   =================================== */

/* Focus styles for keyboard navigation */
.pwa-btn:focus,
.pwa-banner-close:focus,
.pwa-ios-close:focus {
    outline: 2px solid #4252b2;
    outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .pwa-btn,
    .pwa-banner-close,
    .pwa-ios-close {
        animation: none;
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pwa-install-banner {
        border: 2px solid #ffffff;
    }
    
    .pwa-ios-content {
        border: 2px solid #000000;
    }
}
