/**
 * Remaja Bergerak PWA Stylesheet
 * High-End UI & UX for Progressive Web App
 */

/* ==========================================================================
   1. Root Variables & Reset Helpers
   ========================================================================== */
:root {
    --pwa-primary: #00A859;
    --pwa-primary-dark: #008D4A;
    --pwa-primary-light: #E8F8F0;
    --pwa-accent: #3B82F6;
    --pwa-dark: #0F172A;
    --pwa-gray: #64748B;
    --pwa-bg: #F8FAFC;
    --pwa-surface: #FFFFFF;
    --pwa-radius-lg: 24px;
    --pwa-radius-md: 16px;
    --pwa-radius-sm: 12px;
    --pwa-shadow-sheet: 0 -10px 40px -10px rgba(0, 0, 0, 0.25);
    --pwa-shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* Standalone adjustments */
body.pwa-standalone {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior-y: contain;
    padding-top: env(safe-area-inset-top);
    padding-bottom: max(80px, env(safe-area-inset-bottom)) !important;
}

body.pwa-standalone input,
body.pwa-standalone textarea,
body.pwa-standalone select {
    user-select: auto;
    -webkit-user-select: auto;
}

/* ==========================================================================
   2. PWA Install Bottom Sheet / Modal (Android / Desktop)
   ========================================================================== */
.pwa-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-sheet-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.pwa-sheet-card {
    width: 100%;
    max-width: 500px;
    background: #FFFFFF;
    border-top-left-radius: var(--pwa-radius-lg);
    border-top-right-radius: var(--pwa-radius-lg);
    box-shadow: var(--pwa-shadow-sheet);
    padding: 20px 24px 32px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 640px) {
    .pwa-sheet-backdrop {
        align-items: center;
        padding: 20px;
    }
    .pwa-sheet-card {
        border-radius: var(--pwa-radius-lg);
        transform: translateY(20px) scale(0.96);
        padding-bottom: 28px;
    }
    .pwa-sheet-backdrop.active .pwa-sheet-card {
        transform: translateY(0) scale(1);
    }
}

.pwa-sheet-backdrop.active .pwa-sheet-card {
    transform: translateY(0);
}

/* Drag Pill Handle */
.pwa-drag-handle {
    width: 44px;
    height: 5px;
    background: #CBD5E1;
    border-radius: 999px;
    margin: 0 auto 16px;
}

/* App Identity in Sheet */
.pwa-app-identity {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.pwa-app-icon-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.pwa-app-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 8px 16px -4px rgba(0, 168, 89, 0.35);
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
}

.pwa-app-verified {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 22px;
    height: 22px;
    background: #00A859;
    color: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border: 2px solid #FFFFFF;
}

.pwa-app-details {
    flex: 1;
    text-align: left;
}

.pwa-app-name {
    font-size: 18px;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.25;
}

.pwa-app-sub {
    font-size: 13px;
    color: #64748B;
    margin-top: 2px;
}

.pwa-app-badges {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.pwa-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: #F1F5F9;
    color: #475569;
}

.pwa-badge.verified {
    background: #E8F8F0;
    color: #008D4A;
}

/* Value Propositions */
.pwa-features-list {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: var(--pwa-radius-md);
    padding: 14px 16px;
    margin-bottom: 22px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pwa-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.pwa-feature-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00A859;
    font-size: 14px;
    flex-shrink: 0;
}

.pwa-feature-text h4 {
    font-size: 13px;
    font-weight: 700;
    color: #1E293B;
    margin: 0;
}

.pwa-feature-text p {
    font-size: 12px;
    color: #64748B;
    margin: 2px 0 0;
    line-height: 1.35;
}

/* Action Buttons */
.pwa-actions-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pwa-btn-install {
    width: 100%;
    background: linear-gradient(135deg, #00A859 0%, #008D4A 100%);
    color: #FFFFFF;
    border: none;
    padding: 14px 20px;
    border-radius: var(--pwa-radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px -4px rgba(0, 168, 89, 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    outline: none;
}

.pwa-btn-install:active {
    transform: scale(0.98);
    box-shadow: 0 4px 12px -2px rgba(0, 168, 89, 0.45);
}

.pwa-btn-dismiss {
    width: 100%;
    background: transparent;
    color: #64748B;
    border: none;
    padding: 10px 16px;
    border-radius: var(--pwa-radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.pwa-btn-dismiss:hover {
    background-color: #F1F5F9;
    color: #1E293B;
}

/* ==========================================================================
   3. iOS Safari Specific Visual Guide Sheet
   ========================================================================== */
.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    margin-bottom: 8px;
    text-align: left;
}

.pwa-ios-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #00A859;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-ios-step-desc {
    font-size: 13px;
    color: #334155;
    line-height: 1.4;
}

.pwa-ios-key-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    padding: 2px 7px;
    color: #007AFF;
    font-weight: 600;
    margin: 0 2px;
}

.pwa-ios-pointer {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 16px;
    color: #00A859;
    animation: bounceDown 1.5s infinite;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ==========================================================================
   4. Live Connectivity Status Pill (Online / Offline Toast)
   ========================================================================== */
.pwa-toast-banner {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 100000;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    max-width: 90%;
    width: max-content;
}

.pwa-toast-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.pwa-toast-offline {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.pwa-toast-online {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}


/* ==========================================================================
   6. Header Quick Install Pill Button
   ========================================================================== */
.pwa-header-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #E8F8F0 0%, #D1FAE5 100%);
    color: #008D4A;
    border: 1px solid #A7F3D0;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 168, 89, 0.12);
    transition: transform 0.2s, background-color 0.2s;
    outline: none;
}

.pwa-header-install-btn:hover {
    background: #D1FAE5;
    transform: translateY(-1px);
}

.pwa-header-install-btn:active {
    transform: scale(0.96);
}

.pwa-header-install-btn i {
    font-size: 13px;
    color: #00A859;
    animation: subtleBounce 2s infinite;
}

@keyframes subtleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* Hide header install button when running in standalone PWA */
@media all and (display-mode: standalone) {
    .pwa-header-install-btn,
    .pwa-sheet-backdrop {
        display: none !important;
    }
}
