/* ==========================================================================
   Content protection - intentionally scoped to cp-* classes and data-cp-*
   hooks so it can never leak into admin, forms or unrelated components.
   Deterrent only: DevTools, screenshots and source access are not blocked.
   ========================================================================== */

/* Protected images: no casual dragging / long-press save menu. */
[data-cp-protect] img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    -webkit-touch-callout: none;
}

/* Selection disabled only on specifically protected blocks. */
[data-cp-protect] table,
[data-cp-protect] .chart-table-wrapper,
[data-cp-protect] .board-cards,
[data-cp-noselect] {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Optional transparent watermark overlay (opt-in via data-cp-watermark). */
[data-cp-watermark] {
    position: relative;
}

[data-cp-watermark]::after {
    content: attr(data-cp-watermark);
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0 8px;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .16em;
    font: inherit;
    font-size: clamp(14px, 3.2vw, 36px);
    font-weight: 700;
    line-height: 1;
    color: rgba(17, 24, 39, .07);
    transform: rotate(-24deg);
}

/* --------------------------------------------------------------------------
   Warning toast
   -------------------------------------------------------------------------- */
.cp-toast {
    position: fixed;
    top: 16px;
    right: 16px;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    z-index: 10050;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: min(390px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 14px 12px 14px 14px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 14px;
    background: linear-gradient(158deg, #1d222b 0%, #111419 72%);
    color: #fff;
    text-align: left;
    direction: ltr;
    font-family: inherit;
    line-height: 1.5;
    box-shadow:
        0 18px 48px rgba(9, 12, 17, .38),
        inset 0 1px 0 rgba(255, 255, 255, .06);
    will-change: transform, opacity;
}

.cp-toast[hidden] {
    display: none;
}

.cp-toast.is-visible {
    animation: cp-toast-in .32s cubic-bezier(.22, .9, .3, 1) both;
}

.cp-toast.is-leaving {
    animation: cp-toast-out .2s ease-in both;
}

.cp-toast__icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-top: 1px;
    border: 1px solid rgba(255, 196, 92, .3);
    border-radius: 50%;
    background: rgba(255, 178, 58, .13);
    color: #ffc861;
}

.cp-toast__icon svg {
    display: block;
}

.cp-toast__body {
    flex: 1 1 auto;
    min-width: 0;
}

.cp-toast__title {
    display: block;
    margin-bottom: 3px;
    color: #ffd28a;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: .085em;
    text-transform: uppercase;
}

.cp-toast__text {
    margin: 0;
    color: rgba(255, 255, 255, .84);
    font-size: 13px;
    line-height: 1.45;
}

.cp-toast__mark {
    display: block;
    margin-top: 6px;
    color: rgba(255, 255, 255, .48);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
}

.cp-toast__close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, .48);
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.cp-toast__close:hover,
.cp-toast__close:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, .1);
    outline: none;
}

.cp-toast__close:focus-visible {
    box-shadow: 0 0 0 2px rgba(255, 210, 138, .55);
}

@keyframes cp-toast-in {
    from {
        opacity: 0;
        transform: translateY(-14px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cp-toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-8px) scale(.98);
    }
}

/* Mobile: bottom sheet-style toast, full width, safe-area aware. */
@media (max-width: 640px) {
    .cp-toast {
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        width: auto;
        padding: 14px 12px 14px 14px;
    }

    .cp-toast.is-visible {
        animation-name: cp-toast-in-mobile;
    }

    .cp-toast.is-leaving {
        animation-name: cp-toast-out-mobile;
    }
}

@keyframes cp-toast-in-mobile {
    from {
        opacity: 0;
        transform: translateY(22px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cp-toast-out-mobile {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(14px) scale(.98);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cp-toast.is-visible,
    .cp-toast.is-leaving {
        animation-duration: .01ms;
    }
}

@media print {
    .cp-toast,
    [data-cp-watermark]::after {
        display: none !important;
    }
}
