/**
 * Custom CSS Animations
 * Smooth, lightweight animations for the Pesantren Management System
 */

/* Page Transition / Page Load Fade-in */
.page-enter {
    animation: fadeIn 0.4s ease-out;
}

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

/* Avatar initial centering */
.avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.avatar-initial span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Card Hover Scale + Shadow */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-stat {
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.dashboard-stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.12);
}

.dashboard-stat::after {
    content: "";
    position: absolute;
    inset: -30px auto auto 70%;
    width: 140px;
    height: 140px;
    border-radius: 9999px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.16), transparent 70%);
    pointer-events: none;
}

/* Button Hover and Active Feedback */
.btn-press {
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn-press:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-press:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Table Row Hover Effect */
table tr {
    transition: background-color 0.2s ease;
}

table tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Modal Opening Animation */
.modal-animate {
    animation: modalSlideIn 0.3s ease-out;
}

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

/* Alert/Notification Slide Animation */
.alert-slide {
    animation: alertSlide 0.4s ease-out;
}

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

/* Sidebar/Drawer Transition */
.drawer-transition {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Loading Spinner */
.spinner {
    animation: spin 1s linear infinite;
}

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

/* Loading Overlay */
.loading-overlay {
    animation: fadeIn 0.2s ease-out;
}

/* Form Input Focus Animation */
input:focus, textarea:focus, select:focus {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Dropdown Animation */
.dropdown-menu {
    animation: dropdownFade 0.2s ease-out;
}

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

/* Badge Pulse Animation */
.badge-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

/* Link Hover Animation */
a {
    transition: color 0.2s ease;
}

/* Tab Transition */
.tab-content {
    animation: fadeIn 0.3s ease-out;
}

/* Progress Bar Animation */
.progress-bar {
    transition: width 0.5s ease-out;
}

/* Tooltip Animation */
[title]:hover::after {
    animation: tooltipFade 0.2s ease-out;
}

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

/* Stagger Animation for Lists */
.stagger-item {
    animation: staggerIn 0.3s ease-out forwards;
    opacity: 0;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }

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

/* Shake Animation for Errors */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Success Checkmark Animation */
.checkmark {
    animation: checkmark 0.5s ease-in-out;
}

@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
