/* ============================================================================
   KohaPanel — motion layer (v2, lightweight)
   ----------------------------------------------------------------------------
   Loaded after kohapanel-ui.css. Movement is short, low-distance and
   compositor-friendly: opacity + transform only. Blur entrances, infinite
   background-position loops and pulsing shadows were removed so the panel
   stays smooth on low-end devices. The v4 layout and colour system are
   unchanged.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Keyframes
   -------------------------------------------------------------------------- */
@keyframes kp-view-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes kp-card-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes kp-modal-in {
    from {
        opacity: 0;
        transform: translateY(5px) scale(0.995);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes kp-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes kp-pane-in {
    from {
        opacity: 0;
        transform: translateX(6px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes kp-icon-pop {
    from { transform: scale(0.92); }
    to { transform: scale(1); }
}

@keyframes kp-toast-in {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes kp-banner-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes kp-share-row-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------------------------------------------------------------
   1. Page / tab / panel entrances
   -------------------------------------------------------------------------- */
.tab-content.active {
    animation: kp-view-in 0.22s ease-out both;
}

.main-content > .top-header {
    animation: kp-view-in 0.24s ease-out both;
}

.kp-account-pane.active {
    animation: kp-pane-in 0.2s ease-out both;
}

.kp-share-panel,
.settings-wrapper.glass {
    animation: kp-view-in 0.22s ease-out both;
}

/* --------------------------------------------------------------------------
   2. Server list cards
   -------------------------------------------------------------------------- */
.server-grid .server-card {
    animation: kp-card-in 0.24s ease-out backwards !important;
}

/* Very short stagger: enough to feel deliberate without delaying the list. */
.server-grid .server-card:nth-child(1) { animation-delay: 0s; }
.server-grid .server-card:nth-child(2) { animation-delay: 0.015s; }
.server-grid .server-card:nth-child(3) { animation-delay: 0.03s; }
.server-grid .server-card:nth-child(4) { animation-delay: 0.045s; }
.server-grid .server-card:nth-child(5) { animation-delay: 0.06s; }
.server-grid .server-card:nth-child(n + 6) { animation-delay: 0.075s; }

.server-card .server-icon {
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.server-card:hover .server-icon {
    transform: translateY(-1px);
}

.server-card .server-actions .btn-manage,
.server-card .server-actions .btn {
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

/* --------------------------------------------------------------------------
   3. Navigation
   -------------------------------------------------------------------------- */
/* The v4 sidebar keeps its flat 2px accent line (kohapanel-ui.css). The old
   animated gradient loop was a continuous repaint and has been removed. */

.nav-item,
.bottom-nav-item {
    transition: color 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.nav-item i,
.bottom-nav-item i {
    transition: transform 0.16s ease, color 0.14s ease;
}

.nav-item.active i,
.bottom-nav-item.active i {
    animation: kp-icon-pop 0.2s ease-out;
}

.nav-item:active,
.bottom-nav-item:active {
    transform: scale(0.985);
}

/* --------------------------------------------------------------------------
   4. Buttons, inputs, cards and lists
   -------------------------------------------------------------------------- */
.btn {
    transition:
        background 0.14s ease,
        border-color 0.14s ease,
        color 0.14s ease,
        opacity 0.14s ease;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.glass {
    transition: border-color 0.18s ease, background 0.18s ease;
}

.fm-row {
    transition: background 0.14s ease;
}

.data-table tbody tr {
    transition: background 0.14s ease;
}

/* Status dots keep the static ring from kohapanel-ui.css. The infinite
   box-shadow pulse was removed because it forced repaints every frame. */

/* --------------------------------------------------------------------------
   5. Modals and overlays
   -------------------------------------------------------------------------- */
.modal[style*="display: flex"],
.modal.show,
.modal-overlay[style*="display: flex"],
.modal-overlay.show {
    animation: kp-overlay-in 0.15s ease both;
}

.modal .modal-content {
    animation: kp-modal-in 0.2s ease-out both;
}

/* --------------------------------------------------------------------------
   6. Share link additions
   -------------------------------------------------------------------------- */
.kp-share-active-item {
    animation: kp-share-row-in 0.2s ease-out both;
}

.kp-share-active-item:nth-child(2) { animation-delay: 0.02s; }
.kp-share-active-item:nth-child(3) { animation-delay: 0.04s; }
.kp-share-active-item:nth-child(n + 4) { animation-delay: 0.06s; }

.kp-share-result {
    animation: kp-banner-in 0.2s ease-out both;
}

.kp-discord-avatar-preview img {
    transition: transform 0.18s ease;
}

.kp-discord-avatar-preview:hover img {
    transform: scale(1.03);
}

/* --------------------------------------------------------------------------
   7. Toasts
   -------------------------------------------------------------------------- */
#toast-container > * {
    animation: kp-toast-in 0.2s ease-out both;
}

/* --------------------------------------------------------------------------
   8. Hover-only movement
   -------------------------------------------------------------------------- */
@media (hover: hover) {
    /* Server cards stay flat in v4; only the border/background reacts. */
    .btn:hover {
        transform: translateY(-1px);
    }

    .btn:active {
        transform: translateY(0) scale(0.99);
    }

    .settings-wrapper.glass:hover {
        border-color: rgba(129, 140, 248, 0.18);
    }
}

/* --------------------------------------------------------------------------
   9. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .server-grid .server-card {
        animation: none !important;
    }
}
