/**
 * NetMkd DeskPortal — Animations CSS
 * Локација: assets/css/animations.css
 *
 * Сите анимации и транзиции за темата —
 * page transitions, hover ефекти, loading states,
 * counter анимации и micro-interactions.
 */

/* ============================================================
   KEYFRAMES — ОСНОВНИ
   ============================================================ */

@keyframes nmdpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes nmdpFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes nmdpSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes nmdpSlideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes nmdpSlideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes nmdpSlideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes nmdpScaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes nmdpBounceIn {
    0%   { opacity: 0; transform: scale(0.7); }
    60%  { opacity: 1; transform: scale(1.06); }
    80%  { transform: scale(0.97); }
    100% { transform: scale(1); }
}

@keyframes nmdpPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(1.08); }
}

@keyframes nmdpSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes nmdpShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

@keyframes nmdpFlash {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

@keyframes nmdpFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

@keyframes nmdpGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(30,58,138,0.3); }
    50%       { box-shadow: 0 0 20px rgba(30,58,138,0.6); }
}

@keyframes nmdpProgressBar {
    from { width: 0%; }
    to   { width: 100%; }
}

@keyframes nmdpCountUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Typing индикатор (три точки) */
@keyframes nmdpTyping {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1.0); opacity: 1; }
}

/* Ripple ефект */
@keyframes nmdpRipple {
    to { transform: scale(4); opacity: 0; }
}

/* ============================================================
   UTILITY КЛАСИ — АНИМАЦИИ
   ============================================================ */

.nmdp-animate-fade-in    { animation: nmdpFadeIn    0.35s ease both; }
.nmdp-animate-slide-up   { animation: nmdpSlideUp   0.4s  ease both; }
.nmdp-animate-slide-down { animation: nmdpSlideDown 0.4s  ease both; }
.nmdp-animate-scale-in   { animation: nmdpScaleIn   0.3s  ease both; }
.nmdp-animate-bounce-in  { animation: nmdpBounceIn  0.5s  ease both; }
.nmdp-animate-shake      { animation: nmdpShake     0.4s  ease; }
.nmdp-animate-float      { animation: nmdpFloat     3s    ease-in-out infinite; }
.nmdp-animate-pulse      { animation: nmdpPulse     2s    ease-in-out infinite; }
.nmdp-animate-spin       { animation: nmdpSpin      1s    linear infinite; }
.nmdp-animate-flash      { animation: nmdpFlash     1.5s  ease-in-out infinite; }
.nmdp-animate-glow       { animation: nmdpGlow      2s    ease-in-out infinite; }

/* Delay класи */
.nmdp-delay-1 { animation-delay: 0.1s; }
.nmdp-delay-2 { animation-delay: 0.2s; }
.nmdp-delay-3 { animation-delay: 0.3s; }
.nmdp-delay-4 { animation-delay: 0.4s; }
.nmdp-delay-5 { animation-delay: 0.5s; }
.nmdp-delay-6 { animation-delay: 0.6s; }

/* ============================================================
   PAGE TRANSITION — ВЧИТУВАЊЕ НА СТРАНИЦА
   ============================================================ */

.nmdp-main-content {
    animation: nmdpFadeIn 0.3s ease;
}

/* Секции на страницата */
.nmdp-page-section {
    animation: nmdpSlideUp 0.4s ease both;
}

.nmdp-page-section:nth-child(1) { animation-delay: 0.05s; }
.nmdp-page-section:nth-child(2) { animation-delay: 0.10s; }
.nmdp-page-section:nth-child(3) { animation-delay: 0.15s; }
.nmdp-page-section:nth-child(4) { animation-delay: 0.20s; }

/* ============================================================
   LOADING OVERLAY
   ============================================================ */

