/* =========================================
   CT-lytics Notification / Toast System
   Premium Glassmorphism Design
   ========================================= */

/* ---- Container ---- */
#ct-toast-container {
    position: fixed;
    top: 24px; /* Align with navbar spacing if needed, but 24px is standard */
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: none;
    width: 380px;
    max-width: calc(100vw - 48px);
}

/* ---- Individual Toast ---- */
.ct-toast {
    position: relative;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    
    /* Glassmorphism - Darker and more "Pro" than standard containers */
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    
    /* Subtle Border */
    border: 1px solid rgba(255, 255, 255, 0.08);
    
    /* Deep Shadow & Inner Glow */
    box-shadow: 
        0 20px 40px -15px rgba(0, 0, 0, 0.6),
        0 5px 15px -5px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
        
    /* Animation - Start state */
    opacity: 0;
    transform: translateX(40px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    
    will-change: transform, opacity;
}

/* Visibility Toggle */
.ct-toast-visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

/* Hover Effect */
.ct-toast:hover {
    background: rgba(15, 15, 22, 0.9);
    border-color: rgba(var(--toast-accent-rgb, 255, 255, 255), 0.3);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(var(--toast-accent-rgb, 59, 130, 246), 0.15);
}

/* ---- Accent Strip (subtle top-left highlight) ---- */
.ct-toast-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    opacity: 0.8;
}

/* ---- Toast Body ---- */
.ct-toast-body {
    display: flex;
    align-items: flex-start; /* Better for multi-line messages */
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    position: relative;
}

/* ---- Content Wrapper ---- */
.ct-toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* ---- Title ---- */
.ct-toast-title {
    font-family: var(--font-display, 'Outfit', sans-serif);
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.3px;
}

/* ---- Icon Container ---- */
.ct-toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(var(--toast-accent-rgb, 59, 130, 246), 0.1);
    border: 1px solid rgba(var(--toast-accent-rgb, 59, 130, 246), 0.2);
    transition: all 0.3s ease;
}

.ct-toast:hover .ct-toast-icon {
    background: rgba(var(--toast-accent-rgb, 59, 130, 246), 0.2);
    transform: rotate(-5deg) scale(1.1);
}

.ct-toast-icon svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 0 8px rgba(var(--toast-accent-rgb, 59, 130, 246), 0.5));
}

/* ---- Message Text ---- */
.ct-toast-message {
    font-family: var(--font-main, 'Inter', sans-serif);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.7);
    word-break: break-word;
}

/* ---- Close Button ---- */
.ct-toast-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.ct-toast-close:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
    transform: rotate(90deg);
}

.ct-toast-close:active {
    transform: scale(0.9) rotate(90deg);
}

/* ---- Progress Bar (Bottom Edge) ---- */
.ct-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.ct-toast-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: left;
    animation: ct-toast-shrink linear forwards;
    opacity: 0.7;
    background: var(--toast-accent, #3b82f6);
}

@keyframes ct-toast-shrink {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ---- Stacking/Exit States managed via JS styles but these provide defaults ---- */
.ct-toast[data-dismissing="true"] {
    pointer-events: none;
    z-index: -1;
}

/* ---- Responsive: Mobile ---- */
@media (max-width: 640px) {
    #ct-toast-container {
        top: auto;
        bottom: 24px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        gap: 12px;
    }

    .ct-toast {
        border-radius: 14px;
        transform: translateY(20px) scale(0.98);
    }

    .ct-toast-visible {
        transform: translateY(0) scale(1);
    }

    .ct-toast-body {
        padding: 1rem;
        gap: 0.75rem;
    }

    .ct-toast-icon {
        width: 36px;
        height: 36px;
    }

    .ct-toast-icon svg {
        width: 18px;
        height: 18px;
    }

    .ct-toast-message {
        font-size: 0.875rem;
    }
}

/* ---- Hide the legacy messages container (replaced by new system) ---- */
#messages-container,
.messages {
    display: none !important;
}
