/* CircetApp Feedback Widget v2 - Full CSS
 * Floating right-side feedback/ticket UI.
 * All classes prefixed ct-feedback-*. High z-index to overlay any app.
 */

/* ===== Root container + side tab ===== */
.ct-feedback-root {
  position: fixed;
  inset: 0;
  z-index: 2147483640;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #1a202c;
  line-height: 1.4;
}
.ct-feedback-root *,
.ct-feedback-root *::before,
.ct-feedback-root *::after {
  box-sizing: border-box;
}

.ct-feedback-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: #c8102e;
  color: #fff;
  border: none;
  border-radius: 8px 0 0 8px;
  padding: 14px 7px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: -3px 4px 12px rgba(0,0,0,0.18);
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 2147483641;
  transition: background 0.15s ease, right 0.18s ease;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  writing-mode: vertical-rl;
}
.ct-feedback-tab > .ct-feedback-tab-icon {
  writing-mode: horizontal-tb;
}
.ct-feedback-tab:hover { background: #a40d24; right: 3px; }
.ct-feedback-tab-icon {
  font-size: 14px;
  line-height: 1;
}
.ct-feedback-tab-label {
  font-size: 12px;
}
.ct-feedback-tab-badge {
  background: #fff;
  color: #c8102e;
  font-weight: 700;
  border-radius: 999px;
  min-width: 16px;
  padding: 1px 5px;
  font-size: 10px;
  text-align: center;
  line-height: 1.3;
}

/* Backdrop */
.ct-feedback-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2147483642;
}
.ct-feedback-root.is-open .ct-feedback-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Panel - slide from right */
.ct-feedback-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 520px;
  max-width: 92vw;
  background: #fff;
  box-shadow: -10px 0 40px rgba(0,0,0,0.18);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  z-index: 2147483643;
}
.ct-feedback-root.is-open .ct-feedback-panel {
  transform: translateX(0);
}
.ct-feedback-root.is-open .ct-feedback-tab {
  display: none;
}

/* Header */
.ct-feedback-header {
  flex: 0 0 auto;
  background: linear-gradient(135deg, #c8102e 0%, #a30c25 100%);
  color: #fff;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.ct-feedback-header-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.ct-feedback-close {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}
.ct-feedback-close:hover {
  background: rgba(255,255,255,0.32);
}

/* Body (scrollable) */
.ct-feedback-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8f9fb;
}
.ct-feedback-body::-webkit-scrollbar { width: 8px; }
.ct-feedback-body::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 4px; }

/* Greeting (home) */
.ct-feedback-greeting {
  background: #fff;
  padding: 18px 18px 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.ct-feedback-greeting-hi {
  font-size: 17px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 4px;
}
.ct-feedback-greeting-sub {
  font-size: 13px;
  color: #4a5568;
  line-height: 1.5;
}

/* Big primary CTA */
.ct-feedback-cta-primary {
  width: 100%;
  background: linear-gradient(135deg, #c8102e 0%, #a30c25 100%);
  color: #fff;
  border: none;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(200,16,46,0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.ct-feedback-cta-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(200,16,46,0.32);
}

/* Nav buttons */
.ct-feedback-nav-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ct-feedback-nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #2d3748;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: left;
}
.ct-feedback-nav-btn:hover {
  border-color: #c8102e;
  background: #fff5f6;
}
.ct-feedback-nav-btn-admin {
  border-color: #fed7aa;
  background: #fffbeb;
}
.ct-feedback-nav-btn-admin:hover {
  border-color: #f97316;
  background: #fef3c7;
}
.ct-feedback-nav-badge {
  background: #c8102e;
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  min-width: 24px;
  padding: 2px 8px;
  font-size: 12px;
  text-align: center;
}
.ct-feedback-nav-btn-admin .ct-feedback-nav-badge {
  background: #f97316;
}

/* Back button */
.ct-feedback-back {
  align-self: flex-start;
  background: none;
  border: none;
  color: #4a5568;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: 6px;
  font-weight: 500;
}
.ct-feedback-back:hover {
  background: #edf2f7;
  color: #c8102e;
}

/* Section titles */
.ct-feedback-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
}

/* Type picker grid */
.ct-feedback-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ct-feedback-type-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ct-feedback-type-card:hover {
  border-color: #c8102e;
  background: #fff5f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(200,16,46,0.10);
}
.ct-feedback-type-icon {
  font-size: 28px;
  margin-bottom: 4px;
}
.ct-feedback-type-label {
  font-weight: 700;
  font-size: 14px;
  color: #1a202c;
}
.ct-feedback-type-desc {
  font-size: 11px;
  color: #718096;
  line-height: 1.4;
}

/* Form */
.ct-feedback-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
  padding: 18px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.ct-feedback-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ct-feedback-field-label {
  font-size: 12px;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ct-feedback-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ct-feedback-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: #1a202c;
  font-family: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.ct-feedback-input:focus {
  outline: none;
  border-color: #c8102e;
  box-shadow: 0 0 0 3px rgba(200,16,46,0.12);
}
.ct-feedback-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* Module list (in access_request) */
.ct-feedback-module-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px;
  background: #fafbfc;
}
.ct-feedback-module-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  cursor: pointer;
  align-items: center;
}
.ct-feedback-module-item:hover {
  border-color: #c8102e;
  background: #fff5f6;
}
.ct-feedback-module-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #c8102e;
  cursor: pointer;
  grid-row: span 2;
}
.ct-feedback-module-name {
  font-weight: 600;
  font-size: 13px;
  color: #1a202c;
}
.ct-feedback-module-desc {
  font-size: 11px;
  color: #718096;
  grid-column: 2;
  line-height: 1.3;
}

