/**
 * PWA Enhancements — All styles for Splash Screen, Offline Toast, Push Button
 * Areej App — Production PWA CSS
 */

/* ═══════════════════════════════════════════
   SPLASH SCREEN
   Only shows in standalone PWA mode
═══════════════════════════════════════════ */
#pwa-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow: hidden;
}

#pwa-splash.splash-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Subtle background gradient */
#pwa-splash::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(245, 124, 0, 0.06) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(123, 31, 162, 0.05) 0%, transparent 50%);
}

.splash-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* Logo container with floating animation */
.splash-logo-wrap {
    width: 120px;
    height: 120px;
    border-radius: 28px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.04),
        0 20px 60px rgba(245, 124, 0, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.08);
    animation: splash-float 3s ease-in-out infinite;
    margin-bottom: 2rem;
}

.splash-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

/* Floating animation */
@keyframes splash-float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-12px); }
}

/* Arabic App Name */
.splash-app-name {
    font-family: 'Cairo', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: #1a1a2e;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
    animation: splash-fade-up 0.6s ease 0.3s both;
}

/* Arabic tagline */
.splash-tagline {
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 3rem;
    animation: splash-fade-up 0.6s ease 0.5s both;
}

/* Progress bar */
.splash-progress-wrap {
    width: 200px;
    height: 3px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 99px;
    overflow: hidden;
    animation: splash-fade-up 0.6s ease 0.7s both;
}

.splash-progress-bar {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #F57C00, #D32F2F, #7B1FA2);
    background-size: 200% 100%;
    animation: splash-progress 1.8s ease forwards, splash-shimmer 1.5s linear infinite;
    width: 0%;
}

@keyframes splash-progress {
    0%   { width: 0%; }
    60%  { width: 80%; }
    100% { width: 100%; }
}

@keyframes splash-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes splash-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .splash-logo-wrap { animation: none; }
    .splash-progress-bar { animation: none; width: 100%; }
    .splash-app-name,
    .splash-tagline,
    .splash-progress-wrap { animation: none; opacity: 1; transform: none; }
    #pwa-splash { transition: none; }
}


/* ═══════════════════════════════════════════
   OFFLINE / ONLINE TOAST NOTIFICATIONS
═══════════════════════════════════════════ */
#pwa-toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9990;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: calc(100% - 32px);
    max-width: 420px;
    pointer-events: none;
}

.pwa-toast {
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.875rem;
    direction: rtl;
    transform: translateY(80px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    pointer-events: auto;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

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

/* Offline Toast — amber/red */
.pwa-toast-offline {
    border-right: 4px solid #F57C00;
    background: #fffbf5;
}

.pwa-toast-offline .toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(245, 124, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #F57C00;
}

/* Online Toast — green */
.pwa-toast-online {
    border-right: 4px solid #2E7D32;
    background: #f9fdf9;
}

.pwa-toast-online .toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(46, 125, 50, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #2E7D32;
}

.toast-text {
    flex: 1;
    color: #1f2937;
}

.toast-title {
    font-weight: 900;
    color: #111827;
    margin-bottom: 1px;
}

.toast-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 700;
}

/* Cache badge shown on dashboard when viewing offline content */
.offline-cache-badge {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(245, 124, 0, 0.08);
    border: 1px solid rgba(245, 124, 0, 0.2);
    border-radius: 10px;
    padding: 8px 14px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: #92400e;
    direction: rtl;
    margin-bottom: 16px;
}

.offline-cache-badge.visible {
    display: flex;
}


/* ═══════════════════════════════════════════
   PUSH NOTIFICATION BUTTON
═══════════════════════════════════════════ */
.push-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: none;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.push-subscribe-btn.btn-subscribe {
    background: linear-gradient(135deg, #F57C00, #D32F2F);
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 124, 0, 0.25);
}

.push-subscribe-btn.btn-subscribe:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(245, 124, 0, 0.35);
}

.push-subscribe-btn.btn-unsubscribe {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.push-subscribe-btn.btn-unsubscribe:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Permission denied state */
.push-denied-msg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    font-family: 'Cairo', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: #dc2626;
    direction: rtl;
}

/* Admin send notification section */
.push-admin-panel {
    background: rgba(245, 124, 0, 0.04);
    border: 1px dashed rgba(245, 124, 0, 0.25);
    border-radius: 16px;
    padding: 20px;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
}

.push-admin-panel h4 {
    font-weight: 900;
    color: #1f2937;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.push-send-btn {
    background: linear-gradient(135deg, #F57C00, #D32F2F);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-weight: 900;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.push-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(245, 124, 0, 0.3);
}

.push-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