.nmdp-page-loader {
    position: fixed;
    inset: 0;
    background: var(--nmdp-site-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: nmdpFadeOut 0.4s ease 0.8s both;
    pointer-events: none;
}

.nmdp-page-loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.nmdp-page-loader-logo {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: var(--nmdp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: nmdpBounceIn 0.6s ease;
}

.nmdp-page-loader-logo .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #ffffff;
}

.nmdp-loader-dots {
    display: flex;
    gap: 8px;
}

.nmdp-loader-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nmdp-primary);
    animation: nmdpTyping 1.4s ease-in-out infinite;
}

.nmdp-loader-dot:nth-child(2) { animation-delay: 0.2s; }
.nmdp-loader-dot:nth-child(3) { animation-delay: 0.4s; }

/* ============================================================
   СКЕЛЕТОН LOADING
   ============================================================ */

@keyframes nmdpSkeleton {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.nmdp-skeleton {
    background: linear-gradient(90deg,
        #f1f5f9 25%,
        #e2e8f0 50%,
        #f1f5f9 75%
    );
    background-size: 800px 100%;
    animation: nmdpSkeleton 1.5s ease-in-out infinite;
    border-radius: 6px;
    display: block;
}

.nmdp-skeleton-text   { height: 14px; margin-bottom: 8px; }
.nmdp-skeleton-title  { height: 22px; width: 60%; margin-bottom: 12px; }
.nmdp-skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.nmdp-skeleton-card   { height: 120px; border-radius: 12px; }
.nmdp-skeleton-btn    { height: 36px; width: 100px; border-radius: 8px; }

/* ============================================================
   STAT CARD — COUNTER АНИМАЦИЈА
   ============================================================ */

.nmdp-stat-card-value {
    animation: nmdpCountUp 0.5s ease both;
}

.nmdp-stat-card:nth-child(1) .nmdp-stat-card-value { animation-delay: 0.1s; }
.nmdp-stat-card:nth-child(2) .nmdp-stat-card-value { animation-delay: 0.2s; }
.nmdp-stat-card:nth-child(3) .nmdp-stat-card-value { animation-delay: 0.3s; }
.nmdp-stat-card:nth-child(4) .nmdp-stat-card-value { animation-delay: 0.4s; }

/* ============================================================
   САЈДБАР АНИМАЦИИ
   ============================================================ */

/* Hover на мени ставки */
.nmdp-sidebar-menu a {
    transition: background-color 0.18s ease,
                color 0.18s ease,
                padding-left 0.18s ease;
}

.nmdp-sidebar-menu a:hover { padding-left: 24px; }

/* Активна ставка — без slide */
.nmdp-sidebar-menu .current-menu-item > a:hover { padding-left: 20px; }

/* Submenu отворање */
.nmdp-sidebar-menu .sub-menu {
    transition: max-height 0.35s cubic-bezier(0, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 0;
}

.nmdp-sidebar-menu .menu-item-has-children.nmdp-submenu-open > .sub-menu {
    opacity: 1;
}

/* ============================================================
   ТОПБАР АНИМАЦИИ
   ============================================================ */

/* Dropdown отворање */
.nmdp-profile-dropdown,
.nmdp-notif-dropdown {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Badge пулс при нова нотификација */
.nmdp-notif-badge.nmdp-badge-new {
    animation: nmdpBounceIn 0.4s ease;
}

/* ============================================================
   КАРТИЧКИ — HOVER ЕФЕКТИ
   ============================================================ */

.nmdp-stat-card,
.nmdp-member-card,
.nmdp-doc-card,
.nmdp-notif-card,
.nmdp-quick-action-card {
    transition: transform 0.22s ease,
                box-shadow 0.22s ease,
                border-color 0.22s ease;
}

/* ============================================================
   КОПЧИЊА — RIPPLE ЕФЕКТ
   ============================================================ */

.nmdp-btn,
.nmdp-admin-btn,
.nmdp-quick-action-card {
    position: relative;
    overflow: hidden;
}

.nmdp-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    transform: scale(0);
    animation: nmdpRipple 0.6s linear;
    pointer-events: none;
}

/* ============================================================
   ФОРМА — ФОКУС АНИМАЦИЈА
   ============================================================ */

.nmdp-input,
.nmdp-textarea,
.nmdp-select {
    transition: border-color 0.2s ease,
                box-shadow 0.2s ease,
                background-color 0.2s ease;
}

/* Грешка анимација */
.nmdp-input.nmdp-error,
.nmdp-textarea.nmdp-error {
    border-color: #dc2626;
    animation: nmdpShake 0.4s ease;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

/* Успех анимација */
.nmdp-input.nmdp-success,
.nmdp-textarea.nmdp-success {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22,163,74,0.1);
}

/* ============================================================
   TOAST НОТИФИКАЦИИ
   ============================================================ */

.nmdp-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.nmdp-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    border-left: 4px solid;
    min-width: 280px;
    max-width: 360px;
    pointer-events: auto;
    animation: nmdpSlideInRight 0.35s ease both;
}

.nmdp-toast.nmdp-toast-hiding {
    animation: nmdpSlideInRight 0.3s ease reverse both;
}

.nmdp-toast-success { border-left-color: #16a34a; }
.nmdp-toast-error   { border-left-color: #dc2626; }
.nmdp-toast-warning { border-left-color: #d97706; }
.nmdp-toast-info    { border-left-color: #2563eb; }

.nmdp-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nmdp-toast-success .nmdp-toast-icon { background: #f0fdf4; color: #16a34a; }
.nmdp-toast-error   .nmdp-toast-icon { background: #fef2f2; color: #dc2626; }
.nmdp-toast-warning .nmdp-toast-icon { background: #fffbeb; color: #d97706; }
.nmdp-toast-info    .nmdp-toast-icon { background: #eff6ff; color: #2563eb; }

.nmdp-toast-icon .dashicons { font-size: 16px; width: 16px; height: 16px; }

.nmdp-toast-body { flex: 1; min-width: 0; }

.nmdp-toast-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}

.nmdp-toast-msg {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.nmdp-toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.nmdp-toast-close:hover { color: #475569; }
.nmdp-toast-close .dashicons { font-size: 16px; width: 16px; height: 16px; }

/* ============================================================
   MODAL АНИМАЦИИ
   ============================================================ */

.nmdp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: nmdpFadeIn 0.25s ease;
    backdrop-filter: blur(3px);
}

.nmdp-modal {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: nmdpScaleIn 0.3s ease;
}

.nmdp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.nmdp-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.nmdp-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.15s ease;
}

.nmdp-modal-close:hover { background: #e2e8f0; color: #1e293b; }
.nmdp-modal-close .dashicons { font-size: 16px; width: 16px; height: 16px; }

.nmdp-modal-body    { padding: 20px 24px; }
.nmdp-modal-footer  { padding: 16px 24px 20px; border-top: 1px solid #f1f5f9; display: flex; gap: 10px; justify-content: flex-end; }

/* Затворање на модал */
.nmdp-modal-overlay.nmdp-closing { animation: nmdpFadeOut 0.2s ease both; }
.nmdp-modal-overlay.nmdp-closing .nmdp-modal { animation: nmdpScaleIn 0.2s ease reverse both; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */

.nmdp-progress-wrap {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.nmdp-progress-bar {
    height: 100%;
    background: var(--nmdp-primary);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.nmdp-progress-bar.nmdp-animate {
    animation: nmdpProgressBar 1.5s ease both;
}

/* Upload прогрес */
.nmdp-upload-progress {
    margin-top: 8px;
    display: none;
}

.nmdp-upload-progress.active { display: block; }

/* ============================================================
   TYPING ИНДИКАТОР
   ============================================================ */

.nmdp-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background: #f1f5f9;
    border-radius: 12px;
}

.nmdp-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: nmdpTyping 1.4s ease-in-out infinite;
}

.nmdp-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.nmdp-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ============================================================
   REDUCE MOTION — ПРИСТАПНОСТ
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .nmdp-sidebar-menu a:hover { padding-left: 20px; }
}