/* Chatwoot Design System - Authentic Styles */

/* ===== Layout ===== */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background-color: var(--color-background);
}

/* When inside main layout */
main .app-wrapper {
  height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.conversation-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: white;
  height: 100%;
}

/* ===== Icon Sizes ===== */
.icon {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  vertical-align: middle;
}

.icon--tiny {
  width: 0.75rem;
  height: 0.75rem;
}

.icon--small {
  width: 1.25rem;
  height: 1.25rem;
}

.icon--medium {
  width: 1.5rem;
  height: 1.5rem;
}

.icon--large {
  width: 2rem;
  height: 2rem;
}

.icon--xlarge {
  width: 3rem;
  height: 3rem;
}

/* ===== CSS Variables ===== */
:root {
  /* Primary Colors */
  --color-woot: #1f93ff;
  --color-woot-darker: #1976d2;
  --color-woot-lighter: #66b3ff;
  --color-woot-light: #e3f2ff;
  --color-woot-extra-light: #f5f9ff;
  
  /* Status Colors */
  --color-success: #44ce4b;
  --color-success-light: #e6f8e7;
  --color-error: #ff382d;
  --color-error-light: #ffebe9;
  --color-warning: #ff9800;
  --color-warning-light: #fff4e5;
  --color-info: #1f93ff;
  --color-info-light: #e3f2ff;
  
  /* Neutral Colors */
  --color-body: #3c4858;
  --color-heading: #1f2d3d;
  --color-border: #e0e6ed;
  --color-border-light: #f5f7fa;
  --color-background: #f9fafc;
  --color-background-light: #ffffff;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-size-nano: 0.625rem;
  --font-size-micro: 0.6875rem;
  --font-size-mini: 0.75rem;
  --font-size-small: 0.875rem;
  --font-size-default: 1rem;
  --font-size-medium: 1.125rem;
  --font-size-large: 1.25rem;
  
  /* Border Radius */
  --border-radius-small: 0.25rem;
  --border-radius-normal: 0.375rem;
  --border-radius-medium: 0.5rem;
  --border-radius-large: 0.75rem;
  --border-radius-rounded: 9999px;
  
  /* Spacing */
  --space-micro: 0.125rem;
  --space-smaller: 0.25rem;
  --space-small: 0.5rem;
  --space-one: 0.75rem;
  --space-slab: 1rem;
  --space-normal: 1.25rem;
  --space-two: 1.5rem;
  --space-medium: 2rem;
  --space-large: 2.5rem;
  --space-larger: 3rem;
  --space-jumbo: 4rem;
  --space-mega: 5rem;
}

/* ===== Typography ===== */
.chatwoot {
  font-family: var(--font-family);
  font-size: var(--font-size-default);
  color: var(--color-body);
}

.chatwoot h1, .chatwoot h2, .chatwoot h3, .chatwoot h4, .chatwoot h5, .chatwoot h6 {
  color: var(--color-heading);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

.chatwoot h1 { font-size: 2rem; }
.chatwoot h2 { font-size: 1.5rem; }
.chatwoot h3 { font-size: 1.25rem; }
.chatwoot h4 { font-size: 1.125rem; }
.chatwoot h5 { font-size: 1rem; }
.chatwoot h6 { font-size: 0.875rem; }

/* ===== Buttons ===== */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-small) var(--space-slab);
  font-size: var(--font-size-small);
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--border-radius-normal);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  gap: var(--space-small);
}

.button:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button--primary {
  background-color: var(--color-woot);
  color: white;
  border-color: var(--color-woot);
}

.button--primary:hover:not(:disabled) {
  background-color: var(--color-woot-darker);
  border-color: var(--color-woot-darker);
}

.button--secondary {
  background-color: white;
  color: var(--color-body);
  border-color: var(--color-border);
}

.button--secondary:hover:not(:disabled) {
  background-color: var(--color-background);
  border-color: var(--color-border);
}

.button--danger {
  background-color: var(--color-error);
  color: white;
  border-color: var(--color-error);
}

.button--danger:hover:not(:disabled) {
  background-color: #e62e24;
  border-color: #e62e24;
}

.button--small {
  padding: var(--space-smaller) var(--space-small);
  font-size: var(--font-size-mini);
}

.button--large {
  padding: var(--space-one) var(--space-two);
  font-size: var(--font-size-default);
}

.button--block {
  width: 100%;
}

.button--icon {
  padding: var(--space-small);
  background: transparent;
  color: #8492a6;
}

.button--icon:hover {
  background-color: #f5f7fa;
  color: var(--color-body);
}

