/* PWA UI Components Styles */

/* Install Button */
.pwa-install-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    margin-right: 10px;
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

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

.pwa-install-btn i {
    font-size: 16px;
}

/* Connection Indicator */
.pwa-connection-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.pwa-connection-indicator.online {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.pwa-connection-indicator.offline {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    animation: pulse-offline 2s ease-in-out infinite;
}

@keyframes pulse-offline {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
    }
    50% {
        box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    }
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.pwa-connection-indicator.offline .connection-dot {
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Update Notification */
.pwa-update-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 10000;
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 500;
}

.pwa-update-content i {
    font-size: 18px;
    color: #3b82f6;
}

.pwa-update-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-update-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.pwa-update-btn i {
    font-size: 14px;
}

.pwa-update-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-update-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Mobile Install Button - Floating Action Button */
.pwa-install-btn.mobile {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    z-index: 999;
    justify-content: center;
    align-items: center;
    animation: bounceIn 0.6s ease-out;
}

.pwa-install-btn.mobile:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.pwa-install-btn.mobile:active {
    transform: scale(0.95);
}

.pwa-install-btn.mobile i {
    font-size: 24px;
    margin: 0;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .pwa-install-btn:not(.mobile) {
        padding: 6px 12px;
        font-size: 13px;
    }

    .pwa-install-btn:not(.mobile) span {
        display: none;
    }

    .pwa-install-btn:not(.mobile) i {
        font-size: 18px;
    }

    .pwa-connection-indicator {
        bottom: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .connection-dot {
        width: 6px;
        height: 6px;
    }

    .pwa-update-notification {
        top: auto;
        bottom: 70px;
        right: 10px;
        left: 10px;
        flex-direction: column;
        align-items: stretch;
    }

    .pwa-update-content {
        justify-content: center;
    }

    .pwa-update-btn {
        width: 100%;
        justify-content: center;
    }

    .pwa-update-close {
        position: absolute;
        top: 8px;
        right: 8px;
    }
}

/* Tablet Landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .pwa-connection-indicator {
        bottom: 15px;
        right: 15px;
    }
}

/* iOS Specific Styles */
@supports (-webkit-touch-callout: none) {
    .pwa-install-btn {
        -webkit-tap-highlight-color: transparent;
    }

    .pwa-update-btn,
    .pwa-update-close {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Dark mode adjustments (if needed) */
@media (prefers-color-scheme: dark) {
    .pwa-update-notification {
        background: rgba(15, 23, 42, 0.98);
    }
}

/* Accessibility improvements */
.pwa-install-btn:focus,
.pwa-update-btn:focus,
.pwa-update-close:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* iOS Install Instructions Modal */
.pwa-ios-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

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

.pwa-ios-install-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: slideUp 0.4s ease-out;
}

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

.pwa-ios-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: #cbd5e1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pwa-ios-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.pwa-ios-install-content h3 {
    color: #f1f5f9;
    font-size: 22px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-ios-install-content h3 i {
    color: #3b82f6;
    font-size: 24px;
}

.pwa-ios-install-content p {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.pwa-ios-install-content ol {
    list-style: none;
    counter-reset: step-counter;
    padding: 0;
    margin: 20px 0;
}

.pwa-ios-install-content ol li {
    counter-increment: step-counter;
    position: relative;
    padding: 15px 15px 15px 50px;
    margin-bottom: 12px;
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.5;
}

.pwa-ios-install-content ol li::before {
    content: counter(step-counter);
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.pwa-ios-install-content ol li i {
    margin-right: 8px;
    color: #3b82f6;
}

.pwa-ios-install-content .tip {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid #10b981;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 20px;
    color: #d1fae5;
    font-size: 13px;
}

.pwa-ios-install-content .tip i {
    color: #10b981;
    margin-right: 8px;
}

/* Smooth transitions for all interactive elements */
.pwa-install-btn,
.pwa-update-btn,
.pwa-update-close,
.pwa-connection-indicator {
    transition: all 0.2s ease;
}

/* Loading state for update button */
.pwa-update-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.pwa-update-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
