﻿/* ============================================================
   PUBLIC PORTAL — ANIMATIONS & UI ENHANCEMENTS v2
   File: wwwroot/css/public-animations.css
   REPLACES the existing file entirely.
   ============================================================ */

/* ── 1. PAGE LOAD FADE-IN ──────────────────────────────────── */
@keyframes pageEnter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

body {
    animation: pageEnter 0.3s ease both;
}

@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
    }
}

/* ── 2. SCROLL-REVEAL ───────────────────────────────────────── */

.sr-fade-up {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.6s cubic-bezier(.22,.61,.36,1), transform 0.6s cubic-bezier(.22,.61,.36,1);
    will-change: opacity, transform;
}

.sr-fade-in {
    opacity: 0;
    transition: opacity 0.55s ease;
    will-change: opacity;
}

.sr-slide-left {
    opacity: 0;
    transform: translateX(-28px);
    transition: opacity 0.55s ease, transform 0.55s ease;
    will-change: opacity, transform;
}

.sr-slide-right {
    opacity: 0;
    transform: translateX(28px);
    transition: opacity 0.55s ease, transform 0.55s ease;
    will-change: opacity, transform;
}

.sr-scale-in {
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(.34,1.56,.64,1);
    will-change: opacity, transform;
}

    .sr-fade-up.sr-visible,
    .sr-fade-in.sr-visible,
    .sr-slide-left.sr-visible,
    .sr-slide-right.sr-visible,
    .sr-scale-in.sr-visible {
        opacity: 1;
        transform: none;
    }

[style*="--sr-delay"] {
    transition-delay: var(--sr-delay, 0ms) !important;
}

@media (prefers-reduced-motion: reduce) {
    .sr-fade-up, .sr-fade-in, .sr-slide-left, .sr-slide-right, .sr-scale-in {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* ── 3. NAVBAR SCROLL-SHRINK ────────────────────────────────── */

.navbar {
    transition: padding-top 0.28s ease, padding-bottom 0.28s ease, box-shadow 0.28s ease, background-color 0.28s ease;
}

.navbar-scrolled.navbar.bg-primary {
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.28) !important;
}

/* ── 4. CARD INTERACTIONS ───────────────────────────────────── */

/* Public Bootstrap cards */
.public-card,
.card.shadow-sm {
    transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
}

    .public-card:hover,
    .card.shadow-sm:hover:not(.no-hover) {
        box-shadow: 0 10px 32px rgba(var(--bs-primary-rgb, 13,110,253), 0.14) !important;
        transform: translateY(-3px);
    }

/* Content cards — editorial system (border darkens, no lift) */
.public-portal a.content-card,
.public-portal a.pinned-card,
.public-portal .pe-card {
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

/* Service tile interactive cards */
.pe-card.pe-card--interactive {
    transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), box-shadow 0.22s ease, border-color 0.22s ease !important;
}

    .pe-card.pe-card--interactive:hover {
        transform: translateY(-5px) scale(1.015) !important;
        box-shadow: 0 12px 36px rgba(var(--bs-primary-rgb, 13,110,253), 0.16) !important;
    }

/* ── 5. DASHBOARD STAT CARDS ───────────────────────────────── */

.dashboard-stat-card {
    transition: box-shadow 0.22s ease, transform 0.22s ease;
}

    .dashboard-stat-card:hover {
        box-shadow: 0 8px 28px rgba(var(--bs-primary-rgb, 13,110,253), 0.18) !important;
        transform: translateY(-4px);
    }

/* ── 6. BUTTON RIPPLE ───────────────────────────────────────── */

.btn {
    position: relative;
    overflow: hidden;
}

.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255, 0.32);
    transform: scale(0);
    animation: rippleOut 0.6s linear;
    pointer-events: none;
}

@keyframes rippleOut {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ── 7. FORM ENHANCEMENTS ───────────────────────────────────── */

.form-control,
.form-select {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

    .form-control:focus,
    .form-select:focus {
        box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb, 13,110,253), 0.18) !important;
        border-color: var(--bs-primary) !important;
    }

@keyframes formShake {
    0%,100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

.form-shake {
    animation: formShake 0.42s ease;
}

.input-group:focus-within .input-group-text {
    border-color: var(--bs-primary);
    transition: border-color 0.15s ease;
}

/* ── 8. AUTH PAGES ──────────────────────────────────────────── */

@keyframes authIconFloat {
    0%,100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-7px) scale(1.05);
    }
}

