/**
 * RPM Modern Toast Notifications
 * Beautiful, animated toast notifications
 * Mobile responsive design
 */

/* Toast Container */
.rpm-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    width: calc(100% - 40px);
    pointer-events: none;
}

/* Individual Toast */
.rpm-toast {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    pointer-events: auto;
    animation: rpmToastSlideIn 0.4s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    transform: translateX(120%);
    opacity: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.rpm-toast.rpm-toast-hiding {
    animation: rpmToastSlideOut 0.3s cubic-bezier(0.06, 0.71, 0.55, 1) forwards;
}

/* Toast Icon */
.rpm-toast-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

/* Toast Content */
.rpm-toast-content {
    flex: 1;
    min-width: 0;
}

.rpm-toast-title {
    font-weight: 700;
    font-size: 15px;
    margin: 0 0 4px 0;
    color: #1f2937;
    line-height: 1.3;
}

.rpm-toast-message {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Toast Close Button */
.rpm-toast-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: #f3f4f6;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-size: 16px;
    margin-left: 8px;
}

.rpm-toast-close:hover {
    background: #e5e7eb;
    color: #374151;
    transform: scale(1.1);
}

/* Progress Bar */
.rpm-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: currentColor;
    opacity: 0.3;
    border-radius: 0 0 16px 16px;
    animation: rpmToastProgress linear forwards;
}

/* Toast Types */

/* Success Toast */
.rpm-toast-success {
    border-left: 4px solid #10b981;
}
.rpm-toast-success .rpm-toast-icon {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}
.rpm-toast-success .rpm-toast-progress {
    background: #10b981;
}

/* Error Toast */
.rpm-toast-error {
    border-left: 4px solid #ef4444;
}
.rpm-toast-error .rpm-toast-icon {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}
.rpm-toast-error .rpm-toast-progress {
    background: #ef4444;
}

/* Warning Toast */
.rpm-toast-warning {
    border-left: 4px solid #f59e0b;
}
.rpm-toast-warning .rpm-toast-icon {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}
.rpm-toast-warning .rpm-toast-progress {
    background: #f59e0b;
}

/* Info Toast */
.rpm-toast-info {
    border-left: 4px solid #3b82f6;
}
.rpm-toast-info .rpm-toast-icon {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}
.rpm-toast-info .rpm-toast-progress {
    background: #3b82f6;
}

/* Animations */
@keyframes rpmToastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes rpmToastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

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

/* Shake animation for errors */
@keyframes rpmToastShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.rpm-toast-error {
    animation: rpmToastSlideIn 0.4s cubic-bezier(0.21, 1.02, 0.73, 1) forwards,
               rpmToastShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) 0.4s;
}

/* Bounce animation for success */
@keyframes rpmToastBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.rpm-toast-success .rpm-toast-icon {
    animation: rpmToastBounce 0.5s ease 0.3s;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .rpm-toast-container {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        max-width: none;
        width: auto;
    }
    
    .rpm-toast {
        padding: 14px 16px;
        gap: 12px;
        border-radius: 14px;
        animation-name: rpmToastSlideUp;
    }
    
    .rpm-toast.rpm-toast-hiding {
        animation-name: rpmToastSlideDown;
    }
    
    .rpm-toast-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }
    
    .rpm-toast-title {
        font-size: 14px;
    }
    
    .rpm-toast-message {
        font-size: 13px;
    }
    
    .rpm-toast-close {
        width: 26px;
        height: 26px;
    }
}

@keyframes rpmToastSlideUp {
    from {
        transform: translateY(120%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes rpmToastSlideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(120%);
        opacity: 0;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .rpm-toast {
        background: #1f2937;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .rpm-toast-title {
        color: #f9fafb;
    }
    
    .rpm-toast-message {
        color: #9ca3af;
    }
    
    .rpm-toast-close {
        background: #374151;
        color: #9ca3af;
    }
    
    .rpm-toast-close:hover {
        background: #4b5563;
        color: #f3f4f6;
    }
}

/* WordPress Admin Compatibility */
.wp-admin .rpm-toast-container {
    top: 52px; /* Account for admin bar */
}

@media (max-width: 782px) {
    .wp-admin .rpm-toast-container {
        top: 66px;
    }
}

/* =========================================
   MODERN CONFIRM MODAL
   ========================================= */

.rpm-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    padding: 20px;
}

.rpm-confirm-overlay.rpm-confirm-visible {
    opacity: 1;
    visibility: visible;
}

.rpm-confirm-modal {
    background: #ffffff;
    border-radius: 20px;
    padding: 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rpm-confirm-visible .rpm-confirm-modal {
    transform: scale(1) translateY(0);
}

.rpm-confirm-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.rpm-confirm-icon-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.rpm-confirm-icon-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.rpm-confirm-icon-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

.rpm-confirm-title {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.rpm-confirm-message {
    font-size: 15px;
    color: #6b7280;
    margin: 0 0 28px 0;
    line-height: 1.6;
}

.rpm-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.rpm-confirm-btn {
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 110px;
}

.rpm-confirm-cancel {
    background: #f3f4f6;
    color: #374151;
}

.rpm-confirm-cancel:hover {
    background: #e5e7eb;
}

.rpm-confirm-ok {
    color: white;
}

.rpm-confirm-btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.rpm-confirm-btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.rpm-confirm-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.rpm-confirm-btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.rpm-confirm-btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.rpm-confirm-btn-info:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .rpm-confirm-modal {
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .rpm-confirm-icon {
        width: 60px;
        height: 60px;
    }
    
    .rpm-confirm-title {
        font-size: 18px;
    }
    
    .rpm-confirm-message {
        font-size: 14px;
    }
    
    .rpm-confirm-buttons {
        flex-direction: column-reverse;
    }
    
    .rpm-confirm-btn {
        width: 100%;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .rpm-confirm-modal {
        background: #1f2937;
    }
    
    .rpm-confirm-title {
        color: #f9fafb;
    }
    
    .rpm-confirm-message {
        color: #9ca3af;
    }
    
    .rpm-confirm-cancel {
        background: #374151;
        color: #e5e7eb;
    }
    
    .rpm-confirm-cancel:hover {
        background: #4b5563;
    }
}
