/* ═══════════════════════════════════════════════════════════════════════
   Ticketing Module – CI4 Omni UMA
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Stat Cards ────────────────────────────────────────────────────────── */
.ticket-stat-card { cursor: pointer; transition: transform .2s, box-shadow .2s; }
.ticket-stat-card:hover { transform: translateY(-4px); box-shadow: 0 6px 18px rgba(0,0,0,.1) !important; }
.ticket-stat-card.active { border: 2px solid var(--bs-primary); }
.ticket-stat-num { font-size: 1.5rem; font-weight: 700; line-height: 1; }

/* ── Ticket Table ──────────────────────────────────────────────────────── */
.ticket-table .ticket-row { cursor: pointer; transition: background .15s; }
.ticket-table .ticket-row:hover { background: rgba(var(--bs-primary-rgb), .04); }
.ticket-table .ticket-row.pinned { background: rgba(255,193,7,.06); }
.ticket-subject { font-weight: 600; color: var(--bs-body-color); }
.ticket-subject:hover { color: var(--bs-primary); text-decoration: none; }
.ticket-meta { font-size: .8125rem; color: #8e8e93; margin-top: 2px; }

/* ── Status & Priority Badges ──────────────────────────────────────────── */
.badge-status { font-size: .75rem; padding: .3em .65em; border-radius: .35rem; font-weight: 600; }
.badge-priority { font-size: .75rem; padding: .3em .55em; border-radius: .35rem; }
.priority-low       { background: #d1fae5; color: #065f46; }
.priority-normal,
.priority-medium    { background: #fef3c7; color: #92400e; }
.priority-high      { background: #fed7aa; color: #9a3412; }
.priority-urgent,
.priority-critical  { background: #fecaca; color: #991b1b; }

/* ── Bulk Actions Bar ──────────────────────────────────────────────────── */
.bulk-bar { background: var(--bs-primary); color: #fff; border-radius: .5rem; padding: .5rem 1rem; }
.bulk-bar .form-select, .bulk-bar .btn { font-size: .8125rem; }

/* ── Conversation Thread ───────────────────────────────────────────────── */
.msg-thread { max-height: calc(100vh - 380px); overflow-y: auto; padding: 1rem 0; }
.msg-item { padding: 1rem 1.25rem; border-bottom: 1px solid rgba(0,0,0,.06); }
.msg-item:last-child { border-bottom: 0; }
.msg-item.msg-outbound { background: rgba(var(--bs-primary-rgb), .03); }
.msg-item.msg-internal { background: #fff8e1; border-left: 3px solid #ffc107; }
.msg-item.msg-comment { background: #f0f4ff; border-left: 3px solid var(--bs-info); }
.msg-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .875rem; flex-shrink: 0; color: #fff; }
.msg-avatar.av-customer { background: #6366f1; }
.msg-avatar.av-agent { background: #10b981; }
.msg-avatar.av-system { background: #f59e0b; }
.msg-from { font-weight: 600; font-size: .875rem; }
.msg-time { font-size: .75rem; color: #8e8e93; }
.msg-body { margin-top: .5rem; font-size: .875rem; line-height: 1.65; }
.msg-body img { max-width: 100%; height: auto; }
.msg-attachments { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.msg-attach-chip { display: inline-flex; align-items: center; gap: .35rem; background: #f3f4f6; border-radius: .35rem; padding: .25rem .6rem; font-size: .75rem; text-decoration: none; color: #374151; transition: background .15s; }
.msg-attach-chip:hover { background: #e5e7eb; color: #111827; }

/* ── Reply Panel ───────────────────────────────────────────────────────── */
.reply-panel { border-top: 2px solid rgba(0,0,0,.08); }
.reply-tabs .nav-link { font-size: .8125rem; padding: .5rem .85rem; }
.reply-tabs .nav-link.active { font-weight: 600; }
.reply-panel .ql-editor { min-height: 140px; }
.reply-footer { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: #fafafa; border-top: 1px solid rgba(0,0,0,.06); }
.btn-send { min-width: 120px; }

/* ── Ticket Detail Sidebar ─────────────────────────────────────────────── */
.detail-sidebar .detail-group { padding: .75rem 0; border-bottom: 1px solid rgba(0,0,0,.06); }
.detail-sidebar .detail-group:last-child { border-bottom: 0; }
.detail-sidebar label { font-size: .75rem; font-weight: 600; color: #6c757d; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .25rem; }
.detail-sidebar .form-select-sm { font-size: .8125rem; }

/* ── Activity Log ──────────────────────────────────────────────────────── */
.activity-list { max-height: 320px; overflow-y: auto; }
.activity-item { display: flex; gap: .5rem; padding: .5rem 0; font-size: .8125rem; }
.activity-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; flex-shrink: 0; background: #f3f4f6; color: #6b7280; }
.activity-desc { color: #374151; }
.activity-time { font-size: .7rem; color: #9ca3af; }

/* ── Template Card ─────────────────────────────────────────────────────── */
.tpl-card { transition: box-shadow .2s; cursor: pointer; }
.tpl-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.tpl-shortcut { font-family: monospace; background: #f3f4f6; padding: .15rem .5rem; border-radius: .25rem; font-size: .75rem; }

/* ── Color Picker (Admin) ──────────────────────────────────────────────── */
.color-swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform .15s, border-color .15s; }
.color-dot:hover { transform: scale(1.15); }
.color-dot.active { border-color: #1e1e1e; transform: scale(1.15); }

/* ── Profile Cards (Email Profiles) ────────────────────────────────────── */
.profile-card { border-left: 4px solid #6c757d; transition: box-shadow .2s; }
.profile-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.profile-type-badge { font-size: .7rem; padding: .2rem .5rem; border-radius: .25rem; font-weight: 600; text-transform: uppercase; }

/* ── CSAT ──────────────────────────────────────────────────────────────── */
.csat-score-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; padding: .2rem .5rem; border-radius: 1rem; font-weight: 700; font-size: .8125rem; }
.csat-score-pill.good { background: #d1fae5; color: #065f46; }
.csat-score-pill.mid { background: #fef3c7; color: #92400e; }
.csat-score-pill.bad { background: #fecaca; color: #991b1b; }
.csat-bar { height: 6px; border-radius: 3px; background: #e5e7eb; overflow: hidden; }
.csat-bar-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }

/* ── Widget Form (Standalone) ──────────────────────────────────────────── */
.widget-standalone { min-height: 100vh; background: #f3f4f6; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.widget-card { max-width: 540px; width: 100%; border-radius: .75rem; overflow: hidden; box-shadow: 0 4px 24px rgba(0,0,0,.1); }
.widget-header { padding: 1.5rem; color: #fff; }
.widget-body { padding: 1.5rem; background: #fff; }

/* ── CSAT Form (Standalone) ────────────────────────────────────────────── */
.csat-standalone { min-height: 100vh; background: #f3f4f6; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.csat-card { max-width: 520px; width: 100%; }
.stars-row, .nps-row, .emoji-row, .binary-row { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.star-btn, .nps-btn, .emoji-btn, .binary-btn { border: 2px solid #e5e7eb; background: #fff; border-radius: .5rem; cursor: pointer; transition: all .2s; display: flex; align-items: center; justify-content: center; }
.star-btn { width: 48px; height: 48px; font-size: 1.5rem; }
.nps-btn { width: 40px; height: 40px; font-size: .875rem; font-weight: 600; }
.emoji-btn { width: 64px; height: 64px; font-size: 2rem; }
.binary-btn { padding: .75rem 1.5rem; font-size: .875rem; font-weight: 600; gap: .5rem; }
.star-btn.selected, .nps-btn.selected, .emoji-btn.selected, .binary-btn.selected { border-color: var(--bs-primary, #4f46e5); background: rgba(79,70,229,.08); }

/* ── Scheduled Cards ───────────────────────────────────────────────────── */
.sched-card { border-left: 4px solid var(--bs-primary); }
.sched-day { font-size: 2rem; font-weight: 700; line-height: 1; }
.sched-month { font-size: .75rem; text-transform: uppercase; color: #6c757d; }

/* ── Misc ──────────────────────────────────────────────────────────────── */
.pin-icon { cursor: pointer; }
.pin-icon.active { color: #f59e0b; }
.inbox-badge { display: inline-flex; align-items: center; gap: 4px; padding: .15rem .5rem; border-radius: 1rem; font-size: .7rem; font-weight: 600; }
.filter-pills { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-pills .badge { cursor: pointer; font-weight: 500; }
.attached-files { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.attach-chip { display: inline-flex; align-items: center; gap: .35rem; background: #f3f4f6; border-radius: .35rem; padding: .25rem .6rem; font-size: .75rem; }
.attach-chip .remove { cursor: pointer; color: #ef4444; }
.sub-nav .nav-link { font-size: .8125rem; color: #6c757d; border-radius: .375rem; padding: .4rem .75rem; }
.sub-nav .nav-link.active { background: var(--bs-primary); color: #fff; }
.sub-nav .nav-link:hover:not(.active) { background: rgba(var(--bs-primary-rgb),.08); }
.code-block { background: #1e1e2e; color: #a6e3a1; border-radius: .5rem; padding: 1rem; font-size: .8125rem; overflow-x: auto; position: relative; }
.code-block .copy-btn { position: absolute; top: .5rem; right: .5rem; }
