/* Baadbaan Foundation - Custom Styles */

/* Smooth scroll & base */
html { scroll-behavior: smooth; }

/* Native cross-page transitions (Chrome/Edge; no-op elsewhere, purely additive) */
@view-transition {
    navigation: auto;
}

/* Gentle fade-in on first paint so pages don't just "pop" in */
body[data-site="public"] {
    animation: pageArrive 0.35s ease both;
}
@keyframes pageArrive {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Initial page loader (public pages only) */
#pageLoader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0A192F 0%, #0F2C59 100%);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}
#pageLoader.loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-ring {
    width: 116px;
    height: 116px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: #0096C7;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: loader-spin 1s linear infinite;
}
.loader-logo-box {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    animation: loader-pulse 1.8s ease-in-out infinite;
    overflow: hidden;
}
.loader-logo-box img {
    max-width: 58%;
    max-height: 58%;
    object-fit: contain;
}
.loader-brand-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.3px;
    margin-top: 18px;
    font-family: 'Inter', system-ui, sans-serif;
}
.loader-dots {
    display: flex;
    gap: 6px;
    margin-top: 14px;
}
.loader-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #0096C7;
    animation: loader-dot-bounce 1.2s ease-in-out infinite;
}
.loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.loader-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes loader-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
@keyframes loader-dot-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-6px); opacity: 1; }
}

/* Slim top loading bar shown briefly while navigating to a new page */
#pageLoadBar {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #0077B6, #0096C7);
    z-index: 9999;
    opacity: 0;
    transition: width 0.4s ease, opacity 0.2s ease;
    pointer-events: none;
}
#pageLoadBar.active {
    opacity: 1;
    width: 80%;
}

/* Image fade-in once loaded (skeleton shimmer while waiting) */
img.img-fade {
    opacity: 0;
    transition: opacity 0.4s ease;
    background: linear-gradient(100deg, #f1f5f9 30%, #f8fafc 50%, #f1f5f9 70%);
    background-size: 200% 100%;
    animation: imgShimmer 1.4s ease-in-out infinite;
}
img.img-fade.loaded {
    opacity: 1;
    animation: none;
    background: none;
}
@keyframes imgShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Subtle lift on primary buttons/links (progressive enhancement over existing hover states) */
body[data-site="public"] a.inline-flex, body[data-site="public"] button[type="submit"] {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
body[data-site="public"] a.inline-flex:active, body[data-site="public"] button[type="submit"]:active {
    transform: scale(0.98);
}

/* Inline button spinner used while a public form is submitting */
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -3px;
    margin-right: 8px;
}

/* Accessibility: respect users who've asked for reduced motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    @view-transition { navigation: none; }
}

/* Navbar scroll shadow */
.nav-scrolled { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* Hero gradient overlay */
.hero-overlay {
    background: linear-gradient(135deg, rgba(10,25,47,0.85) 0%, rgba(15,44,89,0.7) 100%);
}

/* Animated counter */
.counter-value {
    transition: all 0.3s ease;
}

/* Progress bar animation */
.progress-fill {
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card hover effects */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

/* Copy button feedback */
.copy-feedback {
    animation: fadeInOut 2s ease forwards;
}
@keyframes fadeInOut {
    0%   { opacity: 0; transform: translateY(4px); }
    20%  { opacity: 1; transform: translateY(0); }
    80%  { opacity: 1; }
    100% { opacity: 0; }
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.lightbox-overlay img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
}

/* Team member profile modal */
.team-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(10, 25, 47, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.team-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.team-modal-panel {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 64px rgba(0,0,0,0.35);
    transform: translateY(18px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.team-modal-overlay.active .team-modal-panel {
    transform: translateY(0) scale(1);
}
.team-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    z-index: 2;
    backdrop-filter: blur(4px);
    transition: background 0.15s ease, transform 0.15s ease;
}
.team-modal-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.08);
}
.team-modal-photo-wrap {
    height: 280px;
    background: linear-gradient(135deg, #0A192F, #0077B6);
    position: relative;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
}
.team-modal-photo-wrap img {
    width: 100%;
    height: 100%;
    /* contain, not cover: this modal exists to show the whole photo (unlike
       the compact card thumbnail), so nothing gets cropped regardless of
       the photo's aspect ratio — the gradient behind it fills any letterboxing. */
    object-fit: contain;
    object-position: center;
}

/* Badge pulse */
.badge-pulse {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,119,182,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(0,119,182,0); }
}

/* Fade-in on scroll */
.fade-in-up {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Zakat calculator styling */
.zakat-input:focus {
    border-color: #0077B6;
    box-shadow: 0 0 0 3px rgba(0,119,182,0.1);
}

/* Tab active state */
.tab-active {
    color: #0077B6;
    border-bottom-color: #0077B6;
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top-color: #0077B6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive table wrapper */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Admin sidebar */
.admin-sidebar {
    transition: transform 0.3s ease;
}
@media (max-width: 1023px) {
    .admin-sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 40;
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
}

/* Form focus states */
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #0077B6;
    box-shadow: 0 0 0 3px rgba(0,119,182,0.1);
}

/* Toggle switch visual */
.toggle-switch {
    cursor: pointer;
}

/* Print styles */
@media print {
    nav, footer, .no-print, .news-ticker-bar, #pageLoadBar, #pageLoader { display: none !important; }
    body { background: white !important; animation: none !important; }
}
