/**
 * OmniCRM Contacts Feature Slice Styles
 * Scoped styles for contacts search, grid layout, contact cards, badges, interaction history, and dossier.
 */

/* Feature Container */
.contacts-feature-container {
  width: 100%;
}

/* Search & Filter Bar */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--card-bg, #0f172a);
  border: 1px solid var(--card-border, #1e293b);
  color: var(--text-bright, #ffffff);
  padding: 11px 14px 11px 38px;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 12px;
  color: var(--text-muted, #94a3b8);
  font-size: 14px;
  pointer-events: none;
}

/* Filter Strip */
.tier-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-btn {
  cursor: pointer;
  background: var(--card-bg, #0f172a);
  border: 1px solid var(--card-border, #1e293b);
  color: var(--text-muted, #94a3b8);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  user-select: none;
}

.filter-btn:hover {
  color: var(--text-bright, #ffffff);
  border-color: var(--card-border-hover, #334155);
}

.filter-btn.active {
  background: var(--primary, #3b82f6);
  color: #ffffff;
  border-color: var(--primary, #3b82f6);
  font-weight: 600;
}

/* Contacts Card Grid */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

/* Empty State Card */
.contacts-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted, #94a3b8);
  background: var(--card-bg, #0f172a);
  border-radius: 12px;
  border: 1px dashed var(--card-border, #1e293b);
}

.contacts-empty-icon {
  font-size: 38px;
  margin-bottom: 12px;
}

.contacts-empty-title {
  color: var(--text-bright, #ffffff);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.contacts-empty-desc {
  font-size: 13px;
  max-width: 440px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

/* Contact Card */
.contact-card {
  background: var(--card-bg, #0f172a);
  border: 1px solid var(--card-border, #1e293b);
  border-radius: 12px;
  padding: 18px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  box-sizing: border-box;
}

.contact-card:hover {
  transform: translateY(-2px);
  border-color: var(--card-border-hover, #334155);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.contact-card.is-me-card {
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.04), var(--card-bg, #0f172a));
}

.contact-card.is-business-card {
  border: 1px solid rgba(59, 130, 246, 0.4);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.05), var(--card-bg, #0f172a));
}

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.avatar.me-avatar {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.avatar.business-avatar {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  border-radius: 10px;
  font-size: 20px;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.card-titles {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright, #ffffff);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

/* Tier and Badges */
.tier-badge {
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  background: #1e293b;
  color: #60a5fa;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
}

.tier-badge.me-badge {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: #ffffff;
}

/* Labels and Pills */
.contact-labels-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.contact-label-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.label-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

/* Communication Channels */
.channels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.channel-chip {
  font-size: 11px;
  background: #1e293b;
  color: #93c5fd;
  padding: 4px 10px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s ease;
}

.channel-chip:hover {
  background: #334155;
}

/* Facts Box */
.facts-box {
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 12px;
}

.facts-box strong {
  color: #93c5fd;
}

.fact-item {
  margin-bottom: 4px;
}

.fact-item:last-child {
  margin-bottom: 0;
}

/* Card Footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
}

.card-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-footer-action {
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.15s;
}

.card-footer-action:hover {
  opacity: 0.8;
}

/* Contact 360 Slide-Over Dossier Drawer */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.drawer-backdrop.open {
  display: block;
  opacity: 1;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 94vw;
  background: #0b111e;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -15px 0 40px rgba(0, 0, 0, 0.7);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-panel.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--card-border, #1e293b);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: rgba(15, 23, 42, 0.6);
}

.dossier-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dossier-title-group {
  display: flex;
  flex-direction: column;
}

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

.dossier-title-row h2 {
  color: var(--text-bright, #ffffff);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.dossier-headline {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  margin-top: 3px;
}

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--card-border, #1e293b);
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border, #1e293b);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s ease;
}

.drawer-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-bright, #ffffff);
}

.dossier-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
  flex-shrink: 0;
}

.dossier-avatar.me-avatar {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
}

.dossier-avatar.business-avatar {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  border-radius: 14px;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.4);
}

.dossier-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-ask-ai {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
}

.dossier-section {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--card-border, #1e293b);
  border-radius: 10px;
  padding: 16px;
}

.dossier-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.dossier-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #93c5fd;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fact-tag {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fact-tag strong {
  color: #93c5fd;
  font-weight: 600;
}

.dossier-roster-heading {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-bright, #ffffff);
  margin-bottom: 8px;
}

.dossier-notes-text {
  font-size: 13px;
  color: var(--text, #e2e8f0);
  line-height: 1.6;
  white-space: pre-wrap;
}

.dossier-pulse-text {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
}

.dossier-footer-hint {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

.badge-pro {
  background: rgba(139, 92, 246, 0.2);
  color: #c084fc;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
}

/* Modals inside feature */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-title {
  color: var(--text-bright, #ffffff);
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.modal-subtext {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 8px;
}

.relationship-options-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.modal-custom-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 12px;
}

/* Shimmer Skeleton Loaders */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-card {
  background: var(--card-bg, #0f172a);
  border: 1px solid var(--card-border, #1e293b);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  flex-shrink: 0;
}

.skeleton-line {
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
