/* ==========================================================================
   DualSub (دوآل‌ساب) - Cyberpunk Floating Toast & Announcement System
   Ultra-Modern Glassmorphism • Slide-in Dynamics • Interactive Countdown
   ========================================================================== */

:root {
  --toast-bg: rgba(10, 15, 26, 0.90);
  --toast-blur: 24px;
  --toast-border-cyan: rgba(0, 240, 255, 0.38);
  --toast-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 30px rgba(0, 136, 204, 0.22);
  --toast-telegram-blue: #0088cc;
  --toast-telegram-cyan: #00f0ff;
}

/* Toast Container (Positioning Anchor) */
.cyber-toast-container {
  position: fixed;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: none;
  max-width: 100vw;
  box-sizing: border-box;
}

.cyber-toast-container--top-right {
  top: 92px;
  right: 24px;
  align-items: flex-end;
}

.cyber-toast-container--top-left {
  top: 92px;
  left: 24px;
  align-items: flex-start;
}

.cyber-toast-container--top-center {
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}

.cyber-toast-container--bottom-right {
  bottom: 24px;
  right: 24px;
  align-items: flex-end;
}

.cyber-toast-container--bottom-left {
  bottom: 24px;
  left: 24px;
  align-items: flex-start;
}

/* The Toast Card */
.cyber-toast {
  pointer-events: auto;
  position: relative;
  width: 430px;
  max-width: calc(100vw - 32px);
  background: var(--toast-bg);
  backdrop-filter: blur(var(--toast-blur)) saturate(190%);
  -webkit-backdrop-filter: blur(var(--toast-blur)) saturate(190%);
  border-radius: 20px;
  /* Anti-aliased ring: no 1px solid border to eliminate subpixel aliasing! */
  box-shadow: 
    0 0 0 1.5px var(--toast-border-cyan),
    var(--toast-shadow);
  overflow: hidden;
  direction: rtl;
  font-family: var(--font-fa);
  padding: 0;
  /* Initial off-screen state for RTL entrance (slides from right to left) */
  transform: translate3d(calc(100% + 45px), 0, 0);
  opacity: 0;
  transition: 
    transform 0.52s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s ease;
  user-select: none;
}

/* Ambient glowing laser line along top */
.cyber-toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--toast-telegram-cyan) 40%, #7000ff 80%, transparent 100%);
  z-index: 5;
}

/* Visible active state */
.cyber-toast.is-visible {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

/* Exit state (slides out smoothly to the right) */
.cyber-toast.is-leaving {
  transform: translate3d(calc(100% + 55px), 0, 0) scale(0.95);
  opacity: 0;
  transition: 
    transform 0.42s cubic-bezier(0.7, 0, 0.84, 0),
    opacity 0.32s ease;
}

.cyber-toast:hover {
  box-shadow: 
    0 0 0 1.5px rgba(0, 240, 255, 0.65),
    0 22px 55px rgba(0, 0, 0, 0.85),
    0 0 35px rgba(0, 136, 204, 0.35);
}

/* Toast Inner Content */
.cyber-toast-content {
  padding: 1.15rem 1.25rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Header */
.cyber-toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cyber-toast-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cyber-toast-icon-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 136, 204, 0.22) 0%, rgba(0, 240, 255, 0.18) 100%);
  box-shadow: 0 0 0 1.2px rgba(0, 240, 255, 0.35), 0 0 16px rgba(0, 136, 204, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon-cyan);
  flex-shrink: 0;
}

.cyber-toast-icon-wrap.is-telegram {
  background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
  color: #ffffff;
  box-shadow: 0 0 20px rgba(0, 136, 204, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.cyber-toast-titles {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cyber-toast-badge-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.cyber-toast-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-cyan);
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.28);
  letter-spacing: 0.02em;
}

.cyber-toast-badge--pulse {
  position: relative;
  padding-right: 1.15rem;
}

.cyber-toast-badge--pulse::after {
  content: '';
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00ff66;
  box-shadow: 0 0 8px #00ff66;
  animation: cyberPulseGlow 1.8s infinite;
}

@keyframes cyberPulseGlow {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50% { opacity: 0.35; transform: translateY(-50%) scale(0.75); }
}

.cyber-toast-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.01em;
}

/* Close Button */
.cyber-toast-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cyber-toast-close:hover {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.5);
  color: #f43f5e;
  transform: scale(1.08);
}

/* Body Text */
.cyber-toast-message {
  font-size: 0.88rem;
  line-height: 1.68;
  color: #cbd5e1;
  margin: 0;
}

/* Actions Row */
.cyber-toast-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.2rem;
}

.cyber-toast-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.62rem 0.95rem;
  border-radius: 12px;
  font-family: var(--font-fa);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  white-space: nowrap;
  outline: none;
}

/* Primary Telegram Action */
.cyber-toast-btn--primary {
  background: linear-gradient(135deg, #0088cc 0%, #00f0ff 100%);
  color: #050a14 !important;
  font-weight: 800;
  border: none;
  box-shadow: 0 4px 16px rgba(0, 136, 204, 0.45);
}

.cyber-toast-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 240, 255, 0.55), 0 0 16px rgba(0, 136, 204, 0.5);
  filter: brightness(1.06);
}

