/* Jazital Support Ticket — front-end portal & forms */

.jst-portal,
.jst-form-wrap,
.jst-dashboard,
.jst-gate-wrap {
    --jst-primary: #2563eb;
    --jst-primary-dark: #1d4ed8;
    --jst-bg: #f8fafc;
    --jst-border: #e5e7eb;
    --jst-text: #1f2937;
    --jst-muted: #6b7280;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--jst-text);
    max-width: 980px;
    margin: 0 auto;
}

/* Smooth, modern motion */
@keyframes jstFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes jstPop { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.jst-portal .jst-msg, .jst-portal .jst-side-card, .jst-dashboard .jst-ticket-table, .jst-form-wrap > * { animation: jstFadeUp .35s ease both; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Buttons */
.jst-btn,
.jst-submit-btn {
    display: inline-block;
    background: var(--jst-primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
}
.jst-btn:hover, .jst-submit-btn:hover { background: var(--jst-primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37,99,235,.22); }
.jst-btn:active, .jst-submit-btn:active { transform: translateY(0); }
.jst-btn-sm { padding: 6px 12px; font-size: 13px; }
.jst-btn-ghost {
    display: inline-block;
    background: #fff;
    color: var(--jst-text);
    border: 1px solid var(--jst-border);
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.jst-btn-ghost:hover { background: var(--jst-bg); }

/* Alerts */
.jst-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.jst-alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.jst-alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Badges & pills */
.jst-badge,
.jst-pill {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--jst-muted);
    line-height: 1.4;
}
.jst-priority-high { background: #ef4444 !important; }
.jst-priority-medium { background: #f97316 !important; }
.jst-priority-low { background: #3b82f6 !important; }
.jst-badge-internal {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

/* Forms */
.jst-form-group { margin-bottom: 16px; }
.jst-form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.jst-form-row .jst-form-group { flex: 1; min-width: 200px; }
.jst-form-group label,
.jst-field label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
}
.jst-required { color: #ef4444; }
.jst-form-wrap input[type=text],
.jst-form-wrap input[type=email],
.jst-form-wrap input[type=url],
.jst-form-wrap input[type=number],
.jst-form-wrap input[type=date],
.jst-form-wrap select,
.jst-form-wrap textarea,
.jst-field input,
.jst-field select,
.jst-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--jst-border);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}
.jst-field { margin-bottom: 16px; }
.jst-radio-group label,
.jst-checkbox-group label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0 12px 6px 0; }
.jst-radio-group input,
.jst-checkbox-group input { width: auto; }

/* Uploader */
.jst-uploader { margin: 12px 0; }
.jst-upload-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.jst-upload-item {
    display: flex; align-items: center; gap: 8px;
    background: var(--jst-bg); border: 1px solid var(--jst-border);
    border-radius: 6px; padding: 6px 10px; font-size: 13px;
}
.jst-upload-item button { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 16px; }

/* Portal layout */
.jst-portal-head { margin-bottom: 20px; }
.jst-portal-title { margin: 0 0 10px; font-size: 24px; line-height: 1.3; }
.jst-portal-title .jst-ticket-no { color: var(--jst-muted); font-weight: 600; margin-right: 8px; }
.jst-portal-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.jst-portal-date { color: var(--jst-muted); font-size: 13px; }
.jst-portal-grid { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
@media (max-width: 768px) { .jst-portal-grid { grid-template-columns: 1fr; } }

/* Messages */
.jst-msg {
    background: #fff;
    border: 1px solid var(--jst-border);
    border-radius: 4px;
    padding: 16px 18px;
    margin-bottom: 14px;
}
.jst-msg-agent { border-left: 3px solid var(--jst-primary); }
.jst-msg-customer { border-left: 3px solid #10b981; }
.jst-msg-internal { background: #fffbeb; border-left: 3px solid #f59e0b; }
.jst-msg-system { background: var(--jst-bg); border-style: dashed; font-size: 13px; }
.jst-msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.jst-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--jst-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}
.jst-msg-date { color: var(--jst-muted); font-size: 12px; margin-left: auto; }
.jst-msg-body { font-size: 14px; line-height: 1.65; }
.jst-msg-body p:first-child { margin-top: 0; }
.jst-msg-body p:last-child { margin-bottom: 0; }
.jst-attach {
    display: inline-flex; align-items: center; gap: 4px;
    margin-top: 10px; padding: 5px 10px;
    background: var(--jst-bg); border-radius: 6px;
    font-size: 13px; text-decoration: none; color: var(--jst-primary);
}

/* Thread load-more + original message */
.jst-load-more {
    display: block; width: 100%; margin: 4px 0 14px;
    padding: 9px; border: 1px dashed var(--jst-border); border-radius: 8px;
    background: var(--jst-bg); color: var(--jst-muted);
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.jst-load-more:hover { background: #eef2ff; color: var(--jst-primary); border-color: #c7d2fe; }
.jst-original { border-style: dashed; }
.jst-msg-tag { background: #eef2ff; color: #3730a3; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }

/* Reply form */
.jst-reply-form, .jst-csat { background: #fff; border: 1px solid var(--jst-border); border-radius: 12px; padding: 18px; margin-top: 18px; }
.jst-reply-form h3, .jst-csat h3 { margin: 0 0 14px; font-size: 16px; }
.jst-internal-toggle { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 13px; color: #92400e; }

/* CSAT stars */
.jst-stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; margin-bottom: 12px; }
.jst-stars input { display: none; }
.jst-stars label { font-size: 30px; color: #d1d5db; cursor: pointer; transition: color .1s; }
.jst-stars input:checked ~ label,
.jst-stars label:hover,
.jst-stars label:hover ~ label { color: #fbbf24; }
.jst-csat textarea { width: 100%; padding: 10px; border: 1px solid var(--jst-border); border-radius: 8px; margin-bottom: 12px; box-sizing: border-box; }
.jst-csat-done { background: #ecfdf5; color: #065f46; padding: 12px 16px; border-radius: 8px; margin-top: 16px; font-weight: 600; }

/* Sidebar */
.jst-side-card { background: #fff; border: 1px solid var(--jst-border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.jst-side-card h4 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--jst-muted); }
.jst-side-card ul { list-style: none; margin: 0; padding: 0; }
.jst-side-card li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; border-bottom: 1px solid #f1f5f9; }
.jst-side-card li:last-child { border-bottom: none; }
.jst-side-card li span { color: var(--jst-muted); }

/* Dashboard */
.jst-dash-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.jst-filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    background: var(--jst-bg); padding: 12px 14px; border-radius: 10px; margin-bottom: 18px;
}
.jst-filter-bar select, .jst-filter-bar input { padding: 8px 10px; border: 1px solid var(--jst-border); border-radius: 8px; font-size: 14px; }
.jst-ticket-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.jst-ticket-table th, .jst-ticket-table td { padding: 13px 14px; text-align: left; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.jst-ticket-table thead { background: var(--jst-bg); }
.jst-ticket-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--jst-muted); }
.jst-ticket-table tbody tr:hover { background: #fafbfc; }
.jst-empty { padding: 40px; text-align: center; color: var(--jst-muted); background: var(--jst-bg); border-radius: 12px; }
.jst-pagination { margin-top: 18px; text-align: center; }
.jst-pagination .page-numbers { padding: 7px 12px; margin: 0 3px; border-radius: 8px; background: var(--jst-bg); text-decoration: none; color: var(--jst-text); }
.jst-pagination .current { background: var(--jst-primary); color: #fff; }

.jst-portal-denied { padding: 40px; text-align: center; background: var(--jst-bg); border-radius: 12px; color: var(--jst-muted); }

/* ---- Modern polish ---- */
.jst-btn-ghost { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease; }
.jst-btn-ghost:hover { transform: translateY(-1px); border-color: var(--jst-primary); color: var(--jst-primary); }
.jst-side-card { transition: box-shadow .2s ease, transform .2s ease; }
.jst-side-card:hover { box-shadow: 0 6px 22px rgba(2,6,23,.06); }
.jst-form-wrap input[type=text]:focus,
.jst-form-wrap input[type=email]:focus,
.jst-form-wrap input[type=url]:focus,
.jst-form-wrap input[type=number]:focus,
.jst-form-wrap input[type=date]:focus,
.jst-form-wrap select:focus,
.jst-form-wrap textarea:focus,
.jst-field input:focus, .jst-field select:focus, .jst-field textarea:focus,
.jst-cc-input:focus, .jst-mention-search:focus, .jst-filter-bar input:focus, .jst-filter-bar select:focus {
    outline: none;
    border-color: var(--jst-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--jst-primary) 20%, transparent);
}
.jst-pill, .jst-badge { transition: transform .12s ease; }
.jst-mode-btn { transition: background .15s ease, color .15s ease; }
.jst-pg, .jst-load-more, .jst-mention-opt, .jst-chip { transition: background .15s ease, color .15s ease, border-color .15s ease; }
.jst-status-badge, .jst-detail-status, .jst-priority-badge { transition: background .25s ease, color .25s ease; }
.jst-msg-body img { max-width: 100%; height: auto; border-radius: 8px; }

/* Agent controls */
.jst-agent-controls { background: #f9fafb; border-color: #dbe2ea; }
.jst-ctl-label { display: block; font-size: 12px; font-weight: 600; color: var(--jst-muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.jst-agent-controls select.jst-ctl { width: 100%; padding: 8px 10px; border: 1px solid var(--jst-border); border-radius: 8px; font-size: 14px; background: #fff; }
.jst-ctl-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }

/* Due-date control */
.jst-due-control { display: block; }
.jst-due-control .jst-due-date {
    width: 100%; padding: 8px 10px; border: 1px solid var(--jst-border);
    border-radius: 8px; font-size: 14px; background: #fff; box-sizing: border-box;
    font-family: inherit; color: var(--jst-text);
}
.jst-due-time { display: flex; align-items: center; gap: 5px; margin-top: 7px; }
.jst-due-time select {
    flex: 1; min-width: 0; padding: 7px 6px; border: 1px solid var(--jst-border);
    border-radius: 8px; font-size: 14px; background: #fff; color: var(--jst-text);
}
.jst-due-time .jst-due-ampm { flex: 0 0 auto; }
.jst-due-colon { color: var(--jst-muted); font-weight: 600; }

/* Reply form polish */
.jst-reply-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.jst-reply-head h3 { margin: 0; }
.jst-reply-mode { display: inline-flex; background: var(--jst-bg); border-radius: 8px; padding: 3px; }
.jst-mode-btn { background: transparent; border: none; padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--jst-muted); }
.jst-mode-btn.active { background: var(--jst-primary); color: #fff; }
.jst-reply-form.jst-is-internal { background: #fffbeb; border-color: #fde68a; }
.jst-canned-picker { margin-bottom: 10px; padding: 8px 10px; border: 1px solid var(--jst-border); border-radius: 8px; font-size: 14px; max-width: 280px; }
.jst-reply-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.jst-reply-spinner { color: var(--jst-muted); }

/* Mention picker */
.jst-mention-picker { margin-top: 14px; }
.jst-mention-picker > label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 6px; }
.jst-mention-box { position: relative; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--jst-border); border-radius: 8px; padding: 6px 8px; background: #fff; }
.jst-mention-search { border: none !important; outline: none; flex: 1; min-width: 120px; padding: 4px !important; font-size: 14px; }
.jst-chip { display: inline-flex; align-items: center; gap: 6px; background: #eef2ff; color: #3730a3; border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; }
.jst-chip-x { background: none; border: none; color: #6366f1; cursor: pointer; font-size: 13px; padding: 0; }
.jst-mention-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--jst-border); border-radius: 8px; margin-top: 4px; box-shadow: 0 4px 16px rgba(0,0,0,.1); z-index: 20; max-height: 220px; overflow-y: auto; }
.jst-mention-opt { padding: 8px 12px; cursor: pointer; font-size: 14px; }
.jst-mention-opt:hover { background: var(--jst-bg); }
.jst-mention-opt small { color: var(--jst-muted); }
.jst-hint { display: block; margin-top: 6px; color: var(--jst-muted); font-size: 12px; }
.jst-msg-mentions { margin-top: 8px; font-size: 12px; color: #6d28d9; background: #f5f3ff; display: inline-block; padding: 2px 8px; border-radius: 5px; }
.jst-flash { transition: opacity .3s; }

/* Password gate */
.jst-gate-wrap { display: flex; justify-content: center; }
.jst-gate { background: #fff; border: 1px solid var(--jst-border); border-radius: 14px; padding: 32px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,.05); }
.jst-gate-icon { font-size: 34px; margin-bottom: 8px; }
.jst-gate h2 { margin: 0 0 6px; font-size: 20px; }
.jst-gate-sub { color: var(--jst-muted); font-size: 14px; margin: 0 0 18px; }
.jst-gate-form { display: flex; gap: 8px; margin-bottom: 12px; }
.jst-gate-form input[type=password] { flex: 1; padding: 10px 12px; border: 1px solid var(--jst-border); border-radius: 8px; font-size: 15px; letter-spacing: 2px; box-sizing: border-box; }
.jst-link-btn { background: none; border: none; color: var(--jst-primary); cursor: pointer; font-size: 13px; text-decoration: underline; }
.jst-pw-send-btn { width: 100%; margin-top: 8px; }

/* CC field (hidden in internal-note mode) */
.jst-cc-field { margin-top: 14px; }
.jst-cc-field > label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 6px; }
.jst-cc-input { width: 100%; padding: 9px 12px; border: 1px solid var(--jst-border); border-radius: 8px; font-size: 14px; box-sizing: border-box; }
.jst-reply-form.jst-is-internal .jst-reply-public-only { display: none; }

/* Activity log card */
.jst-activity .jst-log { list-style: none; margin: 0; padding: 0; }
.jst-log-item { padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; line-height: 1.4; }
.jst-log-item:last-child { border-bottom: none; }
.jst-log-text { display: block; color: var(--jst-text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.jst-log-when { display: block; color: var(--jst-muted); font-size: 11px; margin-top: 2px; }
.jst-log-empty { color: var(--jst-muted); font-size: 13px; padding: 6px 0; }
.jst-log-pager { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; align-items: center; }
.jst-pg {
    min-width: 26px; height: 26px; padding: 0 6px;
    border: 1px solid var(--jst-border); background: #fff; color: var(--jst-text);
    border-radius: 6px; font-size: 12px; line-height: 1; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.jst-pg:hover:not(:disabled):not(.active) { background: var(--jst-bg); }
.jst-pg.active { background: var(--jst-primary); color: #fff; border-color: var(--jst-primary); font-weight: 600; }
.jst-pg:disabled { opacity: .4; cursor: default; }

/* Relative time + due badges */
.jst-rel { border-bottom: 1px dotted #cbd5e1; cursor: help; }
.jst-due { font-weight: 600; cursor: help; }
.jst-due-over { color: #dc2626; }
.jst-due-ok { color: #16a34a; }
.jst-detail-due .jst-due { font-weight: 600; }

/* Agent custom-fields card */
.jst-cf-card .jst-field { margin-bottom: 12px; }
.jst-cf-card .jst-field label { font-size: 12px; font-weight: 600; }
.jst-cf-card .jst-field input, .jst-cf-card .jst-field select, .jst-cf-card .jst-field textarea { padding: 8px 10px; font-size: 14px; }
.jst-cf-card .jst-cf-save { margin-top: 4px; }
.jst-cf-card .jst-cf-saved { margin-left: 8px; }
