/* TRADEJOUR UI FEEDBACK SYSTEM V1 */

.tj-feedback-root[hidden] {
    display: none !important;
}

.tj-feedback-root {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
}

.tj-feedback-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 8, 16, 0.76);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.tj-feedback-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    box-sizing: border-box;
    padding: 28px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 22px;
    background:
        linear-gradient(
            145deg,
            rgba(23, 32, 48, 0.98),
            rgba(10, 16, 27, 0.99)
        );
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.48),
        inset 0 1px 0 rgba(255, 255, 255, 0.035);
    color: #f8fafc;
    animation: tj-feedback-in 160ms ease-out;
}

@keyframes tj-feedback-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tj-feedback-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.tj-feedback-close:hover {
    background: rgba(148, 163, 184, 0.08);
    color: #e2e8f0;
}

.tj-feedback-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 20px;
    border-radius: 15px;
    background: rgba(59, 130, 246, 0.13);
    border: 1px solid rgba(96, 165, 250, 0.24);
    color: #93c5fd;
    font-size: 22px;
    font-weight: 800;
}

.tj-feedback-root[data-tone="danger"] .tj-feedback-icon,
.tj-feedback-root[data-tone="error"] .tj-feedback-icon {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(248, 113, 113, 0.23);
    color: #fca5a5;
}

.tj-feedback-root[data-tone="success"] .tj-feedback-icon {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(74, 222, 128, 0.23);
    color: #86efac;
}

.tj-feedback-eyebrow {
    margin-bottom: 7px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.tj-feedback-copy h2 {
    margin: 0;
    color: #f8fafc;
    font-size: clamp(22px, 4vw, 28px);
    line-height: 1.2;
}

.tj-feedback-copy p {
    margin: 12px 0 0;
    color: #aeb9ca;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-line;
}

.tj-feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 28px;
}

.tj-feedback-button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform 120ms ease,
        border-color 120ms ease,
        background 120ms ease;
}

.tj-feedback-button:hover {
    transform: translateY(-1px);
}

.tj-feedback-button-secondary {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.06);
    color: #cbd5e1;
}

.tj-feedback-button-primary {
    border: 1px solid rgba(96, 165, 250, 0.25);
    background: #2563eb;
    color: #ffffff;
}

.tj-feedback-root[data-tone="danger"]
.tj-feedback-button-primary,

.tj-feedback-root[data-tone="error"]
.tj-feedback-button-primary {
    border-color: rgba(248, 113, 113, 0.25);
    background: #dc2626;
}

body.tj-feedback-lock {
    overflow: hidden;
}


/* ============================================
   FIELD VALIDATION
   ============================================ */

.tj-field-invalid input,
.tj-field-invalid select,
.tj-field-invalid textarea,
.tj-field-control-invalid {
    border-color: rgba(248, 113, 113, 0.82) !important;
    box-shadow:
        0 0 0 3px rgba(239, 68, 68, 0.09) !important;
}

.tj-field-error {
    margin-top: 7px;
    color: #fca5a5;
    font-size: 12px;
    line-height: 1.4;
}


/* ============================================
   TOASTS
   ============================================ */

.tj-toast-stack {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10020;
    display: grid;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.tj-toast {
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    background: rgba(15, 23, 38, 0.97);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.32);
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.5;
    animation: tj-toast-in 160ms ease-out;
}

.tj-toast[data-tone="error"] {
    border-color: rgba(248, 113, 113, 0.25);
}

.tj-toast[data-tone="success"] {
    border-color: rgba(74, 222, 128, 0.25);
}

@keyframes tj-toast-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ============================================
   BRANDED ERROR PAGE
   ============================================ */

.tj-error-page {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 28px;
    box-sizing: border-box;
    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(37, 99, 235, 0.08),
            transparent 38%
        ),
        #080d15;
    color: #f8fafc;
}

.tj-error-shell {
    width: min(100%, 620px);
    text-align: center;
}

.tj-error-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.tj-error-brand img {
    width: 32px;
    height: 32px;
}

.tj-error-code {
    margin-bottom: 10px;
    color: #475569;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.tj-error-shell h1 {
    margin: 0;
    font-size: clamp(34px, 8vw, 58px);
    line-height: 1.08;
}

.tj-error-shell > p {
    max-width: 520px;
    margin: 20px auto 0;
    color: #94a3b8;
    font-size: 15px;
    line-height: 1.7;
}

.tj-error-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}

