/* ============================================================
   pwa.css — FreshZone PWA Styles
   Splash + Page Transitions + Install Banner + Loader
   ============================================================ */


/* ── SPLASH SCREEN ─────────────────────────────────────────── */
#fz-splash {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #004e7a 0%, #00b4d8 60%, #90e0ef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.5s ease;
}
#fz-splash.fz-splash-hide {
    opacity: 0;
    pointer-events: none;
}

.fz-splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: splashIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1) both;
}
@keyframes splashIn {
    from { opacity: 0; transform: scale(0.82) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.fz-splash-logo {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
    background: white;
    padding: 8px;
    object-fit: contain;
}

.fz-splash-name {
    font-family: 'Syne', 'Lexend', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.fz-splash-tagline {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.75);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.fz-splash-spinner { margin-top: 6px; }
.fz-spinner-ring {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOP LOADING BAR (slow network only) ───────────────────── */
#fz-page-loader {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 99998;
    height: 3px;
}
.fz-loader-bar {
    height: 100%;
    background: linear-gradient(90deg, #00b4d8, #90e0ef, #00b4d8);
    background-size: 200% 100%;
    animation: loaderSlide 1.2s ease-in-out infinite;
    border-radius: 0 3px 3px 0;
    width: 0;
    animation: loaderGrow 2s ease forwards, loaderShimmer 1s linear infinite;
}
@keyframes loaderGrow {
    0%  { width: 0%; opacity: 1; }
    70% { width: 85%; opacity: 1; }
    100%{ width: 92%; opacity: 1; }
}
@keyframes loaderShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
#fz-page-loader.fz-loader-done .fz-loader-bar {
    width: 100% !important;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.3s ease 0.1s;
}

/* ── INSTALL BANNER ────────────────────────────────────────── */
#fz-install-banner {
    position: fixed;
    bottom: 16px;
    left: 12px;
    right: 12px;
    background: white;
    border-radius: 18px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border: 1px solid rgba(0,78,122,0.1);
    z-index: 9500;
    transform: translateY(24px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175,0.885,0.32,1.1);
}
[data-theme="dark"] #fz-install-banner {
    background: #0f1e2c;
    border-color: rgba(0,180,216,0.18);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#fz-install-banner.fz-install-show {
    transform: translateY(0);
    opacity: 1;
}

.fz-install-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.fz-install-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
}
.fz-install-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.fz-install-text strong {
    font-size: 0.88rem;
    font-weight: 700;
    color: #004e7a;
    font-family: 'DM Sans', sans-serif;
}
[data-theme="dark"] .fz-install-text strong { color: #90e0ef; }
.fz-install-text span {
    font-size: 0.72rem;
    color: #6c757d;
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
[data-theme="dark"] .fz-install-text span { color: #94a3b8; }

.fz-install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.fz-install-btn {
    background: #004e7a !important;
    color: white !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 8px 16px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    width: auto !important;
    margin: 0 !important;
    box-shadow: 0 3px 10px rgba(0,78,122,0.3) !important;
    text-transform: none !important;
    min-width: unset !important;
    display: inline-flex !important;
    align-items: center !important;
}
.fz-install-btn:hover { background: #00b4d8 !important; }
.fz-install-btn::after { display: none !important; }

.fz-install-dismiss {
    background: transparent !important;
    color: #94a3b8 !important;
    border: none !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    min-width: unset !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    box-shadow: none !important;
    text-transform: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.fz-install-dismiss:hover { background: rgba(0,0,0,0.06) !important; }
.fz-install-dismiss::after { display: none !important; }

/* ── STANDALONE MODE TWEAKS ────────────────────────────────── */
@media (display-mode: standalone) {
    .hotkey-badge { display: none !important; }
    nav {
        padding-top: calc(0.7rem + env(safe-area-inset-top, 0px));
    }
}

/* ── DESKTOP — hide PWA-only elements ──────────────────────── */
@media (min-width: 901px) {
    #fz-install-banner { display: none !important; }
    #fz-splash { display: none !important; }
    #fz-page-loader { display: none !important; }
}


/* ── FRESHZONE pwa.css VISUAL UPGRADE ──────────────────────── */

/* Splash - richer gradient */
#fz-splash {
    background: linear-gradient(155deg, #003a5c 0%, #005f96 30%, #0093b8 65%, #00c5e0 100%) !important;
}

/* Install banner - iced blue */
#fz-install-banner {
    background: linear-gradient(135deg, rgba(218,242,255,0.99), rgba(200,232,255,0.98)) !important;
    border-color: rgba(0,100,160,0.18) !important;
    box-shadow: 0 8px 32px rgba(0,50,100,0.18) !important;
}
.fz-install-text strong { color: #003a5c !important; }

/* Loader bar color — teal */
.fz-loader-bar {
    background: linear-gradient(90deg, #00b4d8, #0ecfef, #00b4d8) !important;
}

/* ── iOS INSTALL BANNER ─────────────────────────────────────── */
#fz-ios-install-banner {
    position: fixed;
    bottom: 16px;
    left: 12px;
    right: 12px;
    background: white;
    border-radius: 18px;
    padding: 14px 16px;
    z-index: 9500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border: 1px solid rgba(0,78,122,0.1);
    transform: translateY(24px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175,0.885,0.32,1.1);
}
[data-theme="dark"] #fz-ios-install-banner {
    background: #0f1e2c;
    border-color: rgba(0,180,216,0.18);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#fz-ios-install-banner.fz-ios-install-show {
    transform: translateY(0);
    opacity: 1;
}

.fz-ios-install-content {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.fz-ios-install-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.fz-ios-install-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
}

.fz-ios-install-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.fz-ios-install-text strong {
    font-size: 0.85rem;
    font-weight: 700;
    color: #004e7a;
    font-family: 'DM Sans', sans-serif;
}
[data-theme="dark"] .fz-ios-install-text strong { color: #90e0ef; }

.fz-ios-install-text span {
    font-size: 0.7rem;
    color: #6c757d;
    font-family: 'DM Sans', sans-serif;
    display: flex;
    align-items: center;
    gap: 4px;
}
[data-theme="dark"] .fz-ios-install-text span { color: #94a3b8; }

.ios-share-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.fz-ios-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,78,122,0.1);
}
[data-theme="dark"] .fz-ios-steps { border-color: rgba(0,180,216,0.18); }

.fz-ios-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #555;
    font-family: 'DM Sans', sans-serif;
}
[data-theme="dark"] .fz-ios-step { color: #94a3b8; }

.fz-ios-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #004e7a;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}
[data-theme="dark"] .fz-ios-step-num { background: #00b4d8; }

.fz-ios-step strong {
    font-weight: 700;
    color: #004e7a;
}
[data-theme="dark"] .fz-ios-step strong { color: #90e0ef; }

/* ── OFFLINE INDICATOR ──────────────────────────────────────── */
body.fz-offline::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f39c12, #e74c3c, #f39c12);
    background-size: 200% 100%;
    animation: offlinePulse 2s ease-in-out infinite;
    z-index: 99999;
}

@keyframes offlinePulse {
    0%, 100% { background-position: 0% 0; }
    50% { background-position: 200% 0; }
}

/* ── MASKABLE ICON SAFE ZONE VISUALIZATION ─────────────────── */
/* This helps visualize the 40% safe zone for maskable icons */
.fz-maskable-guide {
    position: relative;
    width: 192px;
    height: 192px;
    margin: 20px auto;
}

.fz-maskable-guide::before {
    content: 'Safe Zone (40% padding)';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 115px;
    height: 115px;
    border: 2px dashed rgba(255,255,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: rgba(255,255,0,0.8);
    text-align: center;
    pointer-events: none;
}

/* ── PWA UPDATE NOTIFICATION ────────────────────────────────── */
#fz-update-banner {
    position: fixed;
    top: 16px;
    left: 12px;
    right: 12px;
    background: linear-gradient(135deg, rgba(0,200,150,0.95), rgba(0,180,120,0.95));
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0,200,150,0.3);
    z-index: 9600;
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175,0.885,0.32,1.1);
    color: white;
    font-family: 'DM Sans', sans-serif;
}

#fz-update-banner.fz-update-show {
    transform: translateY(0);
    opacity: 1;
}

#fz-update-banner span {
    font-size: 0.82rem;
    font-weight: 600;
}

#fz-update-banner button {
    background: rgba(255,255,255,0.25);
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

#fz-update-banner button:hover {
    background: rgba(255,255,255,0.35);
}