.auth-icon-float {
    animation: authIconFloat 3.2s ease-in-out infinite;
    display: inline-block;
}

@keyframes authCardIn {
    from {
        opacity: 0;
        transform: translateY(22px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card-enter {
    animation: authCardIn 0.42s cubic-bezier(.22,.61,.36,1) both;
}

.card.shadow-sm.border-primary-2:hover,
.card.shadow-sm.h-100:hover {
    border-color: var(--bs-primary-border-subtle) !important;
}

/* ── 9. ERROR PAGES ─────────────────────────────────────────── */

@keyframes errorBounce {
    0%,100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-14px);
    }

    50% {
        transform: translateY(-7px);
    }

    70% {
        transform: translateY(-11px);
    }
}

.error-icon-animate {
    animation: errorBounce 2.6s ease-in-out infinite;
    display: inline-block;
}

.error-page-bg {
    background-image: radial-gradient(circle, var(--bs-border-color) 1px, transparent 1px);
    background-size: 24px 24px;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── 10. FOI PROGRESS BAR ───────────────────────────────────── */

.progress-bar {
    transition: width 1.3s cubic-bezier(.22,.61,.36,1);
}

/* ── 11. MEETING CALENDAR ───────────────────────────────────── */

@keyframes todayPulse {
    0%,100% {
        box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb,13,110,253), 0.38);
    }

    50% {
        box-shadow: 0 0 0 7px rgba(var(--bs-primary-rgb,13,110,253), 0);
    }
}

td .badge.bg-primary {
    animation: todayPulse 2.6s ease-in-out infinite;
}

.calendar-table tbody tr {
    transition: background-color 0.14s ease;
}

    .calendar-table tbody tr:hover {
        background-color: var(--bs-primary-bg-subtle);
    }

.calendar-table .bg-primary.bg-opacity-10 {
    transition: background-color 0.15s ease, transform 0.15s ease;
}

    .calendar-table .bg-primary.bg-opacity-10:hover {
        background-color: rgba(var(--bs-primary-rgb,13,110,253), 0.2) !important;
        transform: scale(1.03);
    }

/* ── 12. LEGISLATION DETAIL ─────────────────────────────────── */

.ordinance-content,
.resolution-content {
    transition: box-shadow 0.22s ease;
}

    .ordinance-content:hover,
    .resolution-content:hover {
        box-shadow: 0 3px 14px rgba(var(--bs-primary-rgb,13,110,253), 0.09);
    }

/* ── 13. VOTE BUTTONS ───────────────────────────────────────── */

#btn-upvote,
#btn-downvote {
    transition: background-color 0.18s ease, transform 0.18s cubic-bezier(.34,1.56,.64,1), border-color 0.18s ease;
}

    #btn-upvote:hover {
        background-color: #dcfce7 !important;
        transform: scale(1.06);
    }

    #btn-downvote:hover {
        background-color: #fee2e2 !important;
        transform: scale(1.06);
    }

[data-bs-theme="dark"] #btn-upvote:hover {
    background-color: rgba(34,197,94,.16) !important;
}

[data-bs-theme="dark"] #btn-downvote:hover {
    background-color: rgba(239,68,68,.16) !important;
}

#btn-upvote.voted-active {
    background-color: #16a34a !important;
    color: #fff !important;
    border-color: #16a34a !important;
    transform: scale(1.04);
}

#btn-downvote.voted-active {
    background-color: #dc2626 !important;
    color: #fff !important;
    border-color: #dc2626 !important;
    transform: scale(1.04);
}

/* ── 14. OFFICER CARDS ──────────────────────────────────────── */

.officer-card {
    transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease !important;
}

/* ── 15. FOI STATUS TIMELINE ────────────────────────────────── */

.timeline > .d-flex {
    position: relative;
}

    .timeline > .d-flex:not(:last-child)::after {
        content: '';
        position: absolute;
        left: 15px;
        top: 32px;
        bottom: -12px;
        width: 2px;
        background: var(--bs-border-color);
    }

@keyframes timelineIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.timeline > .d-flex > .me-3 > div {
    animation: timelineIn 0.42s cubic-bezier(.34,1.56,.64,1) both;
}

.timeline > .d-flex:nth-child(2) > .me-3 > div {
    animation-delay: 0.14s;
}