.button--icon.button--active {
  color: var(--color-woot);
  background-color: #e3f2ff;
}

.button--white-transparent {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.button--white-transparent:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== Forms ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-slab);
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-small);
}

.form-label {
  font-size: var(--font-size-small);
  font-weight: 500;
  color: var(--color-heading);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-small) var(--space-one);
  font-size: var(--font-size-small);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-normal);
  background-color: white;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-woot);
  box-shadow: 0 0 0 3px rgba(31, 147, 255, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 5rem;
}

/* ===== Cards ===== */
.card {
  background-color: white;
  border-radius: var(--border-radius-medium);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card__header {
  padding: var(--space-normal);
  border-bottom: 1px solid var(--color-border-light);
}

.card__body {
  padding: var(--space-normal);
}

.card__footer {
  padding: var(--space-normal);
  border-top: 1px solid var(--color-border-light);
  background-color: var(--color-background);
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-micro) var(--space-small);
  font-size: var(--font-size-mini);
  font-weight: 500;
  border-radius: var(--border-radius-rounded);
  gap: var(--space-smaller);
}

.badge--small {
  padding: var(--space-micro) var(--space-smaller);
  font-size: var(--font-size-nano);
}

.badge--primary {
  background-color: var(--color-info-light);
  color: var(--color-woot);
}

.badge--success {
  background-color: var(--color-success-light);
  color: #2f9e36;
}

.badge--warning {
  background-color: var(--color-warning-light);
  color: #cc7a00;
}

.badge--danger {
  background-color: var(--color-error-light);
  color: #cc2e24;
}

/* ===== Avatar ===== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--color-woot);
  color: white;
  font-weight: 600;
  font-size: var(--font-size-small);
  flex-shrink: 0;
}

.avatar--tiny {
  width: 2rem;
  height: 2rem;
  font-size: var(--font-size-mini);
}

.avatar--small {
  width: 2.5rem;
  height: 2.5rem;
  font-size: var(--font-size-small);
}

.avatar--medium {
  width: 3rem;
  height: 3rem;
  font-size: var(--font-size-default);
}

.avatar--large {
  width: 5rem;
  height: 5rem;
  font-size: var(--font-size-large);
}

.avatar--agent {
  background-color: var(--color-woot-light);
  color: var(--color-woot);
}

.avatar-wrapper {
  position: relative;
}

.avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid white;
  border-radius: 50%;
}

.avatar-status--online {
  background-color: var(--color-success);
}

.avatar-status--offline {
  background-color: #8492a6;
}

/* ===== Sidebar ===== */
.sidebar {
  background-color: white;
  border-right: 1px solid var(--color-border-light);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.sidebar--conversation-list {
  width: 24rem;
  flex-shrink: 0;
}

.sidebar--contact {
  width: 20rem;
  border-left: 1px solid var(--color-border-light);
  border-right: none;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-header {
  padding: var(--space-normal);
  border-bottom: 1px solid var(--color-border-light);
  background-color: var(--color-woot);
  flex-shrink: 0;
}

.sidebar-header__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header__title {
  color: white;
  font-size: var(--font-size-large);
  font-weight: 600;
  margin: 0;
}

.sidebar-header__subtitle {
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--font-size-small);
  margin: var(--space-smaller) 0 0;
}

.sidebar-tabs {
  padding: var(--space-one) var(--space-slab);
  background-color: #f5f7fa;
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.tabs {
  display: flex;
  gap: var(--space-smaller);
}

.tab {
  padding: var(--space-small) var(--space-one);
  font-size: var(--font-size-small);
  font-weight: 500;
  border-radius: var(--border-radius-normal);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-body);
  transition: all 0.2s;
}

.tab:hover {
  background-color: #e8eaf0;
}

.tab--active {
  background-color: var(--color-woot);
  color: white;
}

/* ===== Conversation List ===== */
.conversation-list {
  flex: 1;
  overflow-y: auto;
  background-color: #f5f7fa;
}

.conversation-item {
  padding: var(--space-slab);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid #e8eaf0;
  background-color: white;
}

.conversation-item:hover {
  background-color: #f8f9fa;
}

.conversation-item--active {
  background-color: #e3f2ff;
  border-left: 4px solid var(--color-woot);
}

.conversation-item__content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-one);
}

.conversation-item__details {
  flex: 1;
  min-width: 0;
}

.conversation-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-smaller);
}

