/* ================================================
   PREMIUM UI DETAILS & MICRO-INTERACTIONS
   BINOX - Premium International Marketplace
   Animations, shadows, glass effects, transitions
   ================================================ */

/* ===== GLASSMORPHISM EFFECTS ===== */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-accent {
  background: rgba(249, 115, 22, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

/* ===== PREMIUM SHADOWS ===== */
.shadow-premium-sm {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.shadow-premium-md {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.shadow-premium-lg {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.shadow-premium-xl {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.shadow-premium-2xl {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.shadow-glow-accent {
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.3), 0 4px 16px rgba(249, 115, 22, 0.2);
}

.shadow-glow-success {
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.3), 0 4px 16px rgba(16, 185, 129, 0.2);
}

.shadow-glow-error {
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.3), 0 4px 16px rgba(239, 68, 68, 0.2);
}

.shadow-inner {
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ===== GRADIENT BORDERS ===== */
.gradient-border {
  position: relative;
  background: var(--surface-0);
  border-radius: var(--radius-xl);
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: var(--gradient-primary);
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.gradient-border:hover::before {
  opacity: 1;
}

.gradient-border-animated::before {
  background: linear-gradient(90deg, #f97316, #ea580c, #dc2626, #f97316);
  background-size: 300% 100%;
  animation: gradientBorder 3s linear infinite;
}

@keyframes gradientBorder {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ===== HOVER EFFECTS ===== */
.hover-lift {
  transition: transform var(--transition-premium), box-shadow var(--transition-premium);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-premium-lg);
}

.hover-scale {
  transition: transform var(--transition-premium);
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: box-shadow var(--transition-premium);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow-accent);
}

.hover-shine {
  position: relative;
  overflow: hidden;
}

.hover-shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left var(--transition-slow);
}

.hover-shine:hover::after {
  left: 100%;
}

/* ===== RIPPLE EFFECT ===== */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
  width: 300px;
  height: 300px;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-0);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-premium-2xl);
  animation: toastSlideIn var(--transition-premium);
  max-width: 400px;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.removing {
  animation: toastSlideOut var(--transition-premium);
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.toast-success .toast-icon {
  background: var(--brand-success);
  color: white;
}

.toast-error .toast-icon {
  background: var(--brand-error);
  color: white;
}

.toast-warning .toast-icon {
  background: var(--brand-warning);
  color: white;
}

.toast-info .toast-icon {
  background: var(--brand-primary);
  color: white;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--ink-900);
  margin-bottom: var(--space-1);
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--ink-600);
  line-height: var(--leading-snug);
}

.toast-close {
  background: transparent;
  border: none;
  padding: var(--space-2);
  color: var(--ink-400);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.toast-close:hover {
  background: var(--surface-100);
  color: var(--ink-600);
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

/* ===== LOADING STATES ===== */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--ink-200);
  border-top-color: var(--brand-accent);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.loading-dots {
  display: flex;
  gap: var(--space-2);
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: var(--brand-accent);
  border-radius: var(--radius-full);
  animation: loadingDot 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loadingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.loading-bar {
  width: 100%;
  height: 4px;
  background: var(--ink-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  animation: loadingBar 1.5s ease-in-out infinite;
}

@keyframes loadingBar {
  0% {
    width: 0%;
  }
  50% {
    width: 70%;
  }
  100% {
    width: 100%;
  }
}

/* ===== SKELETON LOADING ===== */
.skeleton-premium {
  background: linear-gradient(
    90deg,
    var(--surface-200) 0%,
    var(--surface-100) 50%,
    var(--surface-200) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ===== TRANSITIONS ===== */
.transition-all {
  transition: all var(--transition-base);
}

.transition-transform {
  transition: transform var(--transition-base);
}

.transition-opacity {
  transition: opacity var(--transition-base);
}

.transition-colors {
  transition: color var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
}

/* ===== ANIMATIONS ===== */
.animate-bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-ping {
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-premium);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--surface-0);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-premium-2xl);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-premium);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}

.modal-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--ink-200);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--ink-900);
}

.modal-close {
  background: transparent;
  border: none;
  padding: var(--space-2);
  color: var(--ink-400);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: var(--surface-100);
  color: var(--ink-600);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-6);
  border-top: 1px solid var(--ink-200);
}

/* ===== TOOLTIP ===== */
.tooltip {
  position: relative;
}

.tooltip-content {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: var(--space-2) var(--space-3);
  background: var(--ink-900);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  z-index: var(--z-tooltip);
}

.tooltip:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--ink-900);
}

/* ===== BADGE PULSE ===== */
.badge-pulse {
  position: relative;
}

.badge-pulse::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: inherit;
  opacity: 0.5;
  animation: badgePulse 2s ease-in-out infinite;
}

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

/* ===== SCROLL TO TOP ===== */
.scroll-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--brand-accent);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-premium-lg);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--transition-premium);
  z-index: var(--z-fixed);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--brand-accent-dark);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow-accent);
}

.scroll-to-top svg {
  width: 24px;
  height: 24px;
}

/* ===== FLOATING ACTION BUTTON ===== */
.fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-premium-2xl);
  cursor: pointer;
  transition: all var(--transition-premium);
  z-index: var(--z-fixed);
}

.fab:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: var(--shadow-glow-accent);
}

.fab:active {
  transform: scale(0.95);
}

.fab svg {
  width: 24px;
  height: 24px;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar-striped .progress-bar-fill {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1rem 1rem;
  animation: progressStripes 1s linear infinite;
}

@keyframes progressStripes {
  from {
    background-position: 1rem 0;
  }
  to {
    background-position: 0 0;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== FOCUS VISIBLE ===== */
.focus-visible:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

/* ===== SELECTION ===== */
::selection {
  background: var(--brand-accent);
  color: white;
}

::-moz-selection {
  background: var(--brand-accent);
  color: white;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--surface-100);
}

::-webkit-scrollbar-thumb {
  background: var(--ink-300);
  border-radius: var(--radius-full);
  border: 2px solid var(--surface-100);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-400);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .toast-container {
    top: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
  }
  
  .toast {
    max-width: 100%;
  }
  
  .modal-panel {
    max-width: 95vw;
    max-height: 95vh;
  }
  
  .scroll-to-top,
  .fab {
    bottom: var(--space-4);
    right: var(--space-4);
    width: 48px;
    height: 48px;
  }
}
