/* ==========================================================================
   CRACKERS GURU - PRO TOAST & ALERT NOTIFICATION SYSTEM
   Glassmorphic, responsive, high-converting notification engine
   ========================================================================== */

/* Toast Container (Stacks in top-right on desktop, top-center on mobile) */
.cg-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 40px);
}

@media (max-width: 576px) {
    .cg-toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        width: calc(100% - 24px);
        max-width: 100%;
    }
}

/* Base Toast Item */
.cg-toast {
    position: relative;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.9);
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, box-shadow 0.25s ease;
    animation: cgToastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cg-toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
}

.cg-toast.cg-toast-hiding {
    animation: cgToastSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cgToastSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-16px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cgToastSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 120px;
        margin-bottom: 0;
    }
    100% {
        opacity: 0;
        transform: translateY(-14px) scale(0.92);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: -12px;
    }
}

/* Toast Icon Wrapper */
.cg-toast-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    margin-right: 12px;
}

/* Toast Body */
.cg-toast-body {
    flex: 1;
    min-width: 0;
}

.cg-toast-title {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 2px;
    color: #0f172a;
}

.cg-toast-message {
    font-size: 13px;
    line-height: 1.45;
    color: #334155;
    word-break: break-word;
}

/* Close Button */
.cg-toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-size: 13px;
}

.cg-toast-close:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.06);
}

/* Auto-dismiss progress bar */
.cg-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
}

/* Semantic Varieties */

/* Success */
.cg-toast-success {
    border-left: 4px solid #10b981;
}
.cg-toast-success .cg-toast-icon {
    background: #d1fae5;
    color: #059669;
}
.cg-toast-success .cg-toast-progress {
    background: linear-gradient(90deg, #10b981, #059669);
}

/* Error / Danger */
.cg-toast-error {
    border-left: 4px solid #ef4444;
}
.cg-toast-error .cg-toast-icon {
    background: #fee2e2;
    color: #dc2626;
}
.cg-toast-error .cg-toast-progress {
    background: linear-gradient(90deg, #ef4444, #b91c1c);
}

/* Warning */
.cg-toast-warning {
    border-left: 4px solid #f59e0b;
}
.cg-toast-warning .cg-toast-icon {
    background: #fef3c7;
    color: #d97706;
}
.cg-toast-warning .cg-toast-progress {
    background: linear-gradient(90deg, #f59e0b, #b45309);
}

/* Info */
.cg-toast-info {
    border-left: 4px solid #3b82f6;
}
.cg-toast-info .cg-toast-icon {
    background: #dbeafe;
    color: #2563eb;
}
.cg-toast-info .cg-toast-progress {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

/* ==========================================================================
   INTERACTIVE MINIMUM ORDER MODAL DIALOG
   ========================================================================== */
.cg-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: cgBackdropFadeIn 0.25s ease forwards;
}

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

.cg-modal-box {
    background: #ffffff;
    border-radius: 18px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: cgModalPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

@keyframes cgModalPopIn {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.cg-modal-header {
    background: linear-gradient(135deg, #7c0a02 0%, #b30000 100%);
    color: #ffffff;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cg-modal-header h5 {
    margin: 0;
    font-weight: 700;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cg-modal-header .cg-modal-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    opacity: 0.8;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.cg-modal-header .cg-modal-close-btn:hover {
    opacity: 1;
}

.cg-modal-body {
    padding: 24px;
    color: #1e293b;
}

.cg-modal-progress-wrap {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    border: 1px solid #e2e8f0;
}

.cg-modal-actions {
    padding: 16px 24px 22px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

/* ==========================================================================
   INPUT HIGHLIGHT ANIMATION (When validation error triggers)
   ========================================================================== */
.input-error-glow {
    animation: cgInputPulse 1.2s ease-in-out infinite alternate !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25) !important;
}

@keyframes cgInputPulse {
    0% {
        box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
    }
    100% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.4);
    }
}
