/**
 * MondzorgHUB Location Manager - Animations & Micro-interactions
 *
 * @package MZH_Location_Manager
 * @version 2.0.0
 * @author Marketing Maatwerk
 * @link https://marketingmaatwerk.nl
 */

/* --- Keyframe Animations --- */

/* Pulse animatie voor belangrijke knoppen */
@keyframes mzh-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(95, 182, 188, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(95, 182, 188, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(95, 182, 188, 0);
    }
}

/* Fade in animatie */
@keyframes mzh-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide down animatie */
@keyframes mzh-slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide up animatie */
@keyframes mzh-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Shake animatie voor errors */
@keyframes mzh-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Spinner animatie */
@keyframes mzh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Glow pulse animatie */
@keyframes mzh-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(95, 182, 188, 0.5),
                    0 0 10px rgba(95, 182, 188, 0.3);
    }
    50% {
        box-shadow: 0 0 10px rgba(95, 182, 188, 0.8),
                    0 0 20px rgba(95, 182, 188, 0.5);
    }
}

/* Scale in animatie */
@keyframes mzh-scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Bounce animatie */
@keyframes mzh-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Shimmer loading animatie */
@keyframes mzh-shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Success checkmark animatie */
@keyframes mzh-checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* --- Page Load Animations --- */

.mzh-form-wrapper,
.mzh-container,
.mzh-account-page,
.mzh-profile-page {
    animation: mzh-fadeIn 0.4s ease-out !important;
}

/* --- Notification Animations --- */

.mzh-notification,
.mzh-notice {
    animation: mzh-slideDown 0.5s ease-out !important;
}

/* Error shake animation */
.mzh-notice.notice-error,
.mzh-notification-error {
    animation: mzh-slideDown 0.3s ease-out, mzh-shake 0.5s ease-out 0.3s !important;
}

/* --- Button Animations --- */

/* Pulse op primaire buttons */
.button-primary,
.mzh-form-box button[type="submit"],
#export-controls .export-btn,
.mzh-logout-button {
    animation: mzh-pulse 2s infinite !important;
}

/* Hover glow effect */
.button:hover,
.mzh-form-box button:hover,
#controls button:hover {
    animation: mzh-glow 1.5s ease-in-out infinite !important;
}

/* Active state (button press) */
.button:active,
.mzh-form-box button:active,
#controls button:active {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease-out !important;
}

/* --- Input Field Animations --- */

/* Focus glow effect */
.mzh-form-box input:focus,
.mzh-form-box select:focus,
.mzh-form-box textarea:focus,
#controls input:focus,
#controls select:focus {
    animation: mzh-glow 2s ease-in-out infinite !important;
}

/* Invalid input shake */
.mzh-form-box input:invalid:not(:placeholder-shown),
.mzh-form-box select:invalid {
    border-color: #dc3545 !important;
    animation: mzh-shake 0.5s ease-out !important;
}

/* --- Table Row Animations --- */

.mzh-account-table tbody tr {
    transition: background-color 0.3s ease, transform 0.2s ease !important;
}

.mzh-account-table tbody tr:hover {
    background-color: #f8f9fa !important;
    transform: translateX(5px) !important;
}

/* Row removal animation */
.mzh-account-table tbody tr.removing {
    animation: mzh-slideUp 0.3s ease-out reverse !important;
}

/* --- Modal Animations --- */

.mzh-modal-overlay {
    animation: mzh-fadeIn 0.3s ease-out !important;
}

.mzh-modal-content {
    animation: mzh-scaleIn 0.3s ease-out !important;
}

/* --- Spinner/Loader --- */

.spinner,
.mzh-spinner,
[class*="spinner"] {
    animation: mzh-spin 1s linear infinite !important;
}

/* Loading skeleton */
.mzh-skeleton {
    background: linear-gradient(90deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%) !important;
    background-size: 1000px 100% !important;
    animation: mzh-shimmer 2s infinite !important;
}

/* --- Map Marker Animations --- */

/* Nieuwe marker animatie (alleen bij eerste plaatsing via JS) */
.leaflet-marker-icon.mzh-marker-new {
    animation: mzh-bounce 0.6s ease-out !important;
}

.leaflet-popup {
    animation: mzh-scaleIn 0.3s ease-out !important;
}

/* Cluster hover effect */
.marker-cluster:hover div {
    transform: scale(1.1) !important;
}

/* --- Smooth Transitions (Scoped to Plugin) --- */

/* Alleen plugin elementen krijgen smooth transitions */
.mzh-form-wrapper a,
.mzh-form-box a,
.mzh-container a,
.mzh-account-page a,
.mzh-profile-page a,
.mzh-form-wrapper button,
.mzh-form-box button,
.mzh-container button,
.mzh-account-page button,
.mzh-profile-page button,
.mzh-form-wrapper .button,
.mzh-form-box .button,
.mzh-container .button,
.mzh-account-page .button,
.mzh-profile-page .button,
.mzh-form-wrapper input,
.mzh-form-box input,
.mzh-container input,
.mzh-account-page input,
.mzh-profile-page input,
.mzh-form-wrapper select,
.mzh-form-box select,
.mzh-container select,
.mzh-account-page select,
.mzh-profile-page select,
.mzh-form-wrapper textarea,
.mzh-form-box textarea,
.mzh-container textarea,
.mzh-account-page textarea,
.mzh-profile-page textarea,
.mzh-account-table tbody tr,
.marker-cluster,
.leaflet-marker-icon {
    transition: all 0.3s ease !important;
}

/* --- Reduce Motion (Accessibility - Scoped to Plugin) --- */

@media (prefers-reduced-motion: reduce) {
    .mzh-form-wrapper *,
    .mzh-form-wrapper *::before,
    .mzh-form-wrapper *::after,
    .mzh-form-box *,
    .mzh-form-box *::before,
    .mzh-form-box *::after,
    .mzh-container *,
    .mzh-container *::before,
    .mzh-container *::after,
    .mzh-account-page *,
    .mzh-account-page *::before,
    .mzh-account-page *::after,
    .mzh-profile-page *,
    .mzh-profile-page *::before,
    .mzh-profile-page *::after,
    .mzh-notification,
    .mzh-notice,
    .mzh-modal-overlay,
    .mzh-modal-content {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}