/* ==========================================================================
   NESPL Portal — Industry complaint management
   List, raise, conversation thread and feedback. All classes use .cmp-.
   ========================================================================== */

@keyframes cmpRise { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform:none; } }
@keyframes cmpPop  { from { opacity:0; transform: scale(.96); }      to { opacity:1; transform:none; } }
@keyframes cmpBubble { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform:none; } }
.cmp-in { animation: cmpRise .45s cubic-bezier(.2,.8,.2,1) both; }

/* ==========================================================================
   1. Hero
   ========================================================================== */
.cmp-hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3.5vw, 2.4rem); margin-bottom: 1.6rem; color: #fff;
  background: linear-gradient(125deg, #1e3a8a 0%, #2563eb 45%, #4f46e5 100%);
}
.cmp-hero::before, .cmp-hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.cmp-hero::before { width: 330px; height: 330px; right: -80px; top: -150px; background: rgba(255,255,255,.13); }
.cmp-hero::after  { width: 200px; height: 200px; right: 160px; bottom: -130px; background: rgba(255,255,255,.08); }

.cmp-hero__in { position: relative; z-index: 2; display: flex; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; }
.cmp-hero__text { flex: 1; min-width: 240px; }
.cmp-hero__eyebrow {
  display: inline-flex; align-items: center; gap: .45rem; font-size: .72rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.21);
  padding: .3rem .7rem; border-radius: 999px; margin-bottom: .8rem;
}
.cmp-hero h1 { color: #fff; font-size: clamp(1.5rem, 3.4vw, 2.15rem); margin: 0 0 .45rem; letter-spacing: -.02em; }
.cmp-hero p { color: rgba(255,255,255,.82); margin: 0; font-size: .94rem; max-width: 56ch; }
.cmp-hero__stats { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 1.4rem; }
.cmp-hero__stat b {
  display: block; font-family: var(--font-display); font-size: 1.7rem; line-height: 1; color: #fff;
  font-variant-numeric: tabular-nums;
}
.cmp-hero__stat span { font-size: .76rem; color: rgba(255,255,255,.72); letter-spacing: .04em; }
/* The hero CTA is the design system's own add button (.btn.btn-orange), not a
   bespoke white pill — only the icon/label spacing is needed here. */
.cmp-hero__in > .btn { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }

/* ==========================================================================
   2. Toolbar
   ========================================================================== */
.cmp-tools { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.cmp-search { position: relative; flex: 1 1 280px; max-width: 420px; }
.cmp-search input { padding-left: 2.7rem; height: 48px; border-radius: 14px; background: #fff; }
.cmp-search i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.cmp-filter {
  height: 48px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff;
  padding: 0 2.4rem 0 1rem; font-family: var(--font-display); font-weight: 600; font-size: .88rem;
  color: var(--body); cursor: pointer; min-width: 155px;
}

/* ==========================================================================
   3. Table
   ========================================================================== */
.cmp-panel { background: #fff; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-sm); }
.cmp-table { width: 100%; border-collapse: collapse; }
.cmp-table thead th {
  background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff;
  font-family: var(--font-display); font-weight: 600; font-size: .78rem;
  letter-spacing: .07em; text-transform: uppercase; text-align: left;
  padding: .95rem 1.2rem; white-space: nowrap;
}
.cmp-table thead th:last-child { text-align: right; }
.cmp-table tbody td { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cmp-table tbody tr:last-child td { border-bottom: none; }
.cmp-table tbody tr { transition: background .18s; }
.cmp-table tbody tr:hover { background: var(--surface-2); }

.cmp-date { font-size: .87rem; color: var(--body); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp-user { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.cmp-user__av {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--grad-blue); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: .78rem;
}
.cmp-user__e { font-size: .87rem; color: var(--body); word-break: break-word; }
.cmp-subj { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: .92rem; line-height: 1.35; }
.cmp-subj small { display: block; font-weight: 500; color: var(--muted); font-size: .78rem; margin-top: .12rem; }

.cmp-status {
  display: inline-flex; align-items: center; gap: .4rem; padding: .32rem .75rem; border-radius: 999px;
  font-size: .76rem; font-weight: 700; font-family: var(--font-display); white-space: nowrap;
}
.cmp-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cmp-status.pending  { background: #fff6e5; color: #b45309; border: 1px solid #fde3b4; }
.cmp-status.inprog { background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-100); }
.cmp-status.closed   { background: var(--green-soft); color: #15803d; border: 1px solid #bbf7d0; }

.cmp-acts { display: flex; gap: .45rem; justify-content: flex-end; flex-wrap: wrap; }
.cmp-btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .85rem; border-radius: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: .82rem; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--body); transition: .18s; white-space: nowrap;
}
.cmp-btn:hover { transform: translateY(-2px); border-color: var(--blue-400); color: var(--blue-700); background: var(--blue-50); }
.cmp-btn.solid {
  background: var(--grad-blue); border-color: transparent; color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.26);
}
.cmp-btn.solid:hover { color: #fff; filter: brightness(1.05); }
.cmp-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.cmp-btn:focus-visible { box-shadow: var(--ring); }

.cmp-cell-k { display: none; }

/* ==========================================================================
   4. Footer + empty
   ========================================================================== */
.cmp-foot {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.05rem 1.3rem; border-top: 1px solid var(--line); background: var(--surface-2);
}
.cmp-foot__per { display: flex; align-items: center; gap: .55rem; font-size: .86rem; color: var(--body); }
.cmp-foot__per select { width: auto; min-width: 74px; }
.cmp-foot__count { flex: 1; text-align: center; font-size: .86rem; color: var(--muted); min-width: 150px; }
.cmp-pager { display: flex; gap: .3rem; }
.cmp-pager button {
  min-width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff;
  color: var(--body); cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: .84rem;
  transition: .18s;
}
.cmp-pager button:hover:not(:disabled) { border-color: var(--blue-400); color: var(--blue-700); transform: translateY(-1px); }
.cmp-pager button.on { background: var(--grad-blue); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.3); }
.cmp-pager button:disabled { opacity: .35; cursor: not-allowed; }

.cmp-empty { text-align: center; padding: 4rem 1rem; animation: cmpPop .4s both; }
.cmp-empty__ico {
  width: 88px; height: 88px; border-radius: 26px; margin: 0 auto 1.2rem; display: grid; place-items: center;
  background: var(--blue-50); color: var(--blue-400); font-size: 2.2rem;
}
.cmp-empty h6 { margin: 0 0 .4rem; font-size: 1.05rem; }
.cmp-empty p { color: var(--muted); font-size: .92rem; margin: 0 0 1.2rem; }

/* ==========================================================================
   5. Conversation view
   ========================================================================== */
.cmp-thread__head {
  background: linear-gradient(125deg, #1e3a8a, #2563eb 55%, #4f46e5); color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 1.5rem 1.6rem;
  position: relative; overflow: hidden;
}
.cmp-thread__head::after {
  content: ""; position: absolute; right: -60px; top: -90px; width: 240px; height: 240px;
  border-radius: 50%; background: rgba(255,255,255,.12);
}
.cmp-thread__row { display: flex; align-items: flex-start; gap: 1rem; position: relative; z-index: 2; flex-wrap: wrap; }
.cmp-thread__av {
  width: 54px; height: 54px; flex: 0 0 54px; border-radius: 16px; display: grid; place-items: center;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; backdrop-filter: blur(6px);
}
.cmp-thread__id { flex: 1; min-width: 200px; }
.cmp-thread__id h4 { color: #fff; margin: 0 0 .2rem; font-size: 1.2rem; letter-spacing: -.01em; }
.cmp-thread__id .who { color: rgba(255,255,255,.84); font-size: .87rem; }
.cmp-thread__meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; position: relative; z-index: 2; }
.cmp-vchip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .78rem; border-radius: 9px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.24); color: #fff;
  font-size: .81rem; font-weight: 600; font-family: var(--font-display);
}

.cmp-thread__body {
  background: #fff; border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 1.5rem;
}
.cmp-sec__h {
  display: flex; align-items: center; gap: .55rem; margin: 0 0 1rem;
  font-family: var(--font-display); font-weight: 700; font-size: .76rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.cmp-sec__h i { color: var(--blue-500); font-size: .9rem; }

/* chat bubbles */
.cmp-msgs { display: flex; flex-direction: column; gap: 1.1rem; margin-bottom: 1.5rem; }
.cmp-msg { display: flex; gap: .8rem; animation: cmpBubble .35s cubic-bezier(.2,.8,.2,1) both; }
.cmp-msg__av {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: .74rem; color: #fff;
  background: var(--grad-blue);
}
.cmp-msg__b { flex: 1; min-width: 0; }
.cmp-msg__meta { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .3rem; }
.cmp-msg__who { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: .87rem; }
.cmp-msg__when { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cmp-msg__t {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px;
  padding: .85rem 1rem; font-size: .91rem; color: var(--body); line-height: 1.65; white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* the employer's own replies sit on the right in brand colour */
.cmp-msg.mine { flex-direction: row-reverse; }
.cmp-msg.mine .cmp-msg__av { background: linear-gradient(135deg,#0f766e,#0d9488); }
.cmp-msg.mine .cmp-msg__meta { flex-direction: row-reverse; }
.cmp-msg.mine .cmp-msg__t {
  background: var(--blue-50); border-color: var(--blue-100); color: var(--ink);
  border-radius: 14px 4px 14px 14px;
}

.cmp-reply { border-top: 1px dashed var(--line); padding-top: 1.3rem; }
.cmp-reply__row { display: flex; gap: .7rem; align-items: flex-end; flex-wrap: wrap; }
.cmp-reply__row textarea { flex: 1; min-width: 200px; resize: vertical; }

/* ==========================================================================
   6. Modals
   ========================================================================== */
.cmp-mhead {
  padding: 1.5rem 1.6rem 1.3rem; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(125deg, #1e3a8a, #2563eb 55%, #4f46e5);
}
.cmp-mhead.warm { background: linear-gradient(125deg, #b45309, #ea580c 55%, #f97316); }
.cmp-mhead::after {
  content: ""; position: absolute; right: -50px; top: -80px; width: 220px; height: 220px;
  border-radius: 50%; background: rgba(255,255,255,.13);
}
.cmp-mhead h5 { color: #fff; margin: 0 0 .2rem; position: relative; z-index: 2; font-size: 1.2rem; }
.cmp-mhead p { color: rgba(255,255,255,.8); margin: 0; font-size: .85rem; position: relative; z-index: 2; }
.cmp-mx {
  position: absolute; top: 1.1rem; right: 1.1rem; z-index: 3; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.15); color: #fff; cursor: pointer;
  display: grid; place-items: center; transition: .18s;
}
.cmp-mx:hover { background: rgba(255,255,255,.28); }

/* star rating */
.cmp-stars { display: flex; gap: .35rem; justify-content: center; margin-bottom: .5rem; }
.cmp-star {
  border: none; background: none; cursor: pointer; font-size: 2.1rem; line-height: 1; padding: .15rem;
  color: var(--line); transition: transform .16s, color .16s;
}
.cmp-star:hover { transform: scale(1.14); }
.cmp-star.on { color: #f59e0b; }
.cmp-star:focus-visible { box-shadow: var(--ring); border-radius: 8px; }
.cmp-rate-label {
  text-align: center; font-family: var(--font-display); font-weight: 600; font-size: .88rem;
  color: var(--muted); min-height: 1.3em; margin-bottom: 1.2rem;
}

/* ==========================================================================
   7. Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .cmp-table, .cmp-table tbody, .cmp-table tr, .cmp-table td { display: block; }
  .cmp-table, .cmp-table tbody, .cmp-table td { width: 100%; }
  .cmp-table thead { display: none; }
  .cmp-table tbody { padding: .8rem; }
  .cmp-table tbody tr {
    width: auto; border: 1px solid var(--line); border-radius: 16px;
    margin: 0 0 .8rem; padding: .3rem 0; background: #fff;
  }
  .cmp-table tbody tr:last-child { margin-bottom: 0; }
  .cmp-table tbody tr:hover { background: #fff; }
  .cmp-table tbody td { border-bottom: 1px dashed var(--line); padding: .7rem 1rem; }
  .cmp-table tbody td:last-child { border-bottom: none; }
  .cmp-cell-k {
    display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); font-weight: 700; margin-bottom: .35rem;
  }
  .cmp-acts { justify-content: flex-start; }
}

@media (max-width: 700px) {
  .cmp-hero__in { flex-direction: column; align-items: stretch; }
  .cmp-hero__in > .btn { width: 100%; justify-content: center; }
  .cmp-hero__stats { gap: 1.4rem; }
  .cmp-hero__stat b { font-size: 1.4rem; }
  .cmp-search { max-width: none; }
  .cmp-foot__count { order: 3; flex: 1 1 100%; text-align: left; }
  .cmp-thread__body { padding: 1.1rem; }
  .cmp-reply__row .btn { width: 100%; }
  .cmp-star { font-size: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cmp-in, .cmp-msg, .cmp-empty { animation: none; }
  .cmp-btn, .cmp-pager button, .cmp-star { transition: none; }
  .cmp-btn:hover, .cmp-pager button:hover:not(:disabled), .cmp-star:hover { transform: none; }
}
