/* ============================================================
   ElisIA Salesforce — Feature Components (WhatsApp Dark Mode (CSS Variables))
   Target: /opt/elisia-salesforce/public/
   Depends on: variables.css
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   0. Keyframe Animations
   ───────────────────────────────────────────────────────────── */

@keyframes sf-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sf-command-enter {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sf-slash-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sf-modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes sf-slide-in-right {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes sf-slide-out-right {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ─────────────────────────────────────────────────────────────
   1. Command Bar  (Ctrl+K / Cmd+K)
   ───────────────────────────────────────────────────────────── */

/* --- Overlay --- */
.sf-command-bar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-command-bar, 1300);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  animation: sf-fade-in var(--transition-fast, 120ms) ease;
}

/* --- Bar container --- */
.sf-command-bar {
  width: 560px;
  max-width: calc(100vw - 32px);
  background: var(--bg-secondary, #202c33);
  border: 1px solid var(--border-color, #313d45);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  animation: sf-command-enter 200ms ease;
}

/* --- Search input row --- */
.sf-command-bar-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color, #313d45);
}

.sf-command-bar-input-row .sf-search-icon {
  width: 20px;
  height: 20px;
  color: #8696A0;
  flex-shrink: 0;
}

.sf-command-bar-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary, #e9edef);
  font-size: 16px;
  font-family: var(--font-family, 'Segoe UI', Helvetica, Arial, sans-serif);
  line-height: 1.4;
}

.sf-command-bar-input::placeholder {
  color: #8696A0;
}

/* --- Results list --- */
.sf-command-bar-results {
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sf-command-bar-results::-webkit-scrollbar {
  width: 6px;
}

.sf-command-bar-results::-webkit-scrollbar-thumb {
  background: rgba(134,150,160,0.3);
  border-radius: 3px;
}

.sf-command-bar-results::-webkit-scrollbar-track {
  background: transparent;
}

/* --- Group label inside results --- */
.sf-command-bar-group-label {
  padding: 8px 18px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8696A0;
}

/* --- Result item --- */
.sf-command-bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background var(--transition-fast, 120ms);
}

.sf-command-bar-item:hover {
  background: var(--wa-hover, #2a3942);
}

.sf-command-bar-item.sf-highlighted {
  background: rgba(0, 128, 105, 0.08);
}

/* --- Item icon --- */
.sf-command-bar-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--wa-hover, #2a3942);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #667781;
  font-size: 14px;
}

.sf-command-bar-item-icon img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* --- Item text --- */
.sf-command-bar-item-text {
  flex: 1;
  min-width: 0;
}

.sf-command-bar-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #e9edef);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-command-bar-item-phone {
  font-size: 11px;
  color: #8696A0;
  margin-top: 1px;
}

/* --- Item meta (right side) --- */
.sf-command-bar-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sf-command-bar-item-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(0, 128, 105, 0.08);
  color: var(--primary, #00a884);
  white-space: nowrap;
}

.sf-command-bar-item-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: var(--primary, #00a884);
  color: var(--bg-secondary, #202c33);
  font-size: 10px;
  font-weight: 700;
}

/* --- Footer --- */
.sf-command-bar-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 18px;
  border-top: 1px solid var(--border-color, #313d45);
  font-size: 10px;
  color: #8696A0;
}

.sf-command-bar-footer kbd,
.sf-command-bar-footer .sf-esc-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: var(--wa-hover, #2a3942);
  color: #667781;
  border: 1px solid var(--border-color, #313d45);
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font-mono, 'Consolas', monospace);
  font-weight: 500;
  line-height: 1.6;
}

/* --- Empty state --- */
.sf-command-bar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  color: #8696A0;
  font-size: 13px;
  text-align: center;
  gap: 8px;
}

.sf-command-bar-empty-icon {
  font-size: 32px;
  opacity: 0.5;
}


/* ─────────────────────────────────────────────────────────────
   2. Slash Dropdown  (/cmd autocomplete)
   ───────────────────────────────────────────────────────────── */

.sf-slash-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  background: var(--bg-secondary, #202c33);
  border: 1px solid var(--border-color, #313d45);
  border-radius: 10px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.1);
  max-height: 260px;
  overflow-y: auto;
  z-index: var(--z-dropdown, 100);
  animation: sf-slash-enter 150ms ease;
}

.sf-slash-dropdown::-webkit-scrollbar {
  width: 5px;
}

.sf-slash-dropdown::-webkit-scrollbar-thumb {
  background: rgba(134,150,160,0.3);
  border-radius: 3px;
}

.sf-slash-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

/* --- Header (optional) --- */
.sf-slash-dropdown-header {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8696A0;
}

/* --- Item --- */
.sf-slash-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--transition-fast, 120ms);
}

.sf-slash-dropdown-item:hover {
  background: var(--wa-hover, #2a3942);
}

.sf-slash-dropdown-item.sf-highlighted {
  background: rgba(0, 128, 105, 0.08);
}

.sf-slash-dropdown-item:first-child {
  border-radius: 10px 10px 0 0;
}

.sf-slash-dropdown-item:last-child {
  border-radius: 0 0 10px 10px;
}

/* --- Item icon --- */
.sf-slash-dropdown-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--wa-hover, #2a3942);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary, #00a884);
  font-size: 13px;
}

/* --- Item text --- */
.sf-slash-dropdown-item-text {
  flex: 1;
  min-width: 0;
}

.sf-slash-dropdown-item-cmd {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary, #00a884);
}