.cyber-toast-btn--primary:active {
  transform: translateY(0);
}

/* Secondary Copy Action */
.cyber-toast-btn--secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  box-shadow: 0 0 0 1.2px rgba(0, 240, 255, 0.28);
  border: none;
}

.cyber-toast-btn--secondary:hover {
  background: rgba(0, 240, 255, 0.12);
  color: var(--neon-cyan);
  box-shadow: 0 0 0 1.5px rgba(0, 240, 255, 0.55), 0 4px 14px rgba(0, 240, 255, 0.2);
  transform: translateY(-2px);
}

.cyber-toast-btn--secondary:active {
  transform: translateY(0);
}

.cyber-toast-btn--secondary.is-copied {
  background: rgba(0, 255, 102, 0.15) !important;
  color: #00ff66 !important;
  box-shadow: 0 0 0 1.5px rgba(0, 255, 102, 0.6), 0 0 15px rgba(0, 255, 102, 0.3) !important;
}

/* Progress Bar Timer (Counts down at bottom of card) */
.cyber-toast-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.07);
  position: relative;
  overflow: hidden;
}

.cyber-toast-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #7000ff 0%, #0088cc 45%, #00f0ff 100%);
  box-shadow: 0 0 10px #00f0ff;
  transform-origin: right;
  transition: width 0.08s linear;
}

/* Toast Color Themes */
.cyber-toast--success::before {
  background: linear-gradient(90deg, transparent 0%, #00ff66 40%, #10b981 80%, transparent 100%);
}
.cyber-toast--success {
  box-shadow: 0 0 0 1.5px rgba(0, 255, 102, 0.35), var(--toast-shadow);
}
.cyber-toast--success .cyber-toast-icon-wrap {
  background: linear-gradient(135deg, rgba(0, 255, 102, 0.2) 0%, rgba(16, 185, 129, 0.15) 100%);
  box-shadow: 0 0 0 1.2px rgba(0, 255, 102, 0.35), 0 0 14px rgba(0, 255, 102, 0.25);
  color: #00ff66;
}
.cyber-toast--success .cyber-toast-progress-bar {
  background: linear-gradient(90deg, #059669 0%, #10b981 50%, #00ff66 100%);
  box-shadow: 0 0 10px #00ff66;
}

.cyber-toast--error::before {
  background: linear-gradient(90deg, transparent 0%, #f43f5e 40%, #e11d48 80%, transparent 100%);
}
.cyber-toast--error {
  box-shadow: 0 0 0 1.5px rgba(244, 63, 94, 0.4), var(--toast-shadow);
}
.cyber-toast--error .cyber-toast-icon-wrap {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.2) 0%, rgba(225, 29, 72, 0.15) 100%);
  box-shadow: 0 0 0 1.2px rgba(244, 63, 94, 0.4), 0 0 14px rgba(244, 63, 94, 0.3);
  color: #f43f5e;
}
.cyber-toast--error .cyber-toast-progress-bar {
  background: linear-gradient(90deg, #be123c 0%, #f43f5e 50%, #fb7185 100%);
  box-shadow: 0 0 10px #f43f5e;
}

.cyber-toast--warning::before {
  background: linear-gradient(90deg, transparent 0%, #f59e0b 40%, #d97706 80%, transparent 100%);
}
.cyber-toast--warning {
  box-shadow: 0 0 0 1.5px rgba(245, 158, 11, 0.35), var(--toast-shadow);
}
.cyber-toast--warning .cyber-toast-icon-wrap {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.15) 100%);
  box-shadow: 0 0 0 1.2px rgba(245, 158, 11, 0.35), 0 0 14px rgba(245, 158, 11, 0.25);
  color: #f59e0b;
}

/* Responsive adjustments for Mobile & Small Screens */
@media (max-width: 600px) {
  .cyber-toast-container--top-right,
  .cyber-toast-container--top-left,
  .cyber-toast-container--top-center {
    top: calc(env(safe-area-inset-top, 0px) + 72px);
    right: 12px;
    left: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
    align-items: center;
    box-sizing: border-box;
  }

  .cyber-toast-container--bottom-right,
  .cyber-toast-container--bottom-left {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    right: 12px;
    left: 12px;
    width: auto;
    max-width: calc(100vw - 24px);
    align-items: center;
    box-sizing: border-box;
  }

  .cyber-toast {
    width: 100%;
    max-width: 100%;
    border-radius: 16px;
    /* Clean vertical transition to prevent horizontal viewport stretching on mobile */
    transform: translate3d(0, -20px, 0);
    opacity: 0;
  }

  .cyber-toast.is-visible {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }

  .cyber-toast.is-leaving {
    transform: translate3d(0, -20px, 0) scale(0.96);
    opacity: 0;
  }

  .cyber-toast-content {
    padding: 1rem 1.05rem 0.85rem;
    gap: 0.75rem;
  }

  .cyber-toast-title {
    font-size: 0.92rem;
  }

  .cyber-toast-message {
    font-size: 0.84rem;
    line-height: 1.6;
  }

  .cyber-toast-actions {
    flex-direction: column;
    gap: 0.55rem;
    width: 100%;
  }

  .cyber-toast-btn {
    width: 100%;
    min-height: 42px;
    font-size: 0.86rem;
  }
}

