/**
 * ParthaOS — motion polish layer (micro-interactions, chat fill, notifications).
 * @package ParthaOS_Portal
 */

/* ─── Page warmth & depth ─── */
.pr-portal-root:not(.is-login) {
    background: linear-gradient(165deg, #f8fafc 0%, #fff7ed 42%, #f8fafc 100%);
}
.pr-portal-root .pr-card,
.pr-portal-root .pr-wallet-card,
.pr-portal-root .pr-overview-kpi {
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.07), 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}
.pr-portal-root .pr-section-title::after {
    content: '';
    display: block;
    width: 2.5rem;
    height: 3px;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #fc8019, #e23744);
}
.pr-portal-root .pr-input:focus,
.pr-portal-root .pr-vault-input-pill:focus,
.pr-portal-root textarea.pr-input:focus {
    outline: none;
    border-color: rgba(252, 128, 25, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(252, 128, 25, 0.16);
}

/* ─── Button press & primary glow ─── */
.pr-btn-press {
    transition: transform 0.14s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background 0.2s ease;
}
.pr-btn-press:active:not(:disabled) {
    transform: scale(0.97);
}
.pr-btn-primary.pr-btn-press:not(:disabled) {
    box-shadow: 0 4px 14px rgba(252, 128, 25, 0.28);
}
.pr-btn-primary.pr-btn-press:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(252, 128, 25, 0.34);
}

/* ─── Tab transitions ─── */
.pr-app-tab-enter-active,
.pr-app-tab-leave-active {
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.pr-app-tab-enter-from {
    opacity: 0;
    transform: translateY(12px);
}
.pr-app-tab-leave-to {
    opacity: 0;
    transform: translateY(-8px);
}

/* ─── Card stagger entrance ─── */
@keyframes pr-card-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.pr-notification-list .pr-notification-item,
.pr-hub-grid .pr-card,
.pr-overview-kpi {
    animation: pr-card-rise 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.pr-notification-list .pr-notification-item:nth-child(2) { animation-delay: 0.04s; }
.pr-notification-list .pr-notification-item:nth-child(3) { animation-delay: 0.08s; }
.pr-notification-list .pr-notification-item:nth-child(4) { animation-delay: 0.12s; }

/* ─── Notifications ─── */
.pr-notification-item {
    position: relative;
    overflow: hidden;
    transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.34s ease, max-height 0.34s ease, margin 0.34s ease, padding 0.34s ease;
}
.pr-notification-item.is-removing {
    transform: translateX(28px);
    opacity: 0;
    max-height: 0;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0;
}
.pr-notification-item.is-processing {
    border-color: rgba(252, 128, 25, 0.35);
    box-shadow: 0 0 0 2px rgba(252, 128, 25, 0.12);
}
.pr-notification-processing {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
}
.pr-inline-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(252, 128, 25, 0.25);
    border-top-color: #fc8019;
    border-radius: 50%;
    animation: pr-spin 0.7s linear infinite;
}
@keyframes pr-spin {
    to { transform: rotate(360deg); }
}

/* ─── Toasts with progress ─── */
.pr-toast {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.55rem;
}
.pr-toast-body {
    line-height: 1.35;
}
.pr-toast-icon::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 800;
    background: rgba(13, 122, 92, 0.12);
    color: #0d7a5c;
}
.pr-toast-error .pr-toast-icon::before { content: '!'; background: rgba(196, 30, 74, 0.12); color: #c41e4a; }
.pr-toast-warn .pr-toast-icon::before { content: '!'; background: rgba(249, 115, 22, 0.15); color: #c2410c; }
.pr-toast-info .pr-toast-icon::before { content: 'i'; background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.pr-toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, #fc8019, #e23744);
    transition: width 0.12s linear;
    border-radius: 0 2px 2px 0;
}

/* ─── Live badge pulse ─── */
.pr-trust-live-pulse {
    animation: pr-live-pulse 2s ease-in-out infinite;
}
@keyframes pr-live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* ─── Rail / tab bar micro-motion ─── */
.pr-app-rail-btn.is-active .pr-app-rail-icon,
.pr-app-tabbar-btn.is-active .pr-app-tabbar-icon {
    transform: scale(1.08);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.pr-app-rail-btn .pr-app-rail-icon,
.pr-app-tabbar-btn .pr-app-tabbar-icon {
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Modal entrance ─── */
.pr-modal-backdrop {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.pr-modal {
    animation: pr-modal-pop 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes pr-modal-pop {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── Chat fill layout (client) ─── */
.pr-portal-root .pr-app-stage-scroll:has(.pr-chat-panel--fill) {
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    padding-bottom: 0.5rem;
}
.pr-chat-panel--fill {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    height: 100%;
    max-height: none;
}
.pr-chat-header-compact {
    flex-shrink: 0;
    padding: 0.15rem 0.25rem 0.55rem;
}
.pr-chat-title-compact {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}
.pr-chat-sub-compact {
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    color: #64748b;
}
.pr-chat-panel--fill .pr-chat-thread {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    margin: 0;
}
.pr-chat-panel--fill .pr-chat-compose {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    margin-top: 0.5rem;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.35rem);
    background: linear-gradient(180deg, transparent, #f0f2f5 28%);
}
.pr-chat-wa .pr-chat-bubble {
    animation: pr-chat-bounce-in 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes pr-chat-bounce-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 767px) {
    .pr-portal-root:not(.is-login) .pr-app-stage-scroll:has(.pr-chat-panel--fill) {
        padding-bottom: calc(var(--pr-app-tabbar-height, 64px) + var(--pr-safe-bottom, 0px) + 0.25rem);
    }
    .pr-chat-panel--fill .pr-chat-compose {
        padding-bottom: calc(var(--pr-safe-bottom, 0px) + 0.5rem);
    }
}

/* ─── Empty states ─── */
.pr-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 8rem;
    text-align: center;
}
.pr-chat-empty::before {
    content: '💬';
    font-size: 1.5rem;
    opacity: 0.65;
}

@media (prefers-reduced-motion: reduce) {
    .pr-app-tab-enter-active,
    .pr-app-tab-leave-active,
    .pr-notification-item,
    .pr-chat-wa .pr-chat-bubble,
    .pr-modal,
    .pr-notification-list .pr-notification-item,
    .pr-trust-live-pulse {
        animation: none !important;
        transition: none !important;
    }
    .pr-btn-press:active:not(:disabled) {
        transform: none;
    }
}
