/* ============================================================
   CTG Notify — site-wide notification module (toasts + panel)
   Included from base.html; markup in templates/includes/notifications.html
   z-indexes sit above Bootstrap modals (1055) so notifications
   are visible on top of any open window.
   ============================================================ */

#ctg-notify[v-cloak] { display: none !important; }

/* ---------- Toast stack ---------- */
.ctgn-toasts {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 21000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.ctgn-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 38px 14px 16px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    pointer-events: auto;
}

.ctgn-toast::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--ctgn-accent, #6366f1);
}

.ctgn-toast-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--ctgn-accent, #6366f1);
    background: var(--ctgn-accent-soft, rgba(99, 102, 241, 0.12));
}

.ctgn-toast-body { min-width: 0; flex: 1; }

.ctgn-toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #0f172a;
    margin-bottom: 1px;
}

.ctgn-toast-text {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.45;
    overflow-wrap: break-word;
}

.ctgn-toast-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.ctgn-btn {
    border: none;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.ctgn-btn:hover { transform: translateY(-1px); }

.ctgn-btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.ctgn-btn-primary:hover { color: #fff; }

.ctgn-btn-ghost {
    color: #64748b;
    background: rgba(100, 116, 139, 0.1);
}
.ctgn-btn-ghost:hover { color: #475569; background: rgba(100, 116, 139, 0.18); }

.ctgn-toast-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
}
.ctgn-toast-close:hover { color: #475569; }

.ctgn-toast-progress {
    position: absolute;
    left: 0; bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    background: var(--ctgn-accent, #6366f1);
    opacity: 0.35;
    animation: ctgn-progress linear forwards;
}
@keyframes ctgn-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* level accents */
.ctgn-toast.ctgn-success { --ctgn-accent: #10b981; --ctgn-accent-soft: rgba(16, 185, 129, 0.12); }
.ctgn-toast.ctgn-warning { --ctgn-accent: #f59e0b; --ctgn-accent-soft: rgba(245, 158, 11, 0.14); }
.ctgn-toast.ctgn-error,
.ctgn-toast.ctgn-danger  { --ctgn-accent: #ef4444; --ctgn-accent-soft: rgba(239, 68, 68, 0.12); }
.ctgn-toast.ctgn-info    { --ctgn-accent: #0ea5e9; --ctgn-accent-soft: rgba(14, 165, 233, 0.12); }
.ctgn-toast.ctgn-nudge   { --ctgn-accent: #8b5cf6; --ctgn-accent-soft: rgba(139, 92, 246, 0.14); }

/* toast enter/leave animation */
.ctgn-toast-anim-enter-active { transition: all 0.3s cubic-bezier(0.21, 1.02, 0.73, 1); }
.ctgn-toast-anim-leave-active { transition: all 0.25s ease-in; }
.ctgn-toast-anim-enter, .ctgn-toast-anim-leave-to {
    opacity: 0;
    transform: translateX(40px) scale(0.96);
}
.ctgn-toast-anim-move { transition: transform 0.25s ease; }

/* ---------- Bell badge (navbar) ---------- */
.ctgn-bell-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: linear-gradient(135deg, #f43f5e, #ef4444);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
}

/* ---------- Slide-in panel ---------- */
.ctgn-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20400;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.ctgn-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 20500;
    width: min(400px, 100vw);
    background: #fff;
    box-shadow: -16px 0 50px rgba(15, 23, 42, 0.25);
    border-radius: 20px 0 0 20px;
    display: flex;
    flex-direction: column;
    transform: translateX(105%);
    transition: transform 0.3s cubic-bezier(0.21, 1.02, 0.73, 1);
}
.ctgn-panel.ctgn-open { transform: translateX(0); }

.ctgn-panel-header {
    padding: 18px 20px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #a855f7 100%);
    color: #fff;
    border-radius: 20px 0 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ctgn-panel-header h6 {
    margin: 0;
    font-weight: 700;
    font-size: 1rem;
    flex: 1;
}
.ctgn-panel-header .ctgn-header-btn {
    border: none;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.ctgn-panel-header .ctgn-header-btn:hover { background: rgba(255, 255, 255, 0.28); }

.ctgn-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

/* nudge card pinned at the top of the panel */
.ctgn-nudge-card {
    position: relative;
    border-radius: 16px;
    padding: 14px 14px 14px 16px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.25);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.ctgn-nudge-card .ctgn-toast-icon {
    --ctgn-accent: #8b5cf6;
    --ctgn-accent-soft: rgba(139, 92, 246, 0.16);
}
.ctgn-nudge-dismiss {
    position: absolute;
    top: 6px;
    right: 10px;
    border: none;
    background: none;
    color: #a78bfa;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
}
.ctgn-nudge-dismiss:hover { color: #7c3aed; }

/* notification rows */
.ctgn-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.12s ease;
    position: relative;
}
.ctgn-item:hover { background: #f1f5f9; }
.ctgn-item.ctgn-unread { background: rgba(99, 102, 241, 0.06); }
.ctgn-item.ctgn-unread:hover { background: rgba(99, 102, 241, 0.1); }

.ctgn-item-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--ctgn-accent, #6366f1);
    background: var(--ctgn-accent-soft, rgba(99, 102, 241, 0.12));
}
.ctgn-item.ctgn-level-success .ctgn-item-icon { --ctgn-accent: #10b981; --ctgn-accent-soft: rgba(16, 185, 129, 0.12); }
.ctgn-item.ctgn-level-warning .ctgn-item-icon { --ctgn-accent: #f59e0b; --ctgn-accent-soft: rgba(245, 158, 11, 0.14); }
.ctgn-item.ctgn-level-error .ctgn-item-icon   { --ctgn-accent: #ef4444; --ctgn-accent-soft: rgba(239, 68, 68, 0.12); }

.ctgn-item-body { flex: 1; min-width: 0; }
.ctgn-item-text {
    font-size: 0.85rem;
    color: #1e293b;
    line-height: 1.4;
    overflow-wrap: break-word;
}
.ctgn-item.ctgn-unread .ctgn-item-text { font-weight: 600; }
.ctgn-item-time {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
}
.ctgn-unread-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-top: 14px;
    border-radius: 50%;
    background: #6366f1;
}

/* empty state */
.ctgn-empty {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
}
.ctgn-empty i {
    font-size: 2.4rem;
    color: #c7d2fe;
    display: block;
    margin-bottom: 12px;
}
.ctgn-empty p { font-size: 0.88rem; margin: 0; }

.ctgn-panel-footer {
    border-top: 1px solid #f1f5f9;
    padding: 10px 14px;
    text-align: center;
}
.ctgn-panel-footer a {
    font-size: 0.82rem;
    font-weight: 600;
    color: #6366f1;
    text-decoration: none;
}
.ctgn-panel-footer a:hover { color: #4f46e5; }

@media (prefers-reduced-motion: reduce) {
    .ctgn-panel,
    .ctgn-toast-anim-enter-active,
    .ctgn-toast-anim-leave-active,
    .ctgn-toast-anim-move,
    .ctgn-btn { transition: none; }
    .ctgn-toast-progress { animation: none; }
}
