/* PWA-specific styles for QuickTag Images */

/* Install Button in Header */
.pwa-install-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(94, 114, 228, 0.2);
}

.pwa-install-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(94, 114, 228, 0.3);
}

.pwa-install-button .install-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    flex-shrink: 0;
}

/* Install Popup */
.pwa-install-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.pwa-install-popup.popup-show {
    animation: fadeIn 0.3s ease;
}

.pwa-install-popup.popup-hide {
    animation: fadeOut 0.3s ease;
}

.install-popup-content {
    background: var(--surface);
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideUp 0.3s ease;
}

.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.popup-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.popup-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(94, 114, 228, 0.2);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.install-popup-content h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
}

.install-popup-content > p {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.6;
}

.popup-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
    padding: 20px;
    background: var(--background);
    border-radius: 12px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-primary);
}

.feature-item svg {
    flex-shrink: 0;
}

.popup-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.popup-actions button {
    flex: 1;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.popup-actions .btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-actions .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.popup-actions .btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-actions .btn-secondary:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

/* Notifications */
.pwa-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    z-index: 10001;
    transition: transform 0.3s ease;
}

.pwa-notification.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-notification-success {
    background: var(--success);
    color: white;
}

.pwa-notification-error {
    background: var(--error);
    color: white;
}

.pwa-notification-info {
    background: var(--info);
    color: white;
}

/* Update notification */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 16px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.pwa-update-notification.show {
    transform: translateX(0);
}

.pwa-update-notification p {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
}

.pwa-update-notification .btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* iOS Install Instructions */
.ios-install-instructions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    max-width: 360px;
    width: calc(100% - 40px);
    z-index: 10001;
    animation: slideUp 0.3s ease;
}

.ios-instructions-content h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.ios-instructions-content ol {
    margin: 0 0 20px 0;
    padding-left: 24px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
}

.ios-instructions-content li {
    margin-bottom: 8px;
}

.ios-share-icon {
    display: inline-block;
    background: var(--background);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 16px;
}

.ios-instructions-content button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ios-instructions-content button:hover {
    background: var(--primary-hover);
}

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

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

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

/* Media Queries */
@media (max-width: 768px) {
    .pwa-install-button {
        padding: 6px 12px;
        font-size: 12px;
    }

    .pwa-install-button span {
        display: none; /* Hide text on mobile, show only icon */
    }

    .install-popup-content {
        padding: 24px;
    }

    .popup-icon {
        width: 60px;
        height: 60px;
    }

    .install-popup-content h3 {
        font-size: 20px;
    }

    .popup-features {
        padding: 16px;
    }

    .popup-actions {
        flex-direction: column;
    }

    .popup-actions button {
        width: 100%;
    }
}

/* PWA Standalone Mode Adjustments */
@media (display-mode: standalone) {
    /* Add padding for iOS status bar in standalone mode */
    .app-header {
        padding-top: env(safe-area-inset-top, 20px);
    }

    /* Hide install UI elements in standalone mode */
    .pwa-install-button,
    .pwa-install-popup,
    .ios-install-instructions {
        display: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #1a1a2e;
        --surface: #16213e;
        --surface-hover: #0f3460;
        --border: #2a3f5f;
        --text-primary: #e8e8e8;
        --text-secondary: #b8b8b8;
        --text-muted: #888888;
    }

    .popup-icon {
        background: var(--surface);
    }

    .popup-close:hover {
        background: var(--surface-hover);
    }
}