/**
 * Page Guide Tour System - Production CSS
 * Version: 1.0.0
 * Description: Glass morphism UI with dark mode support and RTL compatibility
 */

/* ========================================
   1. TOGGLE BUTTON
   ======================================== */

.pg-toggle-btn {
  position: fixed;
  left: 16px;
  bottom: 96px;
  z-index: 10005;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7C3AED, #6D28D9);
  color: white;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
  transition: all 0.3s ease;
  animation: pg-pulse 2s infinite;
}

.pg-toggle-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.5);
}

.pg-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ef4444;
  color: white;
  font-size: 8px;
  font-weight: 600;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.4);
}

/* ========================================
   2. OVERLAY
   ======================================== */

.pg-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: transparent;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ========================================
   3. HIGHLIGHTED ELEMENT
   ======================================== */

.pg-highlight {
  position: relative !important;
  z-index: 10001 !important;
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.5), 0 0 0 9999px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.3s ease;
  animation: pg-highlight-pulse 2s ease-in-out infinite;
}

/* ========================================
   4. TOOLTIP - GLASS MORPHISM
   ======================================== */

.pg-tooltip {
  position: absolute;
  z-index: 10002;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  min-width: 280px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
  pointer-events: all;
}

.pg-tooltip-enter {
  animation: pg-fade-in 0.3s ease forwards;
}

/* ========================================
   5. TOOLTIP INNER ELEMENTS
   ======================================== */

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

.pg-tooltip-step {
  font-size: 12px;
  color: #7C3AED;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pg-tooltip-close {
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.05);
  color: #666;
  font-size: 16px;
  transition: all 0.2s ease;
}

.pg-tooltip-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  transform: rotate(90deg);
}

.pg-tooltip-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
  line-height: 1.3;
}

.pg-tooltip-desc {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 16px;
}

.pg-tooltip-progress {
  height: 4px;
  background: rgba(124, 58, 237, 0.1);
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
}

.pg-tooltip-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #7C3AED, #a855f7);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.pg-tooltip-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ========================================
   6. BUTTONS
   ======================================== */

.pg-btn {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.pg-btn-prev {
  background: transparent;
  border: 1.5px solid rgba(124, 58, 237, 0.3);
  color: #7C3AED;
}

.pg-btn-prev:hover {
  background: rgba(124, 58, 237, 0.08);
  border-color: #7C3AED;
}

.pg-btn-skip {
  background: transparent;
  color: #94a3b8;
  font-weight: 500;
}

.pg-btn-skip:hover {
  color: #64748b;
}

.pg-btn-next {
  background: linear-gradient(135deg, #7C3AED, #6D28D9);
  color: white;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.pg-btn-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.pg-btn-finish {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.pg-btn-finish:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* ========================================
   7. "DON'T SHOW AGAIN" CHECKBOX
   ======================================== */

.pg-dont-show {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.pg-dont-show label {
  font-size: 12px;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
}

.pg-dont-show input[type="checkbox"] {
  accent-color: #7C3AED;
  cursor: pointer;
}

/* ========================================
   8. DARK MODE
   ======================================== */

.dark .pg-tooltip,
body.dark-mode .pg-tooltip {
  background: rgba(30, 30, 40, 0.92);
  border: 1px solid rgba(124, 58, 237, 0.3);
  color: #e2e8f0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.dark .pg-tooltip-title,
body.dark-mode .pg-tooltip-title {
  color: #f1f5f9;
}

.dark .pg-tooltip-desc,
body.dark-mode .pg-tooltip-desc {
  color: #94a3b8;
}

.dark .pg-tooltip-step,
body.dark-mode .pg-tooltip-step {
  color: #a78bfa;
}

.dark .pg-tooltip-close,
body.dark-mode .pg-tooltip-close {
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.dark .pg-tooltip-close:hover,
body.dark-mode .pg-tooltip-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.dark .pg-tooltip-progress,
body.dark-mode .pg-tooltip-progress {
  background: rgba(124, 58, 237, 0.2);
}

.dark .pg-btn-prev,
body.dark-mode .pg-btn-prev {
  border-color: rgba(124, 58, 237, 0.4);
  color: #a78bfa;
}

.dark .pg-btn-prev:hover,
body.dark-mode .pg-btn-prev:hover {
  background: rgba(124, 58, 237, 0.15);
}

.dark .pg-btn-skip,
body.dark-mode .pg-btn-skip {
  color: #64748b;
}

.dark .pg-dont-show,
body.dark-mode .pg-dont-show {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.dark .pg-dont-show label,
body.dark-mode .pg-dont-show label {
  color: #64748b;
}

.dark .pg-highlight,
body.dark-mode .pg-highlight {
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.5), 0 0 0 9999px rgba(0, 0, 0, 0.6);
}

/* ========================================
   9. RTL SUPPORT
   ======================================== */

[dir="rtl"] .pg-tooltip,
.pg-tooltip[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .pg-tooltip-footer {
  flex-direction: row-reverse;
}

[dir="rtl"] .pg-toggle-btn {
  right: 16px;
  left: auto;
}

[dir="rtl"] .pg-badge {
  left: auto;
  right: -4px;
}

/* ========================================
   10. ANIMATIONS
   ======================================== */

@keyframes pg-pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4), 0 0 0 0 rgba(124, 58, 237, 0.4);
  }
  50% {
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4), 0 0 0 8px rgba(124, 58, 237, 0);
  }
}

@keyframes pg-highlight-pulse {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.5), 0 0 0 9999px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(124, 58, 237, 0.3), 0 0 0 9999px rgba(0, 0, 0, 0.5);
  }
}

@keyframes pg-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   11. RESPONSIVE - MOBILE
   ======================================== */

@media (max-width: 640px) {
  .pg-tooltip {
    max-width: calc(100vw - 32px);
    min-width: 260px;
    left: 16px !important;
    right: 16px !important;
    position: fixed !important;
    bottom: 80px !important;
    top: auto !important;
  }

  .pg-toggle-btn {
    left: 10px;
    bottom: 16px;
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  [dir="rtl"] .pg-toggle-btn {
    right: 10px;
    left: auto;
  }

  .pg-tooltip-title {
    font-size: 16px;
  }

  .pg-tooltip-desc {
    font-size: 13px;
  }

  .pg-btn {
    padding: 7px 14px;
    font-size: 12px;
  }
}