.timeline > .d-flex:nth-child(3) > .me-3 > div {
    animation-delay: 0.28s;
}

.timeline > .d-flex:nth-child(4) > .me-3 > div {
    animation-delay: 0.42s;
}

/* ── 16. SEARCH PAGE ────────────────────────────────────────── */

.search-bar-wrapper {
    position: relative;
}

    .search-bar-wrapper input {
        transition: box-shadow 0.2s ease, border-color 0.2s ease;
    }

        .search-bar-wrapper input:focus {
            box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb,13,110,253), 0.15) !important;
        }

.result-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-left-color 0.2s ease;
}

    .result-card:hover {
        transform: translateX(4px);
        box-shadow: 0 5px 18px rgba(var(--bs-primary-rgb,13,110,253), 0.13) !important;
        border-left-color: var(--bs-primary) !important;
    }

/* ── 17. HERO SEAL FLOAT ────────────────────────────────────── */

@keyframes sealFloat {
    0%,100% {
        transform: translateY(0);
        filter: drop-shadow(0 8px 18px rgba(0,0,0,.10));
    }

    50% {
        transform: translateY(-10px);
        filter: drop-shadow(0 18px 28px rgba(0,0,0,.16));
    }
}

.pe-stage img {
    animation: sealFloat 5.5s ease-in-out infinite;
}

.pe-stat .pe-stat__value {
    transition: color 0.3s ease;
}

/* ── 18. FOOTER SOCIAL ICONS ────────────────────────────────── */

.footer-social-icon {
    transition: transform 0.26s cubic-bezier(.34,1.56,.64,1), background-color 0.2s ease, color 0.2s ease !important;
}

    .footer-social-icon:hover {
        transform: translateY(-4px) rotate(10deg) !important;
    }

/* ── 19. BACK-TO-TOP ────────────────────────────────────────── */

#backToTop {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(var(--bs-primary-rgb,13,110,253), 0.38);
    z-index: 1038;
    opacity: 0;
    transform: translateY(14px) scale(0.82);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(.34,1.56,.64,1);
    cursor: pointer;
    font-size: 0.85rem;
}

    #backToTop.visible {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    #backToTop:hover {
        transform: translateY(-3px) scale(1.1);
        box-shadow: 0 7px 22px rgba(var(--bs-primary-rgb,13,110,253), 0.48);
    }

@media (max-width: 575.98px) {
    #backToTop {
        bottom: 70px;
        right: 16px;
    }
}

/* ── 20. NAV LINK UNDERLINE SLIDE ───────────────────────────── */

.public-portal .navbar .nav-link {
    position: relative;
}

/* ── 21. DROPDOWN MENU ──────────────────────────────────────── */

.dropdown-menu {
    animation: dropdownIn 0.2s cubic-bezier(.22,.61,.36,1) both;
    transform-origin: top center;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: scaleY(0.92) translateY(-6px);
    }

    to {
        opacity: 1;
        transform: scaleY(1) translateY(0);
    }
}

.dropdown-item {
    transition: background-color 0.12s ease, padding-left 0.15s ease, color 0.12s ease;
}

    .dropdown-item:hover {
        padding-left: 1.25rem;
    }

/* ── 22. BREADCRUMB ITEMS ───────────────────────────────────── */

.breadcrumb-item + .breadcrumb-item::before {
    transition: color 0.15s ease;
}

.breadcrumb-item a {
    transition: color 0.15s ease;
}

/* ── 23. BADGE POP ──────────────────────────────────────────── */