.conversation-item__name {
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--color-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item__time {
  font-size: var(--font-size-mini);
  color: #8492a6;
  white-space: nowrap;
  margin-left: var(--space-small);
}

.conversation-item__message {
  font-size: var(--font-size-small);
  color: var(--color-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: var(--space-small);
}

.conversation-item__meta {
  display: flex;
  align-items: center;
  gap: var(--space-small);
}

.conversation-item__assignee {
  font-size: var(--font-size-mini);
  color: #8492a6;
}

/* ===== Conversation Header ===== */
.conversation-header {
  padding: var(--space-slab) var(--space-normal);
  background-color: white;
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.conversation-header__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.conversation-header__info {
  display: flex;
  align-items: center;
  gap: var(--space-slab);
}

.conversation-header__details {
  display: flex;
  flex-direction: column;
}

.conversation-header__title {
  font-size: var(--font-size-medium);
  font-weight: 600;
  color: var(--color-heading);
  margin: 0;
}

.conversation-header__meta {
  display: flex;
  align-items: center;
  gap: var(--space-small);
  font-size: var(--font-size-small);
  color: var(--color-body);
  margin-top: var(--space-smaller);
}

.conversation-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-small);
}

/* ===== Messages ===== */
.messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-normal) var(--space-normal);
  background-color: #f9fafc;
}

.messages-list {
  max-width: 64rem;
  margin: 0 auto;
}

.date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-normal) 0;
}

.date-separator__line {
  flex: 1;
  height: 1px;
  background-color: var(--color-border-light);
}

.date-separator__text {
  padding: 0 var(--space-slab);
  font-size: var(--font-size-mini);
  color: #8492a6;
  font-weight: 500;
}

.message-wrap {
  display: flex;
  margin-bottom: var(--space-slab);
}

.message-wrap--user {
  justify-content: flex-start;
}

.message-wrap--agent {
  justify-content: flex-end;
}

.message {
  display: flex;
  align-items: flex-end;
  gap: var(--space-small);
  max-width: 42rem;
}

.message__content {
  display: flex;
  flex-direction: column;
}

.message__bubble {
  padding: var(--space-small) var(--space-slab);
  border-radius: var(--border-radius-large);
  word-wrap: break-word;
}

.message__bubble--user {
  background-color: white;
  color: var(--color-body);
  border: 1px solid var(--color-border-light);
  border-bottom-left-radius: var(--border-radius-small);
  box-shadow: var(--shadow-sm);
}

.message__bubble--agent {
  background-color: var(--color-woot);
  color: white;
  border-bottom-right-radius: var(--border-radius-small);
}

.message__text {
  font-size: var(--font-size-small);
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
}

.message__meta {
  display: flex;
  align-items: center;
  gap: var(--space-small);
  margin-top: var(--space-smaller);
  padding: 0 var(--space-smaller);
}

.message__time {
  font-size: var(--font-size-mini);
  color: #8492a6;
}

.message__agent {
  font-size: var(--font-size-mini);
  color: #8492a6;
}

.message__status {
  display: flex;
  align-items: center;
}

/* ===== System Messages ===== */
.message-wrap--system {
  justify-content: center;
  margin: var(--space-normal) 0;
}

.system-message {
  display: flex;
  justify-content: center;
  width: 100%;
}

.system-message__content {
  display: inline-flex;
  align-items: center;
  gap: var(--space-small);
  padding: var(--space-small) var(--space-normal);
  background-color: var(--color-background-light);
  border-radius: var(--border-radius-large);
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.system-message__icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.system-message__text {
  font-weight: 500;
}

.system-message__time {
  color: var(--color-text-muted);
  font-size: var(--font-size-mini);
  margin-left: var(--space-small);
}

/* ===== Message Media ===== */
.message__media {
  margin-bottom: var(--space-small);
}

.message__media-image {
  max-width: 300px;
  max-height: 300px;
  border-radius: var(--border-radius-normal);
  cursor: pointer;
  display: block;
}

.message__media-audio {
  max-width: 300px;
  display: block;
}

.message__media-video {
  max-width: 400px;
  max-height: 300px;
  border-radius: var(--border-radius-normal);
  display: block;
}

.message__media-document {
  display: inline-flex;
  align-items: center;
  gap: var(--space-small);
  padding: var(--space-small) var(--space-slab);
  background-color: var(--color-background-light);
  border-radius: var(--border-radius-normal);
  text-decoration: none;
  color: var(--color-text);
  transition: background-color 0.2s;
}

.message__media-document:hover {
  background-color: var(--color-border-light);
}

.message__media-size {
  font-size: var(--font-size-mini);
  color: var(--color-text-muted);
}

/* ===== Conversation Footer ===== */
.conversation-footer {
  padding: var(--space-slab) var(--space-normal);
  background-color: white;
  border-top: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.message-input {
  display: flex;
  align-items: flex-end;
  gap: var(--space-one);
}

.message-input__wrap {
  flex: 1;
  position: relative;
}

.message-input__textarea {
  width: 100%;
  min-height: 2.5rem;
  max-height: 7.5rem;
  padding: var(--space-small) 3rem var(--space-small) var(--space-slab);
  font-size: var(--font-size-small);
  line-height: 1.5;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-rounded);
  resize: none;
  outline: none;
  transition: all 0.2s ease;
}

.message-input__textarea:focus {
  border-color: var(--color-woot);
  box-shadow: 0 0 0 3px rgba(31, 147, 255, 0.1);
}

.message-input__textarea:disabled {
  background-color: var(--color-background);
  cursor: not-allowed;
}

.message-input__actions {
  position: absolute;
  right: var(--space-small);
  bottom: var(--space-small);
  display: flex;
  align-items: center;
  gap: var(--space-smaller);
}

/* ===== Empty State ===== */
.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f9fafc;
}

