/**
 * SI-PEGAWAIRSD Progressive Web App (PWA) Styling
 */

:root {
    --pwa-primary: #4e73df;
    --pwa-primary-hover: #2e59d9;
    --pwa-bg: #ffffff;
    --pwa-text-main: #2e384d;
    --pwa-text-muted: #6e7a8a;
    --pwa-shadow: 0 12px 36px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.08);
    --pwa-radius: 16px;
    --pwa-transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1. Floating Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 420px;
    width: calc(100% - 48px);
    background: var(--pwa-bg);
    border-radius: var(--pwa-radius);
    box-shadow: var(--pwa-shadow);
    padding: 16px 20px;
    z-index: 99999;
    border: 1px solid rgba(78, 115, 223, 0.15);
    display: none;
    opacity: 0;
    transform: translateY(24px) scale(0.97);
    transition: var(--pwa-transition);
    box-sizing: border-box;
}

.pwa-install-banner.pwa-show {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pwa-banner-body {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.pwa-app-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #f8f9fc;
    padding: 3px;
    border: 1px solid #e3e6f0;
    object-fit: contain;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.pwa-banner-text {
    flex-grow: 1;
    min-width: 0;
}

.pwa-banner-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--pwa-text-main);
    margin: 0 0 2px 0;
    line-height: 1.25;
}

.pwa-banner-desc {
    font-size: 0.8rem;
    color: var(--pwa-text-muted);
    margin: 0;
    line-height: 1.35;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.pwa-btn-install {
    background: var(--pwa-primary);
    color: #ffffff !important;
    border: none;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--pwa-transition);
    text-decoration: none;
}

.pwa-btn-install:hover {
    background: var(--pwa-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(78, 115, 223, 0.3);
}

.pwa-btn-dismiss {
    background: transparent;
    color: var(--pwa-text-muted) !important;
    border: none;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--pwa-transition);
}

.pwa-btn-dismiss:hover {
    background: #f1f3f9;
    color: var(--pwa-text-main) !important;
}

/* 2. Toast Notifications */
.pwa-toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    pointer-events: none;
}

.pwa-toast {
    pointer-events: auto;
    background: #ffffff;
    color: var(--pwa-text-main);
    border-radius: 12px;
    box-shadow: var(--pwa-shadow);
    padding: 12px 16px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-left: 4px solid var(--pwa-primary);
    opacity: 0;
    transform: translateY(16px);
    transition: var(--pwa-transition);
}

.pwa-toast.pwa-show {
    opacity: 1;
    transform: translateY(0);
}

.pwa-toast-success {
    border-left-color: #1cc88a;
}

.pwa-toast-warning {
    border-left-color: #f6c23e;
}

.pwa-toast-error {
    border-left-color: #e74a3b;
}

.pwa-toast-content {
    display: flex;
    align-items: center;
    line-height: 1.4;
}

.pwa-toast-close {
    background: none;
    border: none;
    font-size: 1.15rem;
    color: #a0aec0;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.pwa-toast-close:hover {
    color: var(--pwa-text-main);
}

/* Update Toast */
.pwa-toast-update {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    border-left-color: #36b9cc;
}

.pwa-btn-reload {
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.pwa-spin {
    animation: pwa-spinner 1.5s linear infinite;
}

@keyframes pwa-spinner {
    100% { transform: rotate(360deg); }
}

/* 3. Universal Guide Modal */
.pwa-ios-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.pwa-ios-modal.pwa-show {
    display: flex;
    opacity: 1;
}

@media (max-width: 576px) {
    .pwa-ios-modal {
        align-items: flex-end;
        padding: 12px;
    }
}


.pwa-ios-sheet {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: 20px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: var(--pwa-shadow);
    transform: translateY(30px);
    transition: var(--pwa-transition);
}

.pwa-ios-modal.pwa-show .pwa-ios-sheet {
    transform: translateY(0);
}

.pwa-ios-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--pwa-text-main);
}

.pwa-ios-steps {
    list-style: none;
    padding: 0;
    margin: 16px 0;
    text-align: left;
    font-size: 0.88rem;
    color: var(--pwa-text-muted);
}

.pwa-ios-steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #edf2f7;
}

.pwa-step-badge {
    background: rgba(78, 115, 223, 0.1);
    color: var(--pwa-primary);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    flex-shrink: 0;
}

/* 4. Responsive adjustments */
@media (max-width: 576px) {
    .pwa-install-banner {
        bottom: 16px;
        right: 16px;
        left: 16px;
        width: auto;
        padding: 14px 16px;
    }

    .pwa-toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
}

/* ==========================================================================
   5. PWA Universal Navigation Progress Bar & Instant Touch Feedback
   ========================================================================== */
.pwa-top-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3.5px;
    background: linear-gradient(90deg, #3b82f6 0%, #06b6d4 50%, #10b981 100%);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.75), 0 0 6px rgba(59, 130, 246, 0.5);
    z-index: 9999999;
    opacity: 0;
    pointer-events: none;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.pwa-top-loader.pwa-active {
    opacity: 1;
}

/* Floating Loading Pill for PWA Action Processing */
.pwa-processing-indicator {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 9999998;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.pwa-processing-indicator.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

