/**
 * AzizWares Custom Styles
 * Modern UI Components and Utilities
 */

/* ===========================
   CSS Custom Properties
   =========================== */

:root {
  /* Colors */
  --color-primary: #0ea5e9;
  --color-secondary: #8b5cf6;
  --color-accent: #f59e0b;

  /* Spacing */
  --spacing-unit: 0.25rem;

  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  /* Shadows */
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.5);

  /* Transitions */
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* Dark mode color overrides */
[class~="dark"] {
  --color-primary: #38bdf8;
  --color-secondary: #a855f7;
  --color-accent: #fbbf24;
}

/* ===========================
   Glassmorphism Utilities
   =========================== */

.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.glass-light {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===========================
   Gradient Text
   =========================== */

.gradient-text {
  background: linear-gradient(135deg, #0ea5e9 0%, #7c3aed 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradient 15s ease infinite;
  /* Sharper rendering for better readability */
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gradient-text-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.gradient-text-secondary {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* ===========================
   Gradient Backgrounds
   =========================== */

.gradient-bg-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
}

.gradient-bg-secondary {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
}

.gradient-bg-accent {
  background: linear-gradient(135deg, #f59e0b 0%, #fb923c 100%);
}

.gradient-bg-animated {
  background: linear-gradient(270deg, #0ea5e9, #8b5cf6, #ec4899);
  background-size: 600% 600%;
  animation: gradient 15s ease infinite;
}

/* Mesh gradient background */
.gradient-mesh {
  background:
    radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.3) 0px, transparent 50%),
    radial-gradient(at 50% 0%, rgba(139, 92, 246, 0.3) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.3) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(245, 158, 11, 0.2) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(14, 165, 233, 0.2) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.2) 0px, transparent 50%);
}

/* ===========================
   Card Hover Effects
   =========================== */

.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.card-tilt {
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
}

.card-tilt:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* ===========================
   Gradient Borders
   =========================== */

.gradient-border {
  position: relative;
  background: transparent;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6, #ec4899);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ===========================
   Loading Animations
   =========================== */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(226, 232, 240, 0.2) 25%,
    rgba(226, 232, 240, 0.3) 50%,
    rgba(226, 232, 240, 0.2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    rgba(51, 65, 85, 0.2) 25%,
    rgba(51, 65, 85, 0.3) 50%,
    rgba(51, 65, 85, 0.2) 75%
  );
  background-size: 200% 100%;
}

/* Spinner */
.spinner {
  border: 3px solid rgba(14, 165, 233, 0.1);
  border-radius: 50%;
  border-top-color: #0ea5e9;
  animation: spin 1s linear infinite;
}

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

/* ===========================
   Smooth Scrolling
   =========================== */

html {
  scroll-behavior: smooth;
}

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

::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.5);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(14, 165, 233, 0.7);
}

/* ===========================
   Focus Styles (Accessibility)
   =========================== */

*:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

/* ===========================
   Reduced Motion Support
   =========================== */

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

/* ===========================
   Print Styles
   =========================== */

@media print {
  .no-print {
    display: none !important;
  }

  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
}

/* ===========================
   Utility Classes
   =========================== */

/* Text selection */
::selection {
  background-color: rgba(14, 165, 233, 0.3);
  color: inherit;
}

/* Disable text selection */
.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Hide scrollbar but keep functionality */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Aspect ratios */
.aspect-auto { aspect-ratio: auto; }
.aspect-square { aspect-ratio: 1 / 1; }
.aspect-video { aspect-ratio: 16 / 9; }
.aspect-4-3 { aspect-ratio: 4 / 3; }
.aspect-21-9 { aspect-ratio: 21 / 9; }

/* Text truncation */
.truncate-2-lines {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.truncate-3-lines {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===========================
   Micro-interactions
   =========================== */

/* Button Ripple Effect */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

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

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
  opacity: 0;
}

/* Dynamic ripple (JS-enhanced) */
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* Floating Label Inputs */
.float-label-container {
  position: relative;
}

.float-label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.3s ease;
  pointer-events: none;
  color: rgb(148 163 184);
}

.float-input:focus + .float-label,
.float-input:not(:placeholder-shown) + .float-label {
  top: 0;
  font-size: 0.75rem;
  padding: 0 0.25rem;
  background: inherit;
}

/* Smooth Focus States */
.focus-ring {
  @apply focus:outline-none focus:ring-2 focus:ring-brand-primary-500 focus:ring-offset-2 dark:focus:ring-offset-slate-900;
  transition: box-shadow 0.2s ease;
}

/* Magnetic Button Effect */
.btn-magnetic {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.btn-magnetic:active {
  transform: scale(0.95);
}

/* Shake Animation (for errors) */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

/* Success Checkmark Animation */
@keyframes checkmark {
  0% {
    stroke-dashoffset: 100;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.checkmark-animate {
  stroke-dasharray: 100;
  animation: checkmark 0.5s ease-in-out forwards;
}

/* Bounce on Appear */
@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

.bounce-in {
  animation: bounce-in 0.5s ease-out;
}

/* Fade In Animation */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fade-in 0.6s ease-out forwards;
}

/* Pulse Glow Effect */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
  }
}

.pulse-glow {
  animation: pulse-glow 2s infinite;
}

/* Typing Indicator */
@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

.typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: currentColor;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Progress Bar */
.progress-bar {
  position: relative;
  height: 4px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #8b5cf6);
  border-radius: 9999px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

/* Scroll Progress Indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #0ea5e9, #8b5cf6, #f59e0b);
  z-index: 100;
  transform-origin: left;
  transition: transform 0.1s ease-out;
}

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.95);
  color: white;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.tooltip:hover::before,
.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* Badge Wiggle */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

.badge-wiggle:hover {
  animation: wiggle 0.3s ease-in-out;
}

/* Skeleton Loading (already have some, adding more) */
.skeleton-wave {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: wave 1.5s infinite;
}

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