@keyframes badgePop {
    0% {
        transform: scale(0.6);
        opacity: 0;
    }

    70% {
        transform: scale(1.12);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.badge {
    animation: badgePop 0.3s cubic-bezier(.34,1.56,.64,1) both;
}

/* ── 24. SKELETON LOADER ────────────────────────────────────── */

@keyframes skeletonShimmer {
    0% {
        background-position: -500px 0;
    }

    100% {
        background-position: 500px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--bs-tertiary-bg) 25%, var(--bs-secondary-bg) 50%, var(--bs-tertiary-bg) 75%);
    background-size: 1000px 100%;
    animation: skeletonShimmer 1.6s infinite linear;
    border-radius: var(--bs-border-radius);
}

/* ── 25. NOTIFICATION DOT ───────────────────────────────────── */

@keyframes notifPop {
    0% {
        transform: scale(0.4);
    }

    70% {
        transform: scale(1.25);
    }

    100% {
        transform: scale(1);
    }
}

.notif-dot {
    animation: notifPop 0.42s cubic-bezier(.34,1.56,.64,1) both;
}

/* ── 26. TABLE ROW HOVER ────────────────────────────────────── */

.table-hover > tbody > tr {
    transition: background-color 0.13s ease;
}

/* ── 27. ALERTS SLIDE IN ────────────────────────────────────── */

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert {
    animation: alertSlideIn 0.32s cubic-bezier(.22,.61,.36,1) both;
}

/* ── 28. AVATAR SIZES ───────────────────────────────────────── */

.avatar-xs {
    width: 32px;
    height: 32px;
}

.avatar-sm {
    width: 40px;
    height: 40px;
}

.avatar-md {
    width: 56px;
    height: 56px;
}

.avatar-lg {
    width: 80px;
    height: 80px;
}

.avatar-xl {
    width: 110px;
    height: 110px;
}

/* ── 29. PAGINATION ─────────────────────────────────────────── */

.page-link {
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.page-item:not(.disabled) .page-link:hover {
    transform: translateY(-1px);
}

/* ── 30. FILTER TAB ACTIVE INDICATOR ───────────────────────── */

.public-portal .filter-tab {
    position: relative;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

/* ── 31. HERO DETAIL GRID IMAGE — subtle pan on load ─────────── */

@keyframes imagePanIn {
    from {
        transform: scale(1.04);
    }

    to {
        transform: scale(1);
    }
}

.public-portal .post-detail-hero-image img {
    animation: imagePanIn 0.9s cubic-bezier(.22,.61,.36,1) both;
}

/* ── 32. CONTENT CARD IMAGE ZOOM ON HOVER ───────────────────── */

.public-portal .content-card-img img,
.public-portal .pinned-card-img img {
    transition: transform 0.4s cubic-bezier(.22,.61,.36,1);
}

.public-portal a.content-card:hover .content-card-img img,
.public-portal a.pinned-card:hover .pinned-card-img img {
    transform: scale(1.04);
}

/* ── 33. INFO PANEL ROW HOVER ───────────────────────────────── */

.public-portal .info-panel-row {
    transition: background-color 0.13s ease;
}

    .public-portal .info-panel-row:hover {
        background-color: var(--pe-cloud, #f5f5f5);
    }

/* ── 34. SHARE BUTTONS ──────────────────────────────────────── */

.share-btn,
[class*="share-"] {
    transition: transform 0.2s cubic-bezier(.34,1.56,.64,1), opacity 0.2s ease;
}

    .share-btn:hover,
    [class*="share-"]:hover {
        transform: translateY(-3px) scale(1.08);
    }

/* ── 35. ACCORDION SMOOTH OPEN ──────────────────────────────── */

.accordion-button {
    transition: background-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

/* ── 36. IMAGE GALLERY ITEM ─────────────────────────────────── */

.public-portal .gallery-item {
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

    .public-portal .gallery-item:hover {
        transform: scale(1.02);
        box-shadow: 0 8px 24px rgba(0,0,0,.22);
        z-index: 1;
        position: relative;
    }

/* ── 37. MODAL ENTRANCE ─────────────────────────────────────── */

.modal.fade .modal-dialog {
    transition: transform 0.3s cubic-bezier(.22,.61,.36,1), opacity 0.3s ease;
    transform: translateY(-16px) scale(0.97);
}

.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

/* ── 38. TOAST / ALERT AUTO-DISMISS ────────────────────────── */

@keyframes toastSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast {
    animation: toastSlideUp 0.3s cubic-bezier(.22,.61,.36,1) both;
}

/* ── 39. LINK HOVER UNDERLINE GROW ─────────────────────────── */

.public-portal .pe-link,
.public-portal .footer-links a {
    transition: color 0.15s ease, text-underline-offset 0.15s ease;
}

    .public-portal .pe-link:hover,
    .public-portal .footer-links a:hover {
        text-underline-offset: 5px;
    }

/* ── 40. REDUCED MOTION — global kill-switch ────────────────── */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .pe-stage img,
    #backToTop,
    .footer-social-icon,
    td .badge.bg-primary,
    .badge,
    .dropdown-menu,
    .public-portal .post-detail-hero-image img,
    .public-portal .content-card-img img,
    .public-portal .pinned-card-img img {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}
