/**
 * 1:1 문의 스타일 (목록 / 작성 / 상세 공용)
 * Design tokens은 common.css에서 정의됨
 */

/* ============================================================
   Filter chips
   ============================================================ */
.chips {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chip {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.chip.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 500;
}

/* ============================================================
   Ticket list
   ============================================================ */
.ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.ticket-item {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s ease;
}

.ticket-item:hover {
  background: var(--bg-card);
}

.ticket-item:last-child {
  border-bottom: none;
}

.ticket-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ticket-cat {
  font-size: 12px;
  color: var(--text-tertiary);
}

.ticket-subject {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 4px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-preview {
  color: var(--text-secondary);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.ticket-meta .material-icons {
  font-size: 14px;
}

/* ============================================================
   Status badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

.badge-open {
  background: var(--info-bg);
  color: var(--info);
}

.badge-answered {
  background: var(--success-bg);
  color: var(--success);
}

.badge-closed {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.badge-unread {
  background: var(--danger);
  color: #fff;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  border-radius: 9px;
  justify-content: center;
}

/* ============================================================
   Compose form
   ============================================================ */
.form {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-primary);
  box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
}

.form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-counter {
  float: right;
}

.form-counter.over {
  color: var(--danger);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.form-actions .btn {
  min-width: 96px;
}

.form-actions-hint {
  text-align: right;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ============================================================
   Attachment picker
   ============================================================ */
.attach-area {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: 0.15s ease;
  background: var(--bg-card);
}

.attach-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.attach-area .material-icons {
  font-size: 32px;
  margin-bottom: 4px;
  display: block;
}

.attach-list {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.attach-chip {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-chip.image {
  background-image: linear-gradient(135deg, #ffd9b8, #ff9c64);
}

.attach-chip.video {
  background: #1a1a1a;
  color: #fff;
}

.attach-chip .material-icons {
  font-size: 32px;
  color: rgba(255, 255, 255, 0.85);
}

.attach-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-remove .material-icons {
  font-size: 14px;
  color: #fff;
}

.attach-name {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  font-size: 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Detail thread
   ============================================================ */
.thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
}

.thread-header {
  background: var(--surface);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-1);
}

.thread-header .ticket-subject {
  font-size: 17px;
  margin: 0 0 8px;
}

.thread-header .meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Messages */
.msg {
  display: flex;
  margin-bottom: 16px;
  gap: 8px;
}

.msg-user {
  justify-content: flex-end;
}

.msg-admin {
  justify-content: flex-start;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.msg-admin .msg-avatar {
  background: var(--primary);
}

.msg-bubble {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-user .msg-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-admin .msg-bubble {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
}

.msg-attachments {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.msg-attach {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  cursor: pointer;
}

.msg-attach img,
.msg-attach video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.msg-attach .material-icons {
  font-size: 28px;
  color: var(--text-tertiary);
}

.msg-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  padding: 0 4px;
}

.msg-user .msg-time {
  text-align: right;
}

/* Thread composer */
.thread-composer {
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  padding: 12px;
}

.composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.composer-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  min-height: 38px;
  box-sizing: border-box;
}

.composer-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.composer-actions {
  display: flex;
  gap: 4px;
}

/* Closed banner */
.closed-banner {
  background: var(--bg-card);
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.closed-banner .material-icons {
  font-size: 18px;
  color: var(--text-tertiary);
}

.closed-banner a {
  margin-left: auto;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

/* ============================================================
   Empty / error state
   ============================================================ */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  padding: 48px 16px;
  text-align: center;
}

.empty .material-icons {
  font-size: 56px;
  margin-bottom: 12px;
  color: var(--text-placeholder);
}

/* ============================================================
   Inquiry page layout
   ============================================================ */
.inquiry-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.inquiry-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Detail page fills viewport below header */
.inquiry-detail-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 57px); /* header height */
}
