/**
 * NovaEpin - Realtime Notifications & Sonraki Hamlem (Next Best Action) Styles
 */

/* ==========================================================================
   0. Header Action Container Flex Resilience
   ========================================================================== */
.header-actions {
  flex-shrink: 0 !important;
  gap: 10px !important;
}

@media (max-width: 1400px) {
  .btn-top-marketplace span {
    display: none;
  }
  .btn-top-marketplace {
    padding: 0 10px !important;
  }
}

/* ==========================================================================
   1. Header Message Trigger & Pulse Badge
   ========================================================================== */
.header-msg-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  transition: all 0.25s ease;
  text-decoration: none;
}

.header-msg-trigger:hover {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.35);
  color: #c084fc;
  transform: translateY(-1px);
}

.header-msg-trigger.has-unread {
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.4);
}

.msg-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
  border: 2px solid #0b0f19;
  line-height: 1;
  animation: badgePulse 2.5s infinite;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 18px rgba(236, 72, 153, 0.9);
  }
}

.user-dd-item.highlight-msg {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  box-sizing: border-box;
}

.user-dd-badge {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  margin-left: auto;
  line-height: 1.2;
  flex-shrink: 0;
}

[data-theme="light"] .user-dd-item.highlight-msg {
  color: #334155;
}

[data-theme="light"] .user-dd-item.highlight-msg:hover {
  background: #f1f5f9;
  color: #7c3aed;
}

[data-theme="light"] .user-dd-badge {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  color: #ffffff;
}

/* ==========================================================================
   2. Header "Sonraki Hamlem" Smart Interactive Pill
   ========================================================================== */
.header-next-action-wrap {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
}

.btn-top-next-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.28);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 0.82rem;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  max-width: 320px;
}

.btn-top-next-action:hover {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.25);
  transform: translateY(-1px);
  color: #fff;
}

.next-action-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a855f7;
  box-shadow: 0 0 8px #a855f7;
  animation: radarDot 1.8s infinite;
  flex-shrink: 0;
}

@keyframes radarDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

.next-action-text-label {
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.next-action-title {
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.next-action-arrow {
  color: #a855f7;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.btn-top-next-action:hover .next-action-arrow {
  transform: translateX(3px);
}

/* ==========================================================================
   3. Realtime Live Message Toast Notification (Bottom-Right)
   ========================================================================== */
.live-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.live-message-toast {
  pointer-events: auto;
  position: relative;
  width: 380px;
  max-width: 100%;
  background: rgba(15, 20, 32, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 24px rgba(168, 85, 247, 0.2);
  padding: 14px 16px;
  overflow: hidden;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
}

.live-message-toast:hover {
  transform: translateY(-2px);
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.65), 0 0 30px rgba(168, 85, 247, 0.3);
}

.live-message-toast.toast-hiding {
  animation: toastSlideOut 0.3s forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(80px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(80px) scale(0.95);
  }
}

.toast-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.toast-sender-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toast-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #a855f7;
  background: #1e1b4b;
}

.toast-sender-info {
  display: flex;
  flex-direction: column;
}

.toast-sender-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.toast-listing-title {
  font-size: 0.72rem;
  color: #94a3b8;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-time {
  font-size: 0.72rem;
  color: #64748b;
  margin-right: 6px;
}

.toast-close-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.toast-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.toast-message-body {
  font-size: 0.84rem;
  color: #e2e8f0;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  word-break: break-word;
}

.toast-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-toast-reply {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.35);
}

.btn-toast-reply:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(168, 85, 247, 0.5);
  color: #fff;
}

.toast-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2.5px;
  background: linear-gradient(90deg, #a855f7, #38bdf8);
  width: 100%;
  transform-origin: left;
  animation: toastCountdown 8s linear forwards;
}

@keyframes toastCountdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ==========================================================================
   4. Account Dashboard "Sonraki Hamlem" Widget (.next-best-action-card)
   ========================================================================== */
.next-best-action-card {
  position: relative;
  margin-bottom: 20px;
  border-radius: 16px;
  background: #0f1422;
  border: 1px solid var(--nba-border, rgba(168, 85, 247, 0.35));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 25px var(--nba-bg-glow, rgba(168, 85, 247, 0.15));
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.next-best-action-card:hover {
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 35px var(--nba-bg-glow, rgba(168, 85, 247, 0.25));
  border-color: var(--nba-color, #a855f7);
}

.nba-card-glow-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: radial-gradient(circle at top left, var(--nba-bg-glow, rgba(168, 85, 247, 0.18)), transparent 65%);
  pointer-events: none;
}

.nba-card-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 18px 22px;
  gap: 18px;
}

.nba-icon-box {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--nba-border, rgba(168, 85, 247, 0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.nba-radar-ping {
  position: absolute;
  inset: -3px;
  border-radius: 16px;
  border: 2px solid var(--nba-color, #a855f7);
  opacity: 0.7;
  animation: radarPing 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}

@keyframes radarPing {
  0% { transform: scale(0.95); opacity: 0.8; }
  75%, 100% { transform: scale(1.3); opacity: 0; }
}

.nba-body {
  flex: 1;
  min-width: 0;
}

.nba-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.nba-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--nba-color, #a855f7);
}

.nba-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--nba-bg-glow, rgba(168, 85, 247, 0.15));
  border: 1px solid var(--nba-border, rgba(168, 85, 247, 0.3));
  color: var(--nba-color, #c084fc);
}

.nba-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px 0;
  letter-spacing: -0.2px;
}

.nba-message {
  font-size: 0.84rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.45;
}

.nba-secondary-list {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.nba-sec-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
}

.nba-sec-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 3px 8px;
  text-decoration: none;
  transition: all 0.2s;
}

.nba-sec-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.nba-action-zone {
  flex-shrink: 0;
}

.btn-nba-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 11px;
  background: var(--nba-color, #a855f7);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 18px var(--nba-bg-glow, rgba(168, 85, 247, 0.35));
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-nba-cta:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 22px var(--nba-bg-glow, rgba(168, 85, 247, 0.5));
  transform: translateY(-2px);
  color: #ffffff;
}

.btn-nba-cta i {
  transition: transform 0.2s ease;
}

.btn-nba-cta:hover i {
  transform: translateX(4px);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 868px) {
  .nba-card-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 14px;
  }
  .nba-action-zone {
    width: 100%;
  }
  .btn-nba-cta {
    width: 100%;
    justify-content: center;
  }
  .header-next-action-wrap {
    display: none !important;
  }
  .live-toast-container {
    bottom: 74px; /* above mobile bar */
    right: 12px;
    left: 12px;
  }
  .live-message-toast {
    width: 100%;
  }
}
