/**
 * PWA UI Components Styles
 * PTIK FT UNIMA
 */

/* ========================================
   PWA Install Banner
   ======================================== */

#pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 1rem;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#pwa-install-banner.show {
    transform: translateY(0);
    pointer-events: auto;
}

#pwa-install-banner.hiding {
    transform: translateY(100%);
}

.pwa-install-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 1rem;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.pwa-install-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 200px;
}

.pwa-install-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f97316, #ea580c);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.pwa-install-banner-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-install-banner-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pwa-install-banner-text strong {
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

.pwa-install-banner-text span {
    font-size: 0.875rem;
    color: #94a3b8;
}

.pwa-install-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.pwa-install-btn-dismiss {
    padding: 0.625rem 1rem;
    background: transparent;
    border: 1px solid #475569;
    border-radius: 0.5rem;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-install-btn-dismiss:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #64748b;
    color: white;
}

.pwa-install-btn-install {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #f97316, #ea580c);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.pwa-install-btn-install:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

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

.pwa-install-btn-install svg {
    width: 16px;
    height: 16px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    #pwa-install-banner {
        padding: 0.75rem;
    }

    .pwa-install-banner {
        padding: 1rem;
        border-radius: 0.75rem;
    }

    .pwa-install-banner-content {
        width: 100%;
    }

    .pwa-install-banner-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ========================================
   PWA Update Notification
   ======================================== */

#pwa-update-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 1rem;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#pwa-update-notification.show {
    transform: translateY(0);
    pointer-events: auto;
}

.pwa-update-notification {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
    color: white;
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.pwa-update-content svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.pwa-update-content span {
    font-size: 0.9375rem;
    font-weight: 500;
}

.pwa-update-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: none;
    border-radius: 0.5rem;
    color: #1d4ed8;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-update-btn:hover {
    transform: scale(1.05);
}

/* ========================================
   PWA Toast Notifications
   ======================================== */

.pwa-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100vw - 2rem);
}

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

.pwa-toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.pwa-toast-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.pwa-toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.pwa-toast-info {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.pwa-toast-close {
    background: transparent;
    border: none;
    color: currentColor;
    opacity: 0.7;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s ease;
}

.pwa-toast-close:hover {
    opacity: 1;
}

/* ========================================
   PWA Offline Indicator
   ======================================== */

.pwa-offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9997;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.pwa-offline-indicator.show {
    transform: translateY(0);
}

.pwa-offline-indicator.online {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* ========================================
   PWA Install Prompt (Inline)
   ======================================== */

.pwa-install-prompt-inline {
    display: none;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid #fed7aa;
    border-radius: 1rem;
    text-align: center;
}

.pwa-install-prompt-inline.show {
    display: block;
}

.pwa-install-prompt-inline h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.pwa-install-prompt-inline p {
    font-size: 0.9375rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.pwa-install-prompt-inline button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #f97316, #ea580c);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.pwa-install-prompt-inline button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

/* ========================================
   iOS Install Instructions
   ======================================== */

.pwa-ios-instructions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 1rem;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.pwa-ios-instructions.show {
    transform: translateY(0);
    pointer-events: auto;
}

.pwa-ios-instructions-content {
    max-width: 400px;
    margin: 0 auto;
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.pwa-ios-instructions-content h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
}

.pwa-ios-instructions-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
}

.pwa-ios-step-number {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.pwa-ios-step-text {
    font-size: 0.9375rem;
    color: #475569;
}

.pwa-ios-step-text svg {
    display: inline;
    vertical-align: middle;
    width: 20px;
    height: 20px;
}

.pwa-ios-close {
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border: none;
    border-radius: 0.5rem;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-ios-close:hover {
    background: #e2e8f0;
}

/* Arrow pointing to share button */
.pwa-ios-arrow {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid white;
}

/* ========================================
   Standalone Mode Styles
   ======================================== */

/* Hide browser-specific elements in standalone mode */
@media all and (display-mode: standalone) {
    /* Hide install prompts */
    #pwa-install-banner,
    .pwa-install-prompt-inline,
    .pwa-ios-instructions {
        display: none !important;
    }

    /* Adjust for iOS safe areas */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ========================================
   Reduced Motion Support
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    #pwa-install-banner,
    #pwa-update-notification,
    .pwa-toast,
    .pwa-offline-indicator,
    .pwa-ios-instructions {
        transition: none;
    }

    .pwa-install-btn-install:hover,
    .pwa-update-btn:hover {
        transform: none;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    #pwa-install-banner,
    #pwa-update-notification,
    .pwa-toast,
    .pwa-offline-indicator,
    .pwa-ios-instructions,
    .pwa-install-prompt-inline {
        display: none !important;
    }
}