.tj-error-action {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    box-sizing: border-box;
    border-radius: 12px;
    text-decoration: none;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.tj-error-action-primary {
    border: 1px solid rgba(96, 165, 250, 0.24);
    background: #2563eb;
    color: #ffffff;
}

.tj-error-action-secondary {
    border: 1px solid rgba(148, 163, 184, 0.17);
    background: rgba(148, 163, 184, 0.05);
    color: #cbd5e1;
}

@media (max-width: 560px) {
    .tj-feedback-root {
        align-items: end;
        padding: 12px;
    }

    .tj-feedback-dialog {
        width: 100%;
        padding: 24px 20px 20px;
        border-radius: 20px;
    }

    .tj-feedback-actions {
        flex-direction: column-reverse;
    }

    .tj-feedback-button {
        width: 100%;
    }

    .tj-toast-stack {
        top: 16px;
        right: 16px;
    }
}


/* ============================================
   R-6d: LIQUID GLASS (dialog, toasts, error page)
   Falls back to dark tokens when tj_design.css is not loaded.
   ============================================ */

.tj-feedback-backdrop {
    background: rgba(3, 5, 7, 0.62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.tj-feedback-dialog {
    border: 1px solid var(--tjd-glass-border, rgba(255, 255, 255, 0.09));
    border-radius: var(--tjd-r-lg, 22px);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.015) 46%, rgba(57, 240, 162, 0.035)),
        var(--tjd-glass-bg-strong, rgba(14, 18, 22, 0.78));
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 var(--tjd-glass-hi, rgba(255, 255, 255, 0.16)),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(var(--tjd-blur, 22px)) saturate(var(--tjd-saturate, 1.7));
    -webkit-backdrop-filter: blur(var(--tjd-blur, 22px)) saturate(var(--tjd-saturate, 1.7));
    color: var(--tjd-text, #eef2f6);
}

.tj-feedback-icon {
    border-radius: 14px;
    background: var(--tjd-green-tint, rgba(57, 240, 162, 0.1));
    border-color: var(--tjd-green-line, rgba(93, 255, 196, 0.38));
    color: var(--tjd-neon, #5dffc4);
    box-shadow: 0 0 24px -6px var(--tjd-glow, rgba(57, 240, 162, 0.45));
}

.tj-feedback-root[data-tone="danger"] .tj-feedback-icon,
.tj-feedback-root[data-tone="error"] .tj-feedback-icon {
    background: var(--tjd-red-tint, rgba(255, 92, 117, 0.12));
    border-color: rgba(255, 92, 117, 0.4);
    color: var(--tjd-loss, #ff5c75);
    box-shadow: 0 0 24px -6px rgba(255, 92, 117, 0.5);
}

.tj-feedback-root[data-tone="success"] .tj-feedback-icon {
    background: var(--tjd-green-tint, rgba(57, 240, 162, 0.1));
    border-color: var(--tjd-green-line, rgba(93, 255, 196, 0.38));
    color: var(--tjd-neon, #5dffc4);
}

.tj-feedback-eyebrow { color: var(--tjd-neon, #5dffc4); opacity: 0.85; }
.tj-feedback-copy h2 { color: var(--tjd-text, #eef2f6); }
.tj-feedback-copy p { color: var(--tjd-muted, #9ba2ad); }

.tj-feedback-close { color: var(--tjd-muted, #9ba2ad); }
.tj-feedback-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--tjd-text, #eef2f6); }

.tj-feedback-button { border-radius: var(--tjd-r-sm, 12px); }

.tj-feedback-button-secondary {
    border: 1px solid var(--tjd-glass-border, rgba(255, 255, 255, 0.09));
    background: rgba(255, 255, 255, 0.055);
    color: var(--tjd-text-soft, #c7cdd5);
}

.tj-feedback-button-secondary:hover {
    border-color: var(--tjd-glass-border-hot, rgba(93, 255, 196, 0.34));
    background: var(--tjd-green-tint, rgba(57, 240, 162, 0.1));
}

.tj-feedback-button-primary {
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--tjd-neon, #5dffc4), #2fe39a 55%, var(--tjd-green-deep, #11b77d));
    box-shadow: 0 8px 24px -8px var(--tjd-glow, rgba(57, 240, 162, 0.45)), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    color: #04130c;
}

.tj-feedback-root[data-tone="danger"] .tj-feedback-button-primary,
.tj-feedback-root[data-tone="error"] .tj-feedback-button-primary {
    border-color: rgba(255, 92, 117, 0.45);
    background: linear-gradient(135deg, #ff7a8e, var(--tjd-loss, #ff5c75));
    box-shadow: 0 8px 24px -8px rgba(255, 92, 117, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: #1a0509;
}

.tj-field-invalid input,
.tj-field-invalid select,
.tj-field-invalid textarea,
.tj-field-control-invalid {
    border-color: rgba(255, 92, 117, 0.85) !important;
    box-shadow: 0 0 0 3px rgba(255, 92, 117, 0.12) !important;
}

.tj-field-error { color: var(--tjd-loss, #ff5c75); }

.tj-toast {
    position: relative;
    padding: 14px 16px 14px 18px;
    border: 1px solid var(--tjd-glass-border, rgba(255, 255, 255, 0.09));
    border-radius: var(--tjd-r-md, 16px);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.015) 50%),
        var(--tjd-glass-bg-strong, rgba(14, 18, 22, 0.78));
    box-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.62), inset 0 1px 0 var(--tjd-glass-hi, rgba(255, 255, 255, 0.16));
    backdrop-filter: blur(var(--tjd-blur, 22px)) saturate(var(--tjd-saturate, 1.7));
    -webkit-backdrop-filter: blur(var(--tjd-blur, 22px)) saturate(var(--tjd-saturate, 1.7));
    color: var(--tjd-text, #eef2f6);
    overflow: hidden;
    animation: tj-toast-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* tone stripe on the left edge */
.tj-toast::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--tjd-neon, #5dffc4);
    box-shadow: 0 0 12px var(--tjd-glow, rgba(57, 240, 162, 0.45));
}

.tj-toast[data-tone="error"] { border-color: rgba(255, 92, 117, 0.35); }
.tj-toast[data-tone="error"]::before { background: var(--tjd-loss, #ff5c75); box-shadow: 0 0 12px rgba(255, 92, 117, 0.5); }
.tj-toast[data-tone="success"] { border-color: var(--tjd-green-line, rgba(93, 255, 196, 0.38)); }

/* error page */
.tj-error-page {
    background: var(--tjd-bg-deep, #07090c);
    color: var(--tjd-text, #eef2f6);
}

@media (max-width: 760px) {
    .tj-feedback-dialog,
    .tj-toast {
        backdrop-filter: blur(12px) saturate(1.4);
        -webkit-backdrop-filter: blur(12px) saturate(1.4);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tj-feedback-dialog,
    .tj-toast { animation: none; }
}
