/* =============================================================================
   Jastip Helpdesk — Styles
   ============================================================================= */

/* ── Wrap & card ─────────────────────────────────────────────────────────── */
.jastip-hd-wrap        { max-width:1100px;margin:0 auto;padding:0 16px 60px;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#2b2b2b; }
.jastip-hd-card        { background:#fff;border:1px solid #dee2e6;border-radius:8px;padding:20px;margin-bottom:16px;box-shadow:0 2px 8px rgba(0,0,0,.06); }
.jastip-hd-header      { display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:20px; }
.jastip-hd-header h2   { margin:0; }
.jastip-hd-subtitle    { color:#6c757d;font-size:14px;margin-top:4px; }
.jastip-hd-filters     { display:flex;gap:10px;flex-wrap:wrap;margin-bottom:16px; }
.jastip-hd-breadcrumb  { margin-bottom:16px;font-size:14px; }
.jastip-hd-breadcrumb a{ color:#2d6a4f;text-decoration:none;font-weight:600; }
.jastip-hd-breadcrumb a:hover{ text-decoration:underline; }
.jastip-hd-loading     { text-align:center;padding:40px;color:#6c757d; }
.jastip-hd-spinner     { display:inline-block;width:20px;height:20px;border:3px solid #dee2e6;border-top-color:#2d6a4f;border-radius:50%;animation:jastip-spin .8s linear infinite;vertical-align:middle;margin-right:6px; }
@keyframes jastip-spin  { to{transform:rotate(360deg);} }

/* ── Portal ──────────────────────────────────────────────────────────────── */
.jastip-hd-hero        { text-align:center;padding:40px 20px;background:linear-gradient(135deg,#2d6a4f,#52b788);border-radius:12px;margin-bottom:28px;color:#fff; }
.jastip-hd-hero h1     { margin:0 0 8px;font-size:28px; }
.jastip-hd-hero p      { margin:0;opacity:.9; }
.jastip-hd-portal-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:20px;margin-bottom:40px; }
.jastip-hd-portal-card { background:#fff;border:1px solid #dee2e6;border-radius:10px;padding:24px;text-align:center;text-decoration:none;color:#2b2b2b;box-shadow:0 2px 8px rgba(0,0,0,.06);transition:box-shadow .2s,transform .2s;display:block; }
.jastip-hd-portal-card:hover{ box-shadow:0 6px 20px rgba(0,0,0,.12);transform:translateY(-3px);text-decoration:none;color:#2b2b2b; }
.jastip-hd-portal-icon { font-size:40px;display:block;margin-bottom:12px; }
.jastip-hd-portal-card h3{ margin:0 0 8px;color:#2d6a4f; }
.jastip-hd-portal-card p { margin:0;font-size:13px;color:#6c757d; }

/* FAQ */
.jastip-hd-faq         { margin-top:20px; }
.jastip-hd-faq h2      { margin-bottom:16px; }
.jastip-hd-faq-list    { display:flex;flex-direction:column;gap:8px; }
.jastip-hd-faq-item    { border:1px solid #dee2e6;border-radius:8px;overflow:hidden; }
.jastip-hd-faq-q       { width:100%;background:#f8f9fa;border:none;padding:14px 16px;text-align:left;font-size:14px;font-weight:600;cursor:pointer;display:flex;justify-content:space-between;align-items:center; }
.jastip-hd-faq-q:hover { background:#e9ecef; }
.jastip-hd-faq-arrow   { transition:transform .2s; }
.jastip-hd-faq-item.open .jastip-hd-faq-arrow{ transform:rotate(180deg); }
.jastip-hd-faq-a       { padding:14px 16px;font-size:14px;color:#495057;line-height:1.6;background:#fff; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.jastip-hd-badge       { display:inline-block;padding:3px 10px;border-radius:20px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em; }
.jastip-hd-status-open     { background:#d1ecf1;color:#0c5460; }
.jastip-hd-status-pending  { background:#fff3cd;color:#856404; }
.jastip-hd-status-on_hold  { background:#cce5ff;color:#004085; }
.jastip-hd-status-resolved { background:#d4edda;color:#155724; }
.jastip-hd-status-closed   { background:#e9ecef;color:#495057; }
.jastip-hd-priority-low    { background:#e9ecef;color:#495057; }
.jastip-hd-priority-medium { background:#cce5ff;color:#004085; }
.jastip-hd-priority-high   { background:#ffd9b3;color:#6d3a00; }
.jastip-hd-priority-urgent { background:#f8d7da;color:#721c24; }

/* ── Ticket list (customer) ──────────────────────────────────────────────── */
.jastip-hd-ticket-row  { background:#fff;border:1px solid #dee2e6;border-radius:8px;padding:16px;margin-bottom:10px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;cursor:pointer;transition:box-shadow .2s; }
.jastip-hd-ticket-row:hover{ box-shadow:0 4px 14px rgba(0,0,0,.1); }
.jastip-hd-ticket-row-left { flex:1;min-width:0; }
.jastip-hd-ticket-row-num  { font-size:12px;color:#6c757d;font-weight:600; }
.jastip-hd-ticket-row-subject{ font-size:15px;font-weight:700;margin:4px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.jastip-hd-ticket-row-meta { font-size:12px;color:#6c757d; }
.jastip-hd-ticket-row-right{ display:flex;gap:6px;align-items:center;flex-shrink:0; }
.jastip-hd-reply-count  { font-size:12px;color:#6c757d;background:#f8f9fa;padding:3px 8px;border-radius:12px; }

/* ── Ticket header ───────────────────────────────────────────────────────── */
.jastip-hd-ticket-header{ display:flex;align-items:flex-start;justify-content:space-between;flex-wrap:wrap;gap:12px;margin-bottom:20px;padding-bottom:16px;border-bottom:2px solid #dee2e6; }
.jastip-hd-ticket-number{ font-size:12px;color:#2d6a4f;font-weight:700;letter-spacing:.05em; }
.jastip-hd-ticket-subject{ margin:4px 0 0;font-size:20px; }
.jastip-hd-ticket-meta  { display:flex;gap:6px;align-items:center;flex-wrap:wrap; }
.jastip-hd-date         { font-size:12px;color:#6c757d; }

/* ── Thread ──────────────────────────────────────────────────────────────── */
.jastip-hd-thread       { display:flex;flex-direction:column;gap:16px;margin-bottom:24px; }
.jastip-hd-message      { display:flex;gap:12px;max-width:100%; }
.jastip-hd-message.customer{ flex-direction:row; }
.jastip-hd-message.agent   { flex-direction:row-reverse; }
.jastip-hd-message.system  { justify-content:center; }
.jastip-hd-msg-avatar   { width:36px;height:36px;border-radius:50%;background:#f8f9fa;display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0;border:2px solid #dee2e6; }
.jastip-hd-msg-body     { flex:1;max-width:78%; }
.jastip-hd-message.agent .jastip-hd-msg-body{ text-align:right; }
.jastip-hd-msg-meta     { font-size:12px;color:#6c757d;margin-bottom:4px;display:flex;gap:8px;flex-wrap:wrap;align-items:center; }
.jastip-hd-message.agent .jastip-hd-msg-meta{ justify-content:flex-end; }
.jastip-hd-msg-meta strong{ color:#2b2b2b;font-size:13px; }
.jastip-hd-msg-type     { background:#e9ecef;border-radius:4px;padding:1px 6px;font-size:10px;text-transform:uppercase; }
.jastip-hd-internal-tag { background:#fff3cd;color:#856404;border-radius:4px;padding:1px 6px;font-size:10px;font-weight:700; }
.jastip-hd-msg-text     { background:#f8f9fa;border-radius:8px;padding:12px 14px;font-size:14px;line-height:1.6; }
.jastip-hd-message.agent .jastip-hd-msg-text{ background:#d4edda;border-radius:8px 0 8px 8px; }
.jastip-hd-message.customer .jastip-hd-msg-text{ border-radius:0 8px 8px 8px; }
.jastip-hd-message.internal .jastip-hd-msg-text{ background:#fff8e1;border:1px dashed #f4a261; }
.system-note            { background:none;color:#6c757d;font-size:12px;font-style:italic;text-align:center;padding:4px 0; }

/* ── Reply box ───────────────────────────────────────────────────────────── */
.jastip-hd-reply-box    { margin-top:8px; }
.jastip-hd-reply-box h4 { margin:0 0 10px; }
.jastip-hd-reply-tabs   { display:flex;gap:0;border-bottom:2px solid #dee2e6;margin-bottom:14px; }
.jastip-hd-reply-tab    { background:none;border:none;padding:9px 16px;cursor:pointer;font-size:13px;font-weight:600;color:#6c757d;border-bottom:3px solid transparent;margin-bottom:-2px; }
.jastip-hd-reply-tab.active{ color:#2d6a4f;border-bottom-color:#2d6a4f; }
.jastip-hd-canned-picker{ margin-bottom:8px; }

/* ── Rating ──────────────────────────────────────────────────────────────── */
.jastip-hd-rate-box     { background:#fff8e1;border-color:#f4a261; }
.jastip-hd-rate-done    { background:#d4edda;border-color:#c3e6cb; }
.jastip-hd-stars        { display:flex;gap:6px;margin:12px 0; }
.jastip-hd-star         { background:none;border:none;font-size:32px;cursor:pointer;color:#dee2e6;transition:color .15s; }
.jastip-hd-star.selected,.jastip-hd-star:hover{ color:#f4a261; }
.jastip-hd-rating-display{ display:flex;gap:4px;align-items:center;margin:8px 0; }

/* ── Attachment ──────────────────────────────────────────────────────────── */
.jastip-hd-attachment   { display:flex;align-items:center;gap:6px;font-size:13px;color:#2d6a4f;text-decoration:none;padding:6px 0;border-bottom:1px solid #f8f9fa; }
.jastip-hd-attachment:hover{ text-decoration:underline; }
.jastip-hd-attachment small{ color:#6c757d; }

/* ── Agent two-panel layout ──────────────────────────────────────────────── */
.jastip-hd-agent-layout      { display:grid;grid-template-columns:340px 1fr;gap:20px;min-height:600px; }
.jastip-hd-ticket-list-panel { display:flex;flex-direction:column;gap:12px; }
.jastip-hd-list-toolbar      { display:flex;gap:8px; }
.jastip-hd-list              { display:flex;flex-direction:column;gap:8px;max-height:70vh;overflow-y:auto;padding-right:4px; }
.jastip-hd-list-item         { background:#fff;border:1px solid #dee2e6;border-radius:8px;padding:12px;cursor:pointer;transition:border-color .15s,box-shadow .15s; }
.jastip-hd-list-item:hover,.jastip-hd-list-item.active{ border-color:#2d6a4f;box-shadow:0 2px 8px rgba(45,106,79,.15); }
.jastip-hd-list-item-num    { font-size:11px;color:#6c757d;font-weight:600; }
.jastip-hd-list-item-subj   { font-size:13px;font-weight:700;margin:3px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.jastip-hd-list-item-meta   { font-size:11px;color:#6c757d;display:flex;gap:6px;flex-wrap:wrap;align-items:center; }
.jastip-hd-detail-panel     { background:#fff;border:1px solid #dee2e6;border-radius:8px;overflow:auto;max-height:90vh; }
.jastip-hd-detail-empty     { display:flex;flex-direction:column;align-items:center;justify-content:center;height:400px;color:#6c757d; }
.jastip-hd-detail-empty span{ font-size:56px;margin-bottom:12px; }

/* Agent detail layout */
.jastip-hd-agent-detail-layout{ display:grid;grid-template-columns:1fr 280px;gap:20px; }
.jastip-hd-thread-col  { min-width:0; }
.jastip-hd-sidebar     { display:flex;flex-direction:column;gap:12px; }
.jastip-hd-sidebar .jastip-hd-card h4{ margin:0 0 12px;font-size:14px;color:#2d6a4f;border-bottom:1px solid #dee2e6;padding-bottom:8px; }
.jastip-hd-info-row    { display:flex;flex-direction:column;margin-bottom:8px;font-size:13px; }
.jastip-hd-info-row .info-label{ font-size:11px;text-transform:uppercase;color:#6c757d;letter-spacing:.04em; }

/* ── Stats bar (agent) ───────────────────────────────────────────────────── */
.jastip-hd-stats-bar    { display:flex;gap:10px;flex-wrap:wrap;margin-bottom:20px; }
.jastip-hd-stat-pill    { background:#fff;border:1px solid #dee2e6;border-radius:8px;padding:10px 16px;display:flex;align-items:center;gap:8px;cursor:pointer;transition:border-color .15s; }
.jastip-hd-stat-pill.active{ border-color:#2d6a4f;background:#f0faf4; }
.pill-icon              { font-size:18px; }
.pill-count             { font-size:20px;font-weight:800;color:#2d6a4f; }
.pill-label             { font-size:12px;color:#6c757d; }

/* ── Modal (canned) ──────────────────────────────────────────────────────── */
.jastip-hd-modal-overlay{ position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:9999;display:flex;align-items:center;justify-content:center; }
.jastip-hd-modal        { background:#fff;border-radius:10px;width:560px;max-width:95vw;max-height:80vh;display:flex;flex-direction:column;box-shadow:0 10px 40px rgba(0,0,0,.2); }
.jastip-hd-modal-header { display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #dee2e6; }
.jastip-hd-modal-header h3{ margin:0; }
.jastip-hd-modal-close  { background:none;border:none;font-size:20px;cursor:pointer;color:#6c757d; }
.jastip-hd-modal-body   { padding:20px;overflow-y:auto; }
.jastip-hd-canned-item  { border:1px solid #dee2e6;border-radius:6px;padding:12px;margin-bottom:10px; }
.jastip-hd-canned-title { display:flex;gap:8px;align-items:center;margin-bottom:4px; }
.jastip-hd-canned-title code{ background:#e9ecef;padding:2px 6px;border-radius:4px;font-size:11px; }
.jastip-hd-canned-preview{ font-size:12px;color:#6c757d;margin:4px 0 8px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width:900px){
    .jastip-hd-agent-layout        { grid-template-columns:1fr; }
    .jastip-hd-agent-detail-layout { grid-template-columns:1fr; }
    .jastip-hd-sidebar             { order:-1; }
}
@media (max-width:600px){
    .jastip-hd-portal-grid  { grid-template-columns:1fr; }
    .jastip-hd-stats-bar    { gap:6px; }
    .jastip-hd-stat-pill    { padding:8px 10px; }
    .pill-count             { font-size:16px; }
    .jastip-hd-msg-body     { max-width:90%; }
    .jastip-hd-ticket-header{ flex-direction:column; }
}
