/* PWA Specific Styles */

/* Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.install-prompt.fade-in {
    transform: translateY(0);
}

.install-prompt-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 16px;
}

.install-prompt-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.install-prompt-text {
    flex: 1;
    min-width: 0;
}

.install-prompt-text h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.install-prompt-text p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.install-prompt-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.install-prompt-actions button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.install-prompt-actions .btn-secondary {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.install-prompt-actions .btn-primary {
    background: var(--primary-color);
    color: white;
}

.install-prompt-actions button:hover {
    transform: translateY(-1px);
}

/* Update Notification */
.update-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    z-index: 10001;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.update-notification.slide-down {
    transform: translateY(0);
}

.update-notification-content {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 12px;
}

.update-notification-content i {
    font-size: 16px;
    animation: spin 2s linear infinite;
}

.update-notification-content span {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.update-notification-content button {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.update-notification-content .btn-primary.small {
    background: white;
    color: var(--primary-color);
}

.update-notification-content .btn-text {
    background: none;
    color: white;
    font-size: 18px;
    padding: 4px 8px;
    opacity: 0.8;
}

.update-notification-content .btn-text:hover {
    opacity: 1;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #FF5722;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10002;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
}

.offline-indicator i {
    font-size: 12px;
}

/* PWA Splash Screen Styles */
@media (display-mode: standalone) {
    /* Hide browser UI elements when in standalone mode */
    .browser-only {
        display: none !important;
    }

    /* Adjust header for standalone mode */
    .dashboard-header {
        padding-top: env(safe-area-inset-top, 20px);
    }

    /* Adjust bottom navigation for standalone mode */
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* iOS Specific PWA Styles */
@supports (-webkit-touch-callout: none) {
    .install-prompt {
        /* iOS Safari specific adjustments */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* Dark Mode Support for PWA Components */
@media (prefers-color-scheme: dark) {
    .install-prompt {
        background: #1a1a1a;
        border-top-color: #333;
    }

    .install-prompt-text h3 {
        color: #ffffff;
    }

    .install-prompt-text p {
        color: #cccccc;
    }

    .install-prompt-actions .btn-secondary {
        background: #333;
        color: #ffffff;
        border-color: #444;
    }

    .offline-indicator {
        background: #d32f2f;
    }
}

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

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

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

/* Loading Skeleton for Offline Content */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* PWA Icon Styles */
.pwa-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-block;
    background: var(--primary-color);
    color: white;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
}

/* Responsive PWA Styles */
@media (max-width: 480px) {
    .install-prompt-content {
        padding: 12px 16px;
        gap: 12px;
    }

    .install-prompt-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .install-prompt-text h3 {
        font-size: 15px;
    }

    .install-prompt-text p {
        font-size: 13px;
    }

    .install-prompt-actions button {
        padding: 6px 12px;
        font-size: 13px;
    }

    .update-notification-content {
        padding: 10px 16px;
        gap: 10px;
    }

    .offline-indicator {
        top: 16px;
        right: 16px;
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .install-prompt-icon,
    .pwa-icon {
        /* Crisp icons on high DPI displays */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}