/**
 * VMP Fence Toast Notification System
 * Standalone notification styles
 * 
 * @package VMPFence
 * @since 2.1.0
 */

/* ============================================
   TOAST CONTAINER
   ============================================ */
#vmpfence-toast-container {
    position: fixed !important;
    top: 60px !important; /* Account for WP admin bar (32px) + spacing */
    right: 20px !important;
    z-index: 999999 !important;
    width: 380px !important;
    max-width: calc(100vw - 40px) !important;
    pointer-events: none !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
}

/* Adjust for mobile admin bar */
@media screen and (max-width: 782px) {
    #vmpfence-toast-container {
        top: 60px !important; /* Mobile WP admin bar is 46px */
        right: 10px !important;
        width: calc(100vw - 20px);
    }
}

/* Adjust when admin bar is not present */
body:not(.admin-bar) #vmpfence-toast-container {
    top: 20px !important;
}

/* Stack toasts vertically */
#vmpfence-toast-container .vmpfence-toast {
    pointer-events: all !important;
    width: 100% !important;
    display: flex !important;
    flex-shrink: 0 !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
}

/* ============================================
   TOAST BASE STYLES
   ============================================ */
.vmpfence-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 18px 20px;
    background: #2c3338;
    color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    font-size: 14px;
    line-height: 1.5;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    clear: both;
    float: none !important;
}

.vmpfence-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.vmpfence-toast.hide {
    opacity: 0;
    transform: translateX(400px);
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    max-height: 0;
}

/* ============================================
   TOAST ICON
   ============================================ */
.vmpfence-toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
}

/* ============================================
   TOAST CONTENT
   ============================================ */
.vmpfence-toast-content {
    flex: 1;
    min-width: 0;
}

.vmpfence-toast-title {
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 6px 0;
    color: #ffffff;
    line-height: 1.4;
}

.vmpfence-toast-message {
    font-size: 13px;
    color: #d3d3d3;
    margin: 0;
    line-height: 1.6;
    word-wrap: break-word;
}

/* ============================================
   TOAST CLOSE BUTTON
   ============================================ */
.vmpfence-toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-left: 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0b0b0;
    font-size: 20px;
    line-height: 1;
    transition: all 0.2s;
    padding: 0;
}

.vmpfence-toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.vmpfence-toast-close:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.vmpfence-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 8px 8px;
    transition: width linear;
    opacity: 0.7;
}

/* ============================================
   SUCCESS VARIANT
   ============================================ */
.vmpfence-toast.success {
    border-left: 4px solid #00a32a;
    background: #2c3338;
    color: #ffffff;
    padding: 18px 20px !important;
}

.vmpfence-toast.success .vmpfence-toast-icon {
    background: #00a32a;
    color: #ffffff;
}

.vmpfence-toast.success .vmpfence-toast-progress {
    background: #00a32a;
}

/* ============================================
   ERROR VARIANT
   ============================================ */
.vmpfence-toast.error {
    border-left: 4px solid #d63638;
    background: #2c3338;
    color: #ffffff;
    padding: 18px 20px !important;
}

.vmpfence-toast.error .vmpfence-toast-icon {
    background: #d63638;
    color: #ffffff;
}

.vmpfence-toast.error .vmpfence-toast-progress {
    background: #d63638;
}

/* ============================================
   WARNING VARIANT
   ============================================ */
.vmpfence-toast.warning {
    border-left: 4px solid #f0b849;
    background: #2c3338;
    color: #ffffff;
    padding: 18px 20px !important;
}

.vmpfence-toast.warning .vmpfence-toast-icon {
    background: #f0b849;
    color: #ffffff;
}

.vmpfence-toast.warning .vmpfence-toast-progress {
    background: #f0b849;
}

/* ============================================
   INFO VARIANT
   ============================================ */
.vmpfence-toast.info {
    border-left: 4px solid #2271b1;
    background: #2c3338;
    color: #ffffff;
    padding: 18px 20px !important;
}

.vmpfence-toast.info .vmpfence-toast-icon {
    background: #2271b1;
    color: #ffffff;
}

.vmpfence-toast.info .vmpfence-toast-progress {
    background: #2271b1;
}

/* ============================================
   CONFIRMATION MODAL
   ============================================ */
.vmpfence-notification-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999998 !important;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.vmpfence-notification-modal.show {
    display: flex !important; /* Show when active */
    opacity: 1;
    visibility: visible;
}

/* Modal Overlay */
.vmpfence-notification-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

/* Modal Content */
.vmpfence-notification-modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.vmpfence-notification-modal.show .vmpfence-notification-modal-content {
    transform: scale(1);
}

/* Modal Header */
.vmpfence-notification-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #dcdcde;
}

.vmpfence-notification-modal-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 24px;
}

.vmpfence-notification-modal.info .vmpfence-notification-modal-icon {
    background: #f0f6fc;
    color: #2271b1;
}

.vmpfence-notification-modal.warning .vmpfence-notification-modal-icon {
    background: #fef8ee;
    color: #f0b849;
}

.vmpfence-notification-modal.danger .vmpfence-notification-modal-icon {
    background: #fcf0f1;
    color: #d63638;
}

.vmpfence-notification-modal-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    color: #1d2327;
    margin: 0;
}

/* Modal Body */
.vmpfence-notification-modal-body {
    padding: 16px 24px 24px;
}

.vmpfence-notification-modal-message {
    font-size: 14px;
    line-height: 1.6;
    color: #50575e;
    text-align: center;
    margin: 0;
    white-space: pre-line;
}

/* Modal Footer */
.vmpfence-notification-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.vmpfence-notification-modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
}

.vmpfence-notification-modal-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.vmpfence-notification-modal-btn-cancel {
    background: #f6f7f7;
    color: #2c3338;
}

.vmpfence-notification-modal-btn-cancel:hover {
    background: #dcdcde;
}

.vmpfence-notification-modal-btn-confirm {
    background: #2271b1;
    color: #fff;
}

.vmpfence-notification-modal-btn-confirm:hover {
    background: #135e96;
}

.vmpfence-notification-modal.danger .vmpfence-notification-modal-btn-confirm {
    background: #d63638;
}

.vmpfence-notification-modal.danger .vmpfence-notification-modal-btn-confirm:hover {
    background: #b32d2e;
}

.vmpfence-notification-modal.warning .vmpfence-notification-modal-btn-confirm {
    background: #f0b849;
    color: #1d2327;
}

.vmpfence-notification-modal.warning .vmpfence-notification-modal-btn-confirm:hover {
    background: #dba617;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 600px) {
    #vmpfence-toast-container {
        top: 46px;
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .vmpfence-toast {
        padding: 14px 16px;
    }
    
    .vmpfence-notification-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .vmpfence-notification-modal-footer {
        flex-direction: column-reverse;
    }
    
    .vmpfence-notification-modal-btn {
        width: 100%;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.vmpfence-toast:focus-within {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(34, 113, 177, 0.3);
}

@media (prefers-reduced-motion: reduce) {
    .vmpfence-toast,
    .vmpfence-notification-modal,
    .vmpfence-notification-modal-content {
        transition: none;
    }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    .vmpfence-toast {
        background: #2c3338;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .vmpfence-toast-title {
        color: #f0f0f1;
    }
    
    .vmpfence-toast-message {
        color: #c3c4c7;
    }
    
    .vmpfence-toast-close {
        color: #8c8f94;
    }
    
    .vmpfence-toast-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #f0f0f1;
    }
    
    .vmpfence-notification-modal-content {
        background: #2c3338;
    }
    
    .vmpfence-notification-modal-header {
        border-bottom-color: #50575e;
    }
    
    .vmpfence-notification-modal-title {
        color: #f0f0f1;
    }
    
    .vmpfence-notification-modal-message {
        color: #c3c4c7;
    }
}
