/**
 * CareerNest — Notification module styles (cn-notify.js)
 *
 * Two visual patterns:
 *   .cn-notify-toasts          — bottom-right (desktop) / bottom-center
 *                                (mobile) stack of auto-dismissing toasts
 *   .cn-notify-confirm-overlay — full-screen scrim + centered modal
 *
 * Designed mobile-first: tap targets ≥ 44px, safe-area-inset for iOS,
 * brand-aware via --cn-* variables with hardcoded fallbacks.
 */

/* ── Toast container ───────────────────────────────────────────────── */
.cn-notify-toasts {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 100000;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    pointer-events: none;
    max-width: calc(100vw - 2rem);
    /* iOS notch / home-indicator safe area */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ── Toast (single) ────────────────────────────────────────────────── */
.cn-notify-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    background: #1a202c;
    color: #fff;
    padding: 0.75rem 0.875rem;
    border-radius: 10px;
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.18),
        0 4px 10px rgba(0, 0, 0, 0.10);
    min-width: 240px;
    max-width: 380px;
    font-size: 0.875rem;
    line-height: 1.4;

    /* Slide-in from the right (desktop) — overridden on mobile below */
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.cn-notify-toast--visible {
    opacity: 1;
    transform: translateX(0);
}

.cn-notify-toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-top: 1px;
}

.cn-notify-toast-message {
    flex: 1 1 auto;
    word-wrap: break-word;
    /* Plain weight; the icon does the visual emphasis */
    font-weight: 500;
}

.cn-notify-toast-close {
    flex-shrink: 0;
    background: transparent;
    border: 0;
    padding: 4px;
    margin: -4px -4px -4px 0;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
    /* Min 32×32 hit area inside (icon is 14×14) — small but adequate */
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cn-notify-toast-close:hover,
.cn-notify-toast-close:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

/* ── Toast type variants ──────────────────────────────────────────── */
.cn-notify-toast--success {
    background: #065f46;
    border-left: 4px solid #10b981;
}

.cn-notify-toast--success .cn-notify-toast-icon {
    color: #6ee7b7;
}

.cn-notify-toast--error {
    background: #7f1d1d;
    border-left: 4px solid #ef4444;
}

.cn-notify-toast--error .cn-notify-toast-icon {
    color: #fca5a5;
}

.cn-notify-toast--warning {
    background: #78350f;
    border-left: 4px solid #f59e0b;
}

.cn-notify-toast--warning .cn-notify-toast-icon {
    color: #fcd34d;
}

.cn-notify-toast--info {
    background: #1e3a8a;
    border-left: 4px solid #3b82f6;
}

.cn-notify-toast--info .cn-notify-toast-icon {
    color: #93c5fd;
}

/* ── Mobile toast positioning ─────────────────────────────────────── */
@media (max-width: 600px) {
    .cn-notify-toasts {
        bottom: 0.75rem;
        right: 0.75rem;
        left: 0.75rem;
        max-width: none;
    }

    .cn-notify-toast {
        min-width: 0;
        max-width: none;
        width: 100%;
        font-size: 0.85rem;
        /* Slide in from below on mobile */
        transform: translateY(20px);
    }

    .cn-notify-toast--visible {
        transform: translateY(0);
    }
}

/* ── Confirm overlay ──────────────────────────────────────────────── */
.cn-notify-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    /* Slightly lighter than pure black — feels modern, less heavy */
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.18s ease;
    /* iOS safe-area for the modal padding */
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.cn-notify-confirm-overlay--visible {
    opacity: 1;
}

/* ── Confirm dialog ───────────────────────────────────────────────── */
.cn-notify-confirm {
    background: #fff;
    border-radius: 14px;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 10px 20px rgba(0, 0, 0, 0.10);
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    transform: scale(0.96);
    transition: transform 0.18s ease;
}

.cn-notify-confirm-overlay--visible .cn-notify-confirm {
    transform: scale(1);
}

.cn-notify-confirm-title {
    margin: 0 0 0.625rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.3;
}

.cn-notify-confirm-message {
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    color: #4a5568;
    line-height: 1.5;
}

.cn-notify-confirm-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.cn-notify-confirm-cancel,
.cn-notify-confirm-ok {
    /* 44px floor — Apple HIG / Material */
    min-height: 44px;
    padding: 0.625rem 1.125rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
    border: 1px solid transparent;
}

.cn-notify-confirm-cancel {
    background: #fff;
    border-color: #e2e8f0;
    color: #4a5568;
}

.cn-notify-confirm-cancel:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    color: #1a202c;
}

.cn-notify-confirm-cancel:focus-visible {
    outline: 2px solid #94a3b8;
    outline-offset: 2px;
}

.cn-notify-confirm-ok {
    background: var(--cn-primary-btn, #0073aa);
    border-color: var(--cn-primary-btn, #0073aa);
    color: #fff;
}

.cn-notify-confirm-ok:hover {
    background: var(--cn-primary-btn-hover, #005d8c);
    border-color: var(--cn-primary-btn-hover, #005d8c);
}

.cn-notify-confirm-ok:focus-visible {
    outline: 2px solid var(--cn-primary-btn, #0073aa);
    outline-offset: 2px;
}

.cn-notify-confirm-ok:active {
    transform: translateY(1px);
}

/* Dangerous variant — red confirm button (Remove, Delete, etc.) */
.cn-notify-confirm-ok--danger {
    background: #dc2626;
    border-color: #dc2626;
}

.cn-notify-confirm-ok--danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.cn-notify-confirm-ok--danger:focus-visible {
    outline-color: #dc2626;
}

/* ── Mobile confirm sizing ────────────────────────────────────────── */
@media (max-width: 480px) {
    .cn-notify-confirm {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .cn-notify-confirm-title {
        font-size: 1.05rem;
    }

    .cn-notify-confirm-actions {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .cn-notify-confirm-cancel,
    .cn-notify-confirm-ok {
        width: 100%;
    }
}

/* Reduced motion — kill the slide/scale animations */
@media (prefers-reduced-motion: reduce) {
    .cn-notify-toast,
    .cn-notify-confirm-overlay,
    .cn-notify-confirm {
        transition: none;
    }
}
