/* ------------------------------------------------------------------
   Support tickets (Contact page)
   ------------------------------------------------------------------ */

.support-tickets {
    --st-accent: var(--vr-theme-color, #0f9d76);
    --st-border: var(--vr-gray-200, #e5e7eb);
    --st-surface: var(--vr-gray-50, #f9fafb);
    --st-muted: var(--vr-gray-500, #6b7280);
    --st-staff-bg: color-mix(in srgb, var(--st-accent) 8%, transparent);
    margin-bottom: 2.5rem;
}

[data-bs-theme="dark"] .support-tickets {
    --st-border: var(--vr-gray-700, #374151);
    --st-surface: rgba(255, 255, 255, .04);
    --st-muted: var(--vr-gray-400, #9ca3af);
    --st-staff-bg: color-mix(in srgb, var(--st-accent) 16%, transparent);
}

.support-tickets .st-card {
    border: 1px solid var(--st-border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.support-tickets .st-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

.support-tickets .st-head h2,
.support-tickets .st-head h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.support-tickets .st-muted {
    color: var(--st-muted);
    font-size: .875rem;
}

.support-tickets .form-label {
    font-weight: 600;
    font-size: .875rem;
    margin-bottom: .35rem;
}

.support-tickets textarea.form-control {
    min-height: 140px;
}

/* --- Ticket list ---------------------------------------------------- */

.st-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.st-list li + li {
    border-top: 1px solid var(--st-border);
}

.st-list a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .85rem .25rem;
    color: inherit;
    text-decoration: none;
}

.st-list a:hover .st-subject {
    color: var(--st-accent);
}

.st-list .st-main {
    flex: 1;
    min-width: 0;
}

.st-list .st-subject {
    display: block;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.st-list li.is-active a {
    background: var(--st-surface);
    border-radius: 6px;
    padding-left: .75rem;
    padding-right: .75rem;
}

/* --- Status badges -------------------------------------------------- */

.st-badge {
    display: inline-block;
    flex-shrink: 0;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.st-badge.is-open {
    background: rgba(245, 158, 11, .15);
    color: #b45309;
}

.st-badge.is-answered {
    background: rgba(16, 185, 129, .15);
    color: #047857;
}

.st-badge.is-closed {
    background: rgba(107, 114, 128, .15);
    color: var(--st-muted);
}

[data-bs-theme="dark"] .st-badge.is-open { color: #fbbf24; }
[data-bs-theme="dark"] .st-badge.is-answered { color: #34d399; }

/* --- Thread --------------------------------------------------------- */

.st-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.st-msg {
    border: 1px solid var(--st-border);
    border-radius: 10px;
    padding: .9rem 1.1rem;
}

.st-msg.is-staff {
    background: var(--st-staff-bg);
    border-color: color-mix(in srgb, var(--st-accent) 35%, transparent);
}

.st-msg-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    font-size: .8rem;
    color: var(--st-muted);
    margin-bottom: .4rem;
}

.st-msg-meta strong {
    color: var(--vr-text-main, inherit);
}

.st-msg-body {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.st-login {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--st-surface);
}

@media (max-width: 575.98px) {
    .support-tickets .st-card {
        padding: 1rem;
    }
}

/* --- AI replies ----------------------------------------------------- */

.st-msg.is-ai {
    background: rgba(99, 102, 241, .07);
    border-color: rgba(99, 102, 241, .3);
}

[data-bs-theme="dark"] .st-msg.is-ai {
    background: rgba(129, 140, 248, .12);
}

.st-ai-tag {
    display: inline-block;
    padding: 0 .4rem;
    border-radius: 4px;
    background: #6366f1;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
}

.st-ai-note {
    margin-top: .6rem;
    padding-top: .5rem;
    border-top: 1px dashed rgba(99, 102, 241, .3);
    font-size: .8rem;
    color: var(--st-muted);
}

/* --- Live chat on a ticket ------------------------------------------ */

.st-banner {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-size: .875rem;
}

.st-banner.is-ai {
    background: rgba(99, 102, 241, .08);
    border: 1px solid rgba(99, 102, 241, .25);
}

.st-banner.is-team {
    background: rgba(16, 185, 129, .08);
    border: 1px solid rgba(16, 185, 129, .25);
}

.st-thread .st-banner {
    margin-bottom: 0;
}

.st-msg.is-member {
    margin-left: 12%;
}

.st-msg.is-staff {
    margin-right: 12%;
}

.st-dots {
    display: flex;
    gap: 4px;
    padding: .35rem 0 .1rem;
}

.st-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6366f1;
    opacity: .35;
    animation: st-blink 1.2s infinite ease-in-out;
}

.st-dots span:nth-child(2) { animation-delay: .2s; }
.st-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes st-blink {
    0%, 80%, 100% { opacity: .35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    .st-dots span { animation: none; opacity: .7; }
}

@media (max-width: 575.98px) {
    .st-msg.is-member { margin-left: 6%; }
    .st-msg.is-staff { margin-right: 6%; }
}