/* Form actions */
.ct-feedback-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.ct-feedback-btn-primary {
  background: #c8102e;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}
.ct-feedback-btn-primary:hover { background: #a30c25; }
.ct-feedback-btn-primary:disabled { background: #cbd5e0; cursor: not-allowed; }
.ct-feedback-btn-secondary {
  background: #fff;
  color: #4a5568;
  border: 1px solid #cbd5e0;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.ct-feedback-btn-secondary:hover {
  border-color: #c8102e;
  color: #c8102e;
}
.ct-feedback-btn-danger {
  background: #fff;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.ct-feedback-btn-danger:hover {
  background: #b91c1c;
  color: #fff;
  border-color: #b91c1c;
}
.ct-feedback-admin-danger {
  border-top: 1px dashed #fecaca;
  margin-top: 10px;
  padding-top: 12px;
}

/* Ticket list */
.ct-feedback-ticket-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ct-feedback-loading,
.ct-feedback-empty,
.ct-feedback-empty-thread {
  text-align: center;
  color: #718096;
  padding: 24px 12px;
  font-size: 13px;
  background: #fff;
  border: 1px dashed #cbd5e0;
  border-radius: 8px;
}
.ct-feedback-ticket-card {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.12s ease;
}
.ct-feedback-ticket-card:hover {
  border-color: #c8102e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}
.ct-feedback-ticket-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ct-feedback-ticket-num {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #4a5568;
  background: #edf2f7;
  padding: 2px 6px;
  border-radius: 4px;
}
.ct-feedback-ticket-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a202c;
  line-height: 1.35;
}
.ct-feedback-ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: #718096;
}
.ct-feedback-ticket-admin-meta {
  font-size: 11px;
  color: #4a5568;
  background: #f7fafc;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 4px;
}

/* Type pills */
.ct-feedback-ticket-type-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #4a5568;
}
.ct-feedback-type-access_request { background: #dbeafe; color: #1e40af; }
.ct-feedback-type-bug { background: #fee2e2; color: #991b1b; }
.ct-feedback-type-feature { background: #d1fae5; color: #065f46; }
.ct-feedback-type-idea { background: #fef3c7; color: #92400e; }

/* Status pills */
.ct-feedback-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.ct-feedback-status-open { background: #dbeafe; color: #1e40af; }
.ct-feedback-status-in_review { background: #fef3c7; color: #92400e; }
.ct-feedback-status-in_progress { background: #ede9fe; color: #5b21b6; }
.ct-feedback-status-resolved { background: #d1fae5; color: #065f46; }
.ct-feedback-status-rejected { background: #fee2e2; color: #991b1b; }
.ct-feedback-status-closed { background: #e2e8f0; color: #4a5568; }

/* Filters (admin) */
.ct-feedback-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
}
.ct-feedback-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ct-feedback-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e0;
  background: #fff;
  font-size: 12px;
  color: #4a5568;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.12s ease;
}
.ct-feedback-chip:hover {
  border-color: #c8102e;
}
.ct-feedback-chip.is-active {
  background: #c8102e;
  color: #fff;
  border-color: #c8102e;
}

/* Detail view */
.ct-feedback-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ct-feedback-detail-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
  line-height: 1.3;
}
.ct-feedback-detail-meta {
  font-size: 12px;
  color: #718096;
}
.ct-feedback-description {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.55;
  color: #2d3748;
  font-size: 14px;
}
.ct-feedback-ar-block {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #1e40af;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #2d3748;
}
.ct-feedback-ar-just {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
  white-space: pre-wrap;
  color: #4a5568;
}

/* Thread */
.ct-feedback-thread-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a202c;
  margin: 8px 0 0 0;
}
.ct-feedback-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ct-feedback-reply {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}
.ct-feedback-reply.is-internal {
  background: #fffbeb;
  border-color: #fcd34d;
  border-left: 4px solid #f59e0b;
}
.ct-feedback-reply-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.ct-feedback-reply-author {
  font-weight: 600;
  font-size: 13px;
  color: #1a202c;
}
.ct-feedback-reply-date {
  font-size: 11px;
  color: #718096;
}
.ct-feedback-internal-tag {
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.ct-feedback-reply-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  color: #2d3748;
  font-size: 13px;
}

/* Admin actions in detail */
.ct-feedback-admin-panel {
  background: #fff;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f97316;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ct-feedback-admin-panel-title {
  font-weight: 700;
  font-size: 13px;
  color: #9a3412;
}
.ct-feedback-admin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #4a5568;
}
.ct-feedback-admin-row .ct-feedback-input { flex: 0 0 auto; min-width: 140px; }

/* Reply form */
.ct-feedback-reply-form {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ct-feedback-internal-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #4a5568;
  cursor: pointer;
}

/* Toast */
.ct-feedback-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px;
  border-radius: 8px;
  background: #1a202c;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  z-index: 2147483647;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  max-width: 90vw;
}
.ct-feedback-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.ct-feedback-toast-success { background: #065f46; }
.ct-feedback-toast-error { background: #991b1b; }
.ct-feedback-toast-warn { background: #92400e; }

/* ===== Attachments v2 ===== */
.ct-feedback-dropzone-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ct-feedback-dropzone {
  border: 2px dashed #cbd5e0;
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  background: #f8f9fb;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.ct-feedback-dropzone:hover,
.ct-feedback-dropzone:focus {
  border-color: #c8102e;
  background: #fff5f6;
  outline: none;
}
.ct-feedback-dropzone.is-drag-over {
  border-color: #c8102e;
  background: #ffe6ea;
  transform: scale(1.01);
}
.ct-feedback-dropzone-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 6px;
}
.ct-feedback-dropzone-label {
  font-weight: 600;
  font-size: 13px;
  color: #2d3748;
  margin-bottom: 2px;
}
.ct-feedback-dropzone-sub {
  font-size: 11px;
  color: #718096;
}

.ct-feedback-pending-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ct-feedback-pending-list:empty { display: none; }
.ct-feedback-pending-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #eef2f7;
  border: 1px solid #dde2eb;
  border-radius: 6px;
  font-size: 12px;
}
.ct-feedback-pending-icon { font-size: 14px; flex-shrink: 0; }
.ct-feedback-pending-name {
  flex: 1 1 auto;
  font-weight: 500;
  color: #2d3748;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ct-feedback-pending-size {
  flex-shrink: 0;
  font-size: 11px;
  color: #718096;
}
.ct-feedback-pending-remove {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: #c8102e;
  color: #fff;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}
.ct-feedback-pending-remove:hover { background: #a30c25; }

.ct-feedback-attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ct-feedback-attachment-list:empty { display: none; }
.ct-feedback-attachment-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #f8f9fb;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  transition: background 0.12s ease;
}
.ct-feedback-attachment-item:hover { background: #eef2f7; }
.ct-feedback-attachment-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  text-decoration: none;
  color: #2d3748;
  min-width: 0;
}
.ct-feedback-attachment-link:hover { color: #c8102e; }
.ct-feedback-attachment-icon { font-size: 14px; flex-shrink: 0; }
.ct-feedback-attachment-name {
  flex: 1 1 auto;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ct-feedback-attachment-size {
  flex-shrink: 0;
  font-size: 11px;
  color: #718096;
}
.ct-feedback-attachment-delete {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #a0aec0;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}
.ct-feedback-attachment-delete:hover {
  background: #fee;
  color: #c8102e;
}

/* Mobile */
@media (max-width: 640px) {
  .ct-feedback-panel { width: 100vw; }
  .ct-feedback-type-grid { grid-template-columns: 1fr; }
  .ct-feedback-row { grid-template-columns: 1fr; }
  .ct-feedback-tab { padding: 6px 10px; font-size: 11px; }
}
