* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: #0d0d1a;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== Header ===== */
.header {
  background: #1a1a2e;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #2a2a3e;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hotel-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
}

.hotel-name {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.header-subtitle {
  font-size: 12px;
  color: #888;
}

.header-stats {
  display: flex;
  gap: 24px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-family: 'Space Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: #f59e0b;
}

.stat-value.stat-progress { color: #3b82f6; }
.stat-value.stat-resolved { color: #10b981; }

.stat-label {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #888;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

.status-dot.connected { background: #2dd4bf; }

/* ===== Main Content ===== */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== Department Sidebar ===== */
.sidebar {
  width: 240px;
  background: #141425;
  border-right: 1px solid #2a2a3e;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #2a2a3e;
}

.sidebar-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.department-list {
  flex: 1;
  overflow-y: auto;
}

.dept-item {
  padding: 10px 16px;
  border-bottom: 1px solid #1e1e35;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 3px solid transparent;
}

.dept-item:hover { background: #1e1e35; }

.dept-item.active {
  background: #252545;
}

.dept-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dept-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dept-name {
  font-size: 13px;
  color: #e0e0e0;
  font-weight: 500;
}

.dept-name-th {
  font-size: 11px;
  color: #666;
}

.dept-count {
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #3a3a5e;
}

.dept-count.has-tickets { background: #f59e0b; color: #000; }

/* ===== Ticket List Panel ===== */
.ticket-list-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid #2a2a3e;
}

.ticket-list-header {
  padding: 12px 16px;
  border-bottom: 1px solid #2a2a3e;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: #1a1a2e;
}

.ticket-list-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.filter-tabs {
  display: flex;
  gap: 4px;
}

.filter-btn {
  padding: 4px 10px;
  border: 1px solid #2a2a3e;
  border-radius: 4px;
  background: transparent;
  color: #888;
  font-size: 11px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.filter-btn.active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.filter-btn:hover:not(.active) {
  border-color: #6366f1;
  color: #c0c0c0;
}

.ticket-list {
  flex: 1;
  overflow-y: auto;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: #555;
  font-size: 13px;
}

/* Ticket Card */
.ticket-card {
  padding: 14px 16px;
  border-bottom: 1px solid #1e1e35;
  cursor: pointer;
  transition: background 0.15s;
}

.ticket-card:hover { background: #1e1e35; }
.ticket-card.active { background: #252545; border-left: 3px solid #6366f1; }

.ticket-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.ticket-card-id {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: #6366f1;
  font-weight: 600;
}

.ticket-card-time {
  font-size: 10px;
  color: #666;
}

.ticket-card-summary {
  font-size: 13px;
  color: #e0e0e0;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-card-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ticket-card-room {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #2dd4bf;
  font-weight: 600;
}

/* ===== Badges ===== */
.status-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-badge.open { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.status-badge.in_progress { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.status-badge.resolved { background: rgba(16, 185, 129, 0.15); color: #10b981; }

.priority-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.priority-badge.normal { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }
.priority-badge.high { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.priority-badge.urgent { background: rgba(239, 68, 68, 0.2); color: #ef4444; animation: urgentPulse 2s infinite; }

@keyframes urgentPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.dept-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: #1e1e35;
  color: #aaa;
}

/* ===== Detail Panel ===== */
.detail-panel {
  width: 380px;
  background: #141425;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.detail-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 13px;
}

.detail-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.detail-header {
  padding: 14px 16px;
  border-bottom: 1px solid #2a2a3e;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: #1a1a2e;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ticket-id-badge {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: #6366f1;
}

.detail-section {
  padding: 14px 16px;
  border-bottom: 1px solid #1e1e35;
}

.detail-section h4 {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.detail-grid.detail-grid-2x2 {
  grid-template-columns: repeat(2, 1fr);
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 10px;
  color: #666;
}

.detail-value {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e0;
}

.detail-guest-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guest-info-tag {
  padding: 3px 8px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 4px;
  font-size: 11px;
  color: #a5b4fc;
}

/* Request Summary */
.request-summary {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
  line-height: 1.4;
}

.request-translations {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.request-trans-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.trans-label {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  min-width: 55px;
  padding-top: 2px;
}

.trans-text {
  font-size: 12px;
  color: #ccc;
  line-height: 1.4;
}

/* Conversation Excerpt */
.excerpt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.excerpt-item {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.excerpt-item.guest {
  background: rgba(45, 212, 191, 0.08);
  border-left: 2px solid #2dd4bf;
}

.excerpt-item.bot {
  background: rgba(107, 114, 128, 0.08);
  border-left: 2px solid #6b7280;
}

.excerpt-speaker {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.excerpt-item.guest .excerpt-speaker { color: #2dd4bf; }
.excerpt-item.bot .excerpt-speaker { color: #6b7280; }

.excerpt-text {
  color: #ccc;
}

.excerpt-time {
  font-size: 9px;
  color: #555;
  margin-top: 2px;
}

/* Suggested Responses */
.suggested-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggested-btn {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a2a3e;
  background: #1a1a2e;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.suggested-btn:hover {
  border-color: #6366f1;
  background: #252545;
}

.suggested-btn-th {
  font-size: 13px;
  color: #e0e0e0;
  margin-bottom: 3px;
}

.suggested-btn-en {
  font-size: 11px;
  color: #888;
}

.suggested-btn-type {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 4px;
}

.type-confirm { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.type-clarify { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.type-alternative { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.type-acknowledge { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }
.type-delay { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* Responses */
.response-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.response-item {
  padding: 8px 10px;
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid #6366f1;
  border-radius: 4px;
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.response-staff {
  font-size: 11px;
  font-weight: 600;
  color: #a5b4fc;
}

.response-time {
  font-size: 10px;
  color: #666;
}

.response-text {
  font-size: 12px;
  color: #e0e0e0;
  margin-bottom: 2px;
}

.response-translated {
  font-size: 11px;
  color: #888;
  font-style: italic;
}

/* Reply */
.reply-section {
  padding: 12px 16px !important;
}

.reply-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#dept-reply-input {
  flex: 1;
  padding: 10px 14px;
  background: #262640;
  border: 1px solid #3a3a5e;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
}

#dept-reply-input:focus { border-color: #6366f1; }

/* Action buttons */
.detail-actions {
  padding: 14px 16px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  border-top: 1px solid #2a2a3e;
  background: #1a1a2e;
}

.btn {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.btn-send {
  background: #6366f1;
  color: #fff;
  padding: 10px 16px;
  flex-shrink: 0;
}

.btn-send:hover { background: #5558e6; }

.btn-claim {
  flex: 1;
  background: #3b82f6;
  color: #fff;
}

.btn-claim:hover { background: #2563eb; }

.btn-resolve {
  flex: 1;
  background: #10b981;
  color: #fff;
}

.btn-resolve:hover { background: #059669; }

.btn-reopen {
  flex: 1;
  background: #f59e0b;
  color: #000;
}

.btn-reopen:hover { background: #d97706; }

.no-data {
  font-size: 12px;
  color: #555;
}

/* ===== Utilities ===== */
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ===== Notification sound indicator ===== */
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast {
  position: fixed;
  top: 70px;
  right: 20px;
  background: #1a1a2e;
  border: 1px solid #6366f1;
  border-radius: 8px;
  padding: 12px 16px;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
  max-width: 300px;
}

.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.toast-body {
  font-size: 12px;
  color: #aaa;
}
