/**
 * PWA Install Button & Notifications
 * Styling untuk tombol install dan notifikasi PWA
 */

/* ========================================
   PWA INSTALL BUTTON
   ======================================== */

.pwa-install-button {
    position: fixed;
    bottom: -100px;
    right: 20px;
    z-index: 10000;
    
    display: flex;
    align-items: center;
    gap: 10px;
    
    padding: 15px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.pwa-install-button.show {
    bottom: 20px;
    animation: slideUpBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.pwa-install-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.pwa-install-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.pwa-install-button svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

@keyframes slideUpBounce {
    0% {
        bottom: -100px;
        opacity: 0;
    }
    60% {
        bottom: 30px;
        opacity: 1;
    }
    80% {
        bottom: 15px;
    }
    100% {
        bottom: 20px;
    }
}

/* ========================================
   PWA NOTIFICATIONS
   ======================================== */

.pwa-notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    
    padding: 15px 25px;
    background: white;
    color: #333;
    border-radius: 10px;
    
    font-size: 14px;
    font-weight: 500;
    
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    max-width: 90%;
    width: auto;
    white-space: nowrap;
}

.pwa-notification.show {
    top: 20px;
}

.pwa-notification.success {
    background: #4CAF50;
    color: white;
}

.pwa-notification.error {
    background: #f44336;
    color: white;
}

.pwa-notification.info {
    background: #2196F3;
    color: white;
}

/* ========================================
   UPDATE NOTIFICATION
   ======================================== */

.update-notification {
    position: fixed;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    
    padding: 20px;
    max-width: 400px;
    width: 90%;
    
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.update-notification.show {
    bottom: 20px;
}

.update-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.update-icon {
    font-size: 32px;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.update-text {
    flex: 1;
}

.update-text strong {
    display: block;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.update-text p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.update-button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.update-button:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.update-button:active {
    transform: scale(0.98);
}

/* ========================================
   INSTALL PROMPT MODAL
   ======================================== */

.install-prompt-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10002;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.install-prompt-modal.show {
    opacity: 1;
    visibility: visible;
}

.install-prompt-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    
    transform: scale(0.9);
    transition: transform 0.3s;
}

.install-prompt-modal.show .install-prompt-content {
    transform: scale(1);
}

.install-prompt-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.install-prompt-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.install-prompt-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.install-prompt-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
}

.install-prompt-buttons {
    display: flex;
    gap: 10px;
}

.install-prompt-buttons button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.install-prompt-buttons .btn-install {
    background: #667eea;
    color: white;
}

.install-prompt-buttons .btn-install:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.install-prompt-buttons .btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.install-prompt-buttons .btn-cancel:hover {
    background: #e0e0e0;
}

/* ========================================
   STANDALONE MODE (When installed)
   ======================================== */

@media (display-mode: standalone) {
    .pwa-install-button {
        display: none !important;
    }
    
    /* Add padding for iOS safe area */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .pwa-install-button {
        right: 10px;
        bottom: -100px;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .pwa-install-button.show {
        bottom: 10px;
    }
    
    .pwa-install-button svg {
        width: 18px;
        height: 18px;
    }
    
    .update-notification {
        max-width: 90%;
        padding: 15px;
    }
    
    .update-icon {
        font-size: 24px;
    }
    
    .update-text strong {
        font-size: 14px;
    }
    
    .update-text p {
        font-size: 12px;
    }
    
    .update-button {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .install-prompt-content {
        padding: 20px;
    }
    
    .install-prompt-icon {
        width: 60px;
        height: 60px;
    }
    
    .install-prompt-title {
        font-size: 20px;
    }
    
    .install-prompt-description {
        font-size: 13px;
    }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

@media (prefers-color-scheme: dark) {
    .pwa-notification {
        background: #2d2d2d;
        color: #fff;
    }
    
    .update-notification {
        background: #2d2d2d;
    }
    
    .update-text strong {
        color: #fff;
    }
    
    .update-text p {
        color: #aaa;
    }
    
    .install-prompt-content {
        background: #2d2d2d;
    }
    
    .install-prompt-title {
        color: #fff;
    }
    
    .install-prompt-description {
        color: #aaa;
    }
    
    .install-prompt-buttons .btn-cancel {
        background: #3d3d3d;
        color: #aaa;
    }
    
    .install-prompt-buttons .btn-cancel:hover {
        background: #4d4d4d;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .pwa-install-button,
    .pwa-notification,
    .update-notification,
    .install-prompt-modal {
        display: none !important;
    }
}
