/* ============================================================ */

.contact-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  min-height: 500px;
}

.contact-header-section {
  margin-bottom: 20px;
}

.contact-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #0F1B31;
  margin: 0;
}

.contact-page-subtitle {
  font-size: 14px;
  color: #6B7280;
  margin: 4px 0 0;
}

.contact-login-prompt {
  text-align: center;
  padding: 56px 24px;
  background: #F9FAFB;
  border-radius: 20px;
  margin-top: 20px;
  min-height: 200px;
}

.contact-login-icon {
  margin-bottom: 16px;
}

.contact-login-title {
  font-size: 18px;
  font-weight: 600;
  color: #0F1B31;
  margin: 0 0 8px;
}

.contact-login-text {
  font-size: 14px;
  color: #6B7280;
  margin: 0;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.contact-tickets-sidebar {
  padding-top: 82px;
}

.contact-chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 420px;
  max-height: 700px;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
}

.contact-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #F8F9FB;
}

.contact-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.contact-chat-messages::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 2px;
}

.contact-chat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
}

.contact-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  height: 100%;
}

.contact-welcome-icon {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: linear-gradient(135deg, #E8F7F2, #D1FAE5);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.contact-welcome-title {
  font-size: 20px;
  font-weight: 600;
  color: #0F1B31;
  margin: 0 0 10px;
}

.contact-welcome-text {
  font-size: 14px;
  color: #6B7280;
  line-height: 1.6;
  margin: 0;
  max-width: 380px;
}

.contact-retry-btn {
  margin-top: 16px;
  padding: 10px 28px;
  background: #00B87A;
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.contact-retry-btn:hover {
  background: #009966;
}

.contact-messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

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

.contact-msg-row-ai {
  justify-content: flex-start;
}

.contact-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-msg-avatar-ai {
  background: linear-gradient(135deg, #00B87A, #009D68);
}

.contact-msg-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.contact-msg-user {
  background: #00B87A;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.contact-msg-ai {
  background: #fff;
  color: #0F1B31;
  border: 1px solid #E5E7EB;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.contact-msg-content {
  white-space: pre-wrap;
}

.contact-typing-dots {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}

.contact-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9CA4B1;
  animation: contactTypingBounce 1.4s infinite ease-in-out;
}

.contact-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.contact-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes contactTypingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

.contact-chat-input-area {
  border-top: 1px solid #E5E7EB;
  padding: 14px 20px;
  background: #fff;
}

.contact-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.contact-text-input {
  flex: 1;
  padding: 12px 18px;
  border-radius: 24px;
  border: 1px solid #E5E7EB;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  background: #F9FAFB;
}

.contact-text-input:focus {
  border-color: #00B87A;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,184,122,0.1);
}

.contact-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #00B87A;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.contact-send-btn:hover:not(:disabled) {
  background: #009D68;
  transform: scale(1.05);
}

.contact-send-btn:disabled {
  background: #D1D5DB;
  cursor: default;
}

.contact-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: contactSpin 0.7s linear infinite;
}

.contact-spinner-large {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid #E5E7EB;
  border-top-color: #00B87A;
  border-radius: 50%;
  animation: contactSpin 0.7s linear infinite;
}

@keyframes contactSpin {
  to { transform: rotate(360deg); }
}

.contact-status-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.contact-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #9CA4B1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px;
}

.contact-sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #00B87A;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

.contact-sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 12px;
  color: #9CA4B1;
  font-size: 13px;
  gap: 8px;
}

.contact-sidebar-empty-hint {
  font-size: 12px;
  color: #B0B7C3;
  line-height: 1.4;
  max-width: 200px;
}

.contact-sidebar-tickets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-sidebar-ticket {
  padding: 12px;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

.contact-sidebar-ticket:hover {
  border-color: #00B87A;
  background: #F0FFF8;
}

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

.contact-sidebar-ticket-num {
  font-size: 12px;
  font-weight: 600;
  color: #9CA4B1;
}

.contact-sidebar-ticket-status {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.contact-sidebar-ticket-subject {
  font-size: 13px;
  font-weight: 600;
  color: #0F1B31;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-sidebar-ticket-preview {
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-sidebar-ticket-time {
  font-size: 11px;
  color: #B0B7C3;
}

.contact-sidebar-ticket-skeleton {
  padding: 12px;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  margin-bottom: 8px;
  background: #fff;
}

/* Modals */
.contact-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: contactFadeIn 0.2s ease;
}

@keyframes contactFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.contact-modal-content {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  width: 90%;
  max-width: 440px;
  animation: contactSlideUp 0.3s ease;
}

@keyframes contactSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.contact-modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #D1D5DB;
  margin: 0 auto 20px;
}

.contact-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #0F1B31;
  margin: 0 0 6px;
  text-align: center;
}

.contact-modal-subtitle {
  font-size: 13px;
  color: #6B7280;
  text-align: center;
  margin: 0 0 16px;
  line-height: 1.5;
}

.contact-modal-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.contact-modal-textarea:focus {
  border-color: #00B87A;
}

.contact-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.contact-modal-cancel {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  background: #fff;
  color: #6B7280;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.contact-modal-submit {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: none;
  background: #00B87A;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.contact-modal-submit:hover:not(:disabled) {
  background: #009D68;
}

.contact-modal-submit:disabled {
  background: #D1D5DB;
  cursor: default;
}

