/* =============================================================================
   Progressify  –  Public Frontend Styles
   ========================================================================== */
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

/* ── CSS Variables ────────────────────────────────────────────────────────── */
:root {
    --prg-primary:   #1a73e8;
    --prg-accent:    #8b5cf6;
    --prg-success:   #10b981;
    --prg-warn:      #f59e0b;
    --prg-danger:    #ef4444;
    --prg-bg:        #ffffff;
    --prg-surface:   #f8fafc;
    --prg-text:      #1e293b;
    --prg-muted:     #64748b;
    --prg-border:    rgba(0,0,0,.08);
    --prg-radius:    12px;
    --prg-tabbar-h:  64px;
    --prg-transition:.25s cubic-bezier(.4,0,.2,1);
}

/* ── Dark Mode Variables ──────────────────────────────────────────────────── */
.progressify-dark {
    --prg-bg:      #0f172a;
    --prg-surface: #1e293b;
    --prg-text:    #f1f5f9;
    --prg-muted:   #94a3b8;
    --prg-border:  rgba(255,255,255,.08);
    color-scheme: dark;
}
.progressify-dark body { background-color: var(--prg-bg) !important; color: var(--prg-text) !important; }

/* ================================================================
   INSTALL BANNER
   ================================================================ */
.prg-install-banner {
    position: fixed;
    bottom: calc(var(--prg-tabbar-h) + 12px);
    left: 12px;
    right: 12px;
    z-index: 9990;
    animation: prg-slide-up .35s var(--prg-transition) both;
}
.prg-install-banner__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--prg-bg);
    border: 1px solid var(--prg-border);
    border-radius: var(--prg-radius);
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    backdrop-filter: blur(12px);
}
.prg-install-banner__icon img { border-radius: 10px; flex-shrink: 0; }
.prg-install-banner__text { flex: 1; }
.prg-install-banner__text strong { display: block; font-size: 14px; font-weight: 600; }
.prg-install-banner__text span { font-size: 12px; color: var(--prg-muted); }
.prg-install-banner__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--prg-muted);
    padding: 4px;
    line-height: 1;
}

/* ================================================================
   PUSH PROMPT
   ================================================================ */
.prg-push-prompt {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9991;
    width: min(90vw, 460px);
    animation: prg-slide-down .35s var(--prg-transition) both;
}
.prg-push-prompt__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--prg-bg);
    border: 1px solid var(--prg-border);
    border-radius: var(--prg-radius);
    padding: 14px 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.prg-push-prompt__icon { font-size: 22px; }
.prg-push-prompt span { flex: 1; font-size: 14px; font-weight: 500; }

/* ================================================================
   BUTTONS
   ================================================================ */
.prg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    font-family: inherit;
}
.prg-btn--primary { background: var(--prg-primary); color: #fff; }
.prg-btn--primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.prg-btn--ghost { background: transparent; color: var(--prg-muted); border: 1px solid var(--prg-border); }
.prg-btn--ghost:hover { background: var(--prg-surface); }

/* ================================================================
   NAVIGATION TAB BAR
   ================================================================ */
.prg-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--prg-tabbar-h);
    background: var(--prg-bg);
    border-top: 1px solid var(--prg-border);
    display: flex;
    align-items: stretch;
    z-index: 9980;
    box-shadow: 0 -4px 24px rgba(0,0,0,.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
@media (min-width: 769px) { .prg-tabbar { display: none !important; } }

.prg-tabbar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--prg-muted);
    font-size: 10px;
    font-weight: 500;
    transition: color var(--prg-transition);
    position: relative;
}
.prg-tabbar__item::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px; height: 3px;
    background: var(--prg-primary);
    border-radius: 0 0 4px 4px;
    transition: transform var(--prg-transition);
}
.prg-tabbar__item.is-active { color: var(--prg-primary); }
.prg-tabbar__item.is-active::before { transform: translateX(-50%) scaleX(1); }
.prg-tabbar__icon { font-size: 22px !important; }

/* Offset page content on mobile when tabbar is present */
body.prg-has-tabbar { padding-bottom: var(--prg-tabbar-h) !important; }

/* ================================================================
   PULL-DOWN INDICATOR
   ================================================================ */
.prg-pull-indicator {
    position: fixed;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--prg-bg);
    border: 1px solid var(--prg-border);
    border-radius: 40px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    transition: top .3s var(--prg-transition);
    z-index: 9999;
    pointer-events: none;
}
.prg-pull-indicator.is-visible { top: 12px; }
.prg-pull-indicator__arrow { font-size: 18px; transition: transform .3s; }
.prg-pull-indicator.is-ready .prg-pull-indicator__arrow { transform: rotate(180deg); }
.prg-pull-indicator.is-ready .prg-pull-indicator__text::after { content: ' to refresh'; }

/* ================================================================
   DARK MODE TOGGLE
   ================================================================ */
.prg-dark-toggle {
    position: fixed;
    bottom: calc(var(--prg-tabbar-h) + 16px);
    right: 16px;
    width: 44px; height: 44px;
    background: var(--prg-bg);
    border: 1px solid var(--prg-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    transition: all .2s;
    z-index: 9970;
    font-size: 18px;
    padding: 0;
}
.prg-dark-toggle:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.prg-dark-toggle__icon { line-height: 1; }
body:not(.progressify-dark) .prg-dark-toggle__icon--dark,
.progressify-dark .prg-dark-toggle__icon--light { display: none; }

/* ================================================================
   TOAST MESSAGES
   ================================================================ */
.prg-toast-container {
    position: fixed;
    bottom: calc(var(--prg-tabbar-h) + 80px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: min(90vw, 360px);
}
.prg-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
    animation: prg-toast-in .3s var(--prg-transition) both;
    width: 100%;
}
.prg-toast--info    { background: #1e40af; color: #fff; }
.prg-toast--success { background: #065f46; color: #fff; }
.prg-toast--warn    { background: #92400e; color: #fff; }
.prg-toast--error   { background: #7f1d1d; color: #fff; }
.prg-toast.prg-toast--out { animation: prg-toast-out .25s var(--prg-transition) both; }

/* ================================================================
   INACTIVE BLUR
   ================================================================ */
.prg-inactive-blur.prg-is-inactive #page,
.prg-inactive-blur.prg-is-inactive main,
.prg-inactive-blur.prg-is-inactive .site-content { filter: blur(8px); transition: filter .4s; }

/* ================================================================
   PAGE TRANSITION OVERLAY
   ================================================================ */
.prg-transition-overlay {
    position: fixed;
    inset: 0;
    background: var(--prg-bg);
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--prg-transition);
}
.prg-transition-overlay.is-entering { opacity: 1; pointer-events: all; }

/* ================================================================
   KEYFRAMES
   ================================================================ */
@keyframes prg-slide-up   { from { transform: translateY(130%) } to { transform: translateY(0) } }
@keyframes prg-slide-down { from { transform: translateX(-50%) translateY(-130%) } to { transform: translateX(-50%) translateY(0) } }
@keyframes prg-toast-in   { from { opacity:0; transform:translateY(10px) scale(.95) } to { opacity:1; transform:translateY(0) scale(1) } }
@keyframes prg-toast-out  { to   { opacity:0; transform:translateY(-8px) scale(.95) } }