.empty-state__content {
  text-align: center;
}

.empty-state__icon {
  width: 6rem;
  height: 6rem;
  background-color: #e3f2ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-slab);
}

.empty-state__title {
  font-size: var(--font-size-medium);
  font-weight: 500;
  color: var(--color-heading);
  margin: 0 0 var(--space-smaller);
}

.empty-state__text {
  color: var(--color-body);
  font-size: var(--font-size-small);
}

/* ===== Contact Panel ===== */
.contact-header {
  padding: var(--space-normal);
  border-bottom: 1px solid var(--color-border-light);
  background-color: #f9fafc;
}

.contact-header__content {
  text-align: center;
}

.contact-header__name {
  font-size: var(--font-size-medium);
  font-weight: 600;
  color: var(--color-heading);
  margin: var(--space-slab) 0 var(--space-smaller);
}

.contact-header__role {
  font-size: var(--font-size-small);
  color: var(--color-body);
  margin: 0 0 var(--space-small);
}

.contact-section {
  padding: var(--space-normal);
  border-bottom: 1px solid var(--color-border-light);
}

.contact-section__title {
  font-size: var(--font-size-mini);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8492a6;
  margin: 0 0 var(--space-one);
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-one);
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-smaller);
}

.info-item__label {
  font-size: var(--font-size-mini);
  color: #8492a6;
}

.info-item__value {
  font-size: var(--font-size-small);
  color: var(--color-body);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-small);
}

/* ===== Status Badge ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-small);
  font-size: var(--font-size-small);
}

.status-badge--online {
  color: var(--color-success);
}

.status-indicator {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.status-indicator--online {
  background-color: var(--color-success);
}

/* ===== Utility Classes ===== */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-small {
  font-size: var(--font-size-small);
}

.text-mini {
  font-size: var(--font-size-mini);
}

.text-muted {
  color: #8492a6;
}

.text-primary {
  color: var(--color-woot);
}

.text-success {
  color: var(--color-success);
}

.text-danger {
  color: var(--color-error);
}

.text-warning {
  color: var(--color-warning);
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow {
  box-shadow: var(--shadow);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

/* ===== Loading States ===== */
.spinner {
  animation: spin 0.8s linear infinite;
}

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

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-background);
}

::-webkit-scrollbar-thumb {
  background: #c1c9d2;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #8492a6;
}

/* ===== Animations ===== */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.2s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

.slide-enter-active,
.slide-leave-active {
  transition: transform 0.2s ease;
}

.slide-enter-from,
.slide-leave-to {
  transform: translateX(100%);
}

.scale-enter-active,
.scale-leave-active {
  transition: transform 0.2s ease;
}

.scale-enter-from,
.scale-leave-to {
  transform: scale(0.95);
}

/* ===== Responsive Helpers ===== */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}

/* ===== Dark Mode Support ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --color-body: #a1a8b8;
    --color-heading: #e1e6ed;
    --color-border: #384250;
    --color-border-light: #2d3747;
    --color-background: #1b2330;
    --color-background-light: #273142;
  }
  
  .card,
  .conversation-item,
  .sidebar,
  .conversation-header,
  .conversation-footer {
    background-color: var(--color-background-light);
  }
  
  .message__bubble--user {
    background-color: var(--color-background-light);
    border-color: var(--color-border);
  }
}