/* Taiyaari 360 — PWA UI Styles */

.u-sr-only, .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Safe area & standalone */
.pwa-enabled {
    --pwa-safe-top: env(safe-area-inset-top, 0px);
    --pwa-safe-bottom: env(safe-area-inset-bottom, 0px);
}

.pwa-standalone .site-header,
.pwa-standalone .admin-topbar {
    padding-top: var(--pwa-safe-top);
}

.pwa-standalone body {
    padding-bottom: calc(60px + var(--pwa-safe-bottom));
}

/* Launch animation */
@keyframes pwaLaunch {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}
.pwa-launch { animation: pwaLaunch 0.5s ease-out; }

/* Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    width: min(420px, calc(100vw - 2rem));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    padding: 1.5rem;
    transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(37, 99, 235, 0.15);
}
.pwa-install-banner.show { bottom: calc(1.5rem + var(--pwa-safe-bottom, 0px)); }
.pwa-install-banner__header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1rem;
}
.pwa-install-banner__logo {
    display: block;
    width: 100%;
    max-height: 72px;
    height: auto;
    object-fit: contain;
    object-position: left center;
}
.pwa-install-banner__copy { min-width: 0; }
.pwa-install-banner__title { font-size: 1.125rem; font-weight: 700; color: #0f172a; margin: 0; }
.pwa-install-banner__subtitle { font-size: 0.875rem; color: #64748b; margin: 0.25rem 0 0; line-height: 1.5; }
.pwa-install-steps { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.pwa-install-steps li { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.5rem 0; font-size: 0.875rem; color: #334155; }
.pwa-install-steps .step-num {
    flex-shrink: 0; width: 24px; height: 24px; background: #eff6ff; color: #2563eb;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
}
.pwa-install-banner__actions { display: flex; gap: 0.75rem; }
.pwa-install-banner__actions .btn { flex: 1; justify-content: center; }

/* Update Banner */
.pwa-update-banner {
    position: fixed; top: -60px; left: 0; right: 0; z-index: 10001;
    background: #2563eb; color: #fff; padding: 0.75rem 1rem;
    display: flex; align-items: center; justify-content: center; gap: 1rem;
    font-size: 0.875rem; font-weight: 500;
    transition: top 0.3s ease;
    padding-top: calc(0.75rem + var(--pwa-safe-top, 0px));
}
.pwa-update-banner.show { top: 0; }
.pwa-update-banner button {
    background: #fff; color: #2563eb; border: none; padding: 0.375rem 1rem;
    border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.8125rem;
}

/* Pre-permission dialog */
.pwa-notif-dialog {
    position: fixed; inset: 0; z-index: 10003;
    background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all 0.3s;
    padding: 1rem;
}
.pwa-notif-dialog.show { opacity: 1; visibility: visible; }
.pwa-notif-dialog__card {
    background: #fff; border-radius: 16px; padding: 2rem; max-width: 400px; width: 100%;
    text-align: center; box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}
.pwa-notif-dialog__icon { font-size: 3rem; margin-bottom: 1rem; }
.pwa-notif-dialog h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.pwa-notif-dialog p { color: #64748b; margin-bottom: 1.5rem; line-height: 1.6; }
.pwa-notif-dialog__actions { display: flex; gap: 0.75rem; }
.pwa-notif-dialog__actions button { flex: 1; padding: 0.75rem; border-radius: 10px; font-weight: 600; cursor: pointer; border: none; }
.pwa-notif-dialog__actions .btn-primary { background: #2563eb; color: #fff; }
.pwa-notif-dialog__actions .btn-ghost { background: #f1f5f9; color: #64748b; }

.pwa-install-cta--header {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}
.pwa-install-cta--header .pwa-install-label { display: none; }
@media (min-width: 768px) {
    .pwa-install-cta--header .pwa-install-label { display: inline; }
}

/* Install CTA buttons */
.pwa-install-cta {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.875rem; background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff; border: none; border-radius: 8px; font-size: 0.8125rem;
    font-weight: 600; cursor: pointer; text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.pwa-install-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); color: #fff; }
.pwa-install-cta--sidebar {
    width: calc(100% - 1.5rem); margin: 0.75rem; justify-content: center;
    background: rgba(37, 99, 235, 0.15); color: #93c5fd; border: 1px dashed rgba(147, 197, 253, 0.4);
}
.pwa-install-cta--sidebar:hover { background: rgba(37, 99, 235, 0.25); color: #fff; }

/* Mobile bottom navigation */
.pwa-bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 999;
    background: #fff; border-top: 1px solid #e2e8f0;
    padding-bottom: var(--pwa-safe-bottom, 0px);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.pwa-standalone .pwa-bottom-nav { display: flex; }
.pwa-bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 0.5rem 0.25rem; text-decoration: none; color: #64748b;
    font-size: 0.625rem; font-weight: 500; gap: 0.25rem;
}
.pwa-bottom-nav a.active, .pwa-bottom-nav a:hover { color: #2563eb; }
.pwa-bottom-nav svg, .pwa-bottom-nav i { font-size: 1.25rem; }

/* Pull to refresh */
.pwa-ptr {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%) translateY(-100%);
    z-index: 9998; padding: 0.5rem 1rem; background: #2563eb; color: #fff;
    border-radius: 0 0 12px 12px; font-size: 0.75rem; font-weight: 600;
    transition: transform 0.2s;
}
.pwa-ptr.active { transform: translateX(-50%) translateY(0); }

/* PWA Settings Page */
.pwa-settings-grid { display: grid; gap: 1.5rem; }
.pwa-settings-card { background: #f8fafc; border-radius: 12px; padding: 1.25rem; border: 1px solid #e2e8f0; }
.pwa-settings-card h4 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.pwa-settings-stat { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid #e2e8f0; font-size: 0.875rem; }
.pwa-settings-stat:last-child { border-bottom: none; }
.pwa-settings-stat span:last-child { font-weight: 600; color: #2563eb; }
.pwa-pref-toggle { display: flex; justify-content: space-between; align-items: center; padding: 0.625rem 0; }
.pwa-storage-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-top: 0.5rem; }
.pwa-storage-bar__fill { height: 100%; background: linear-gradient(90deg, #2563eb, #3b82f6); border-radius: 4px; transition: width 0.3s; }

/* Toast */
.pwa-toast {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #0f172a; color: #fff; padding: 0.75rem 1.25rem; border-radius: 10px;
    font-size: 0.875rem; z-index: 10004; opacity: 0; transition: all 0.3s;
}
.pwa-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.pwa-toast-success { background: #16a34a; }
.pwa-toast-error { background: #dc2626; }

/* Skeleton loading */
.pwa-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: pwaShimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes pwaShimmer { to { background-position: -200% 0; } }

@media (max-width: 768px) {
    .pwa-install-banner { width: calc(100vw - 1rem); }
    
    .pwa-settings-grid .btn {
        width: 100%;
        justify-content: center;
    }
    
    .pwa-settings-grid .d-flex.gap-2 {
        flex-direction: column;
    }
}
