/* ============================================
   Additional Enhancements & Polish
   ============================================ */

/* Autosave Indicator */
.kpm-autosave-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--kpm-success);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    display: none;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Confirmation Modal */
.kpm-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.kpm-confirm-modal.show {
    opacity: 1;
    pointer-events: all;
}

.kpm-confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.kpm-confirm-dialog {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.kpm-confirm-modal.show .kpm-confirm-dialog {
    transform: scale(1);
}

.kpm-confirm-dialog h3 {
    margin: 0 0 15px;
    font-size: 22px;
    color: var(--kpm-primary);
}

.kpm-confirm-dialog p {
    margin: 0 0 25px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--kpm-text);
}

.kpm-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Success Overlay Animation */
.kpm-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kpm-success-overlay.show {
    opacity: 1;
}

.kpm-success-box {
    background: white;
    border-radius: 16px;
    padding: 50px 40px;
    text-align: center;
    max-width: 400px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.kpm-success-overlay.show .kpm-success-box {
    transform: scale(1);
}

.kpm-success-box h3 {
    margin: 20px 0 10px;
    font-size: 24px;
    color: var(--kpm-success);
}

.kpm-success-box p {
    margin: 0;
    color: var(--kpm-text-light);
    font-size: 15px;
}

/* Enhanced Loading Overlay */
.kpm-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.kpm-loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.kpm-loading-content {
    text-align: center;
}

.kpm-loading-text {
    margin: 20px 0 0;
    font-size: 16px;
    color: var(--kpm-text);
    font-weight: 500;
}

/* Enhanced Notification */
.kpm-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 16px 50px 16px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    min-width: 300px;
    max-width: 500px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(550px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpm-notification.show {
    transform: translateX(0);
}

.kpm-notification-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.kpm-notification-success .kpm-notification-icon {
    background: var(--kpm-success);
    color: white;
}

.kpm-notification-error .kpm-notification-icon {
    background: var(--kpm-danger);
    color: white;
}

.kpm-notification-warning .kpm-notification-icon {
    background: var(--kpm-warning);
    color: white;
}

.kpm-notification-info .kpm-notification-icon {
    background: var(--kpm-info);
    color: white;
}

.kpm-notification-message {
    flex: 1;
    font-size: 14px;
    color: var(--kpm-text);
}

.kpm-notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: var(--kpm-text-light);
    transition: color 0.2s ease;
}

.kpm-notification-close:hover {
    color: var(--kpm-text);
}

/* Back to Top Button */
.kpm-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--kpm-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.kpm-back-to-top.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.kpm-back-to-top:hover {
    background: var(--kpm-primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.kpm-back-to-top .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Countdown Urgent State */
.kpm-countdown-urgent {
    color: var(--kpm-danger) !important;
    font-weight: 700;
    animation: pulse 1s infinite;
}

.kpm-countdown-expired {
    color: var(--kpm-secondary);
    font-style: italic;
}

/* Image Lazy Load Effect */
.kpm-card-photo img {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.kpm-card-photo img.loaded {
    opacity: 1;
}

/* Mobile Touch Optimization */
@media (hover: none) {
    .kpm-card:hover {
        transform: none;
    }
    
    .kpm-card:active {
        transform: scale(0.98);
    }
}

/* Responsive Notifications */
@media (max-width: 576px) {
    .kpm-notification {
        left: 20px;
        right: 20px;
        min-width: auto;
        transform: translateY(-100px);
    }

    .kpm-notification.show {
        transform: translateY(0);
    }

    .kpm-back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}