.sf-slash-dropdown-item-desc {
  font-size: 12px;
  color: #667781;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ─────────────────────────────────────────────────────────────
   3. Shortcuts Overlay  (? key)
   ───────────────────────────────────────────────────────────── */

.sf-shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-shortcuts, 1400);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal, 200ms);
}

.sf-shortcuts-overlay.sf-visible {
  opacity: 1;
  pointer-events: auto;
}

/* --- Modal --- */
.sf-shortcuts-modal {
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: var(--bg-secondary, #202c33);
  border: 1px solid var(--border-color, #313d45);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  animation: sf-modal-enter 200ms ease;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.sf-shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #313d45);
}

.sf-shortcuts-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #e9edef);
}

.sf-shortcuts-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #667781;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast, 120ms);
}

.sf-shortcuts-close:hover {
  background: var(--wa-hover, #2a3942);
  color: var(--text-primary, #e9edef);
}

/* --- Body / Grid --- */
.sf-shortcuts-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.sf-shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
}

/* --- Section label inside grid --- */
.sf-shortcuts-section-label {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8696A0;
  padding: 10px 0 4px;
  margin-top: 4px;
}

.sf-shortcuts-section-label:first-child {
  margin-top: 0;
  padding-top: 0;
}

/* --- Shortcut row --- */
.sf-shortcuts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
}

.sf-shortcuts-row:hover {
  background: var(--wa-hover, #2a3942);
}

.sf-shortcuts-label {
  font-size: 12px;
  color: #667781;
}

.sf-shortcuts-keys {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sf-shortcuts-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 2px 6px;
  background: var(--wa-hover, #2a3942);
  color: var(--text-primary, #e9edef);
  border: 1px solid var(--border-color, #313d45);
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font-mono, 'Consolas', monospace);
  font-weight: 500;
  line-height: 1.6;
}

.sf-shortcuts-plus {
  font-size: 10px;
  color: #8696A0;
}


/* ─────────────────────────────────────────────────────────────
   4. Media Toast  (upload feedback)
   ───────────────────────────────────────────────────────────── */

.sf-media-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary, #202c33);
  border: 1px solid var(--border-color, #313d45);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 10px 18px;
  color: var(--text-primary, #e9edef);
  font-size: 13px;
  font-family: var(--font-family, 'Segoe UI', Helvetica, Arial, sans-serif);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: var(--z-toast, 2000);
  animation: sf-fade-in 200ms ease;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}

.sf-media-toast-icon {
  flex-shrink: 0;
  font-size: 16px;
}

.sf-media-toast-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-media-toast.sf-media-toast-error {
  border-color: var(--danger, #ea0038);
}

.sf-media-toast.sf-media-toast-error .sf-media-toast-icon {
  color: var(--danger, #ea0038);
}

.sf-media-toast.sf-media-toast-success {
  border-color: #25D366;
}

.sf-media-toast.sf-media-toast-success .sf-media-toast-icon {
  color: #25D366;
}

/* --- Progress bar (optional inside toast) --- */
.sf-media-toast-progress {
  width: 100%;
  height: 3px;
  background: var(--border-color, #313d45);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.sf-media-toast-progress-bar {
  height: 100%;
  background: var(--primary, #00a884);
  border-radius: 2px;
  transition: width 300ms ease;
}


/* ─────────────────────────────────────────────────────────────
   5. Notification Toast  (top-right stack)
   ───────────────────────────────────────────────────────────── */

.sf-notification-toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: var(--z-toast, 2000);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 380px;
}

.sf-notification-toast {
  background: var(--bg-secondary, #202c33);
  border: 1px solid var(--border-color, #313d45);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: auto;
  animation: sf-slide-in-right 300ms ease;
  cursor: pointer;
  transition: opacity var(--transition-normal, 200ms),
              transform var(--transition-normal, 200ms);
}

.sf-notification-toast:hover {
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.14);
}

.sf-notification-toast.sf-removing {
  animation: sf-slide-out-right 250ms ease forwards;
}

/* --- Toast icon --- */
.sf-notification-toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--wa-hover, #2a3942);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary, #00a884);
  font-size: 16px;
}

.sf-notification-toast-icon img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* --- Toast body --- */
.sf-notification-toast-body {
  flex: 1;
  min-width: 0;
}

.sf-notification-toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e9edef);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-notification-toast-message {
  font-size: 12px;
  color: #667781;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sf-notification-toast-time {
  font-size: 10px;
  color: #8696A0;
  margin-top: 4px;
}

/* --- Toast close button --- */
.sf-notification-toast-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #8696A0;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-fast, 120ms),
              background var(--transition-fast, 120ms);
}

.sf-notification-toast:hover .sf-notification-toast-close {
  opacity: 1;
}

.sf-notification-toast-close:hover {
  background: var(--wa-hover, #2a3942);
  color: var(--text-primary, #e9edef);
}

/* --- Type variants --- */
.sf-notification-toast.sf-toast-success .sf-notification-toast-icon {
  background: rgba(37, 211, 102, 0.1);
  color: #25D366;
}

.sf-notification-toast.sf-toast-warning .sf-notification-toast-icon {
  background: rgba(227, 116, 0, 0.1);
  color: #E37400;
}

.sf-notification-toast.sf-toast-error .sf-notification-toast-icon {
  background: rgba(217, 48, 37, 0.1);
  color: var(--danger, #ea0038);
}

.sf-notification-toast.sf-toast-info .sf-notification-toast-icon {
  background: rgba(0, 128, 105, 0.1);
  color: var(--primary, #00a884);
}
