/* ============================================
   PayLink Modern - Custom CSS Stylesheet
   ============================================ */

/* ============================================
   CSS Custom Properties (Variables)
   ============================================ */
:root {
  /* Colors - Dark Theme */
  --background: 222 47% 6%;
  --foreground: 210 40% 98%;
  --card: 222 47% 8%;
  --card-foreground: 210 40% 98%;
  --popover: 222 47% 8%;
  --popover-foreground: 210 40% 98%;
  --primary: 252 100% 67%;
  --primary-foreground: 222 47% 6%;
  --secondary: 217 33% 17%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217 33% 17%;
  --muted-foreground: 215 20% 65%;
  --accent: 252 100% 67%;
  --accent-foreground: 222 47% 6%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 210 40% 98%;
  --success: 142 76% 45%;
  --success-foreground: 222 47% 6%;
  --warning: 38 92% 50%;
  --warning-foreground: 222 47% 6%;
  --border: 217 33% 17%;
  --input: 217 33% 17%;
  --ring: 252 100% 67%;
  --radius: 1rem;

  /* Specific Colors */
  --violet-500: #8b5cf6;
  --violet-400: #a78bfa;
  --indigo-600: #4f46e5;
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --amber-500: #f59e0b;
  --red-500: #ef4444;
}

/* ============================================
   Base Styles
   ============================================ */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-feature-settings: "rlig" 1, "calt" 1;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Selection */
::selection {
  background: hsl(var(--primary) / 0.3);
  color: hsl(var(--foreground));
}

/* ============================================
   Scrollbar Styles
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground));
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--border)) hsl(var(--background));
}

/* ============================================
   Glassmorphism Effects
   ============================================ */
.glass {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.3),
    0 2px 4px -2px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ============================================
   Gradient Effects
   ============================================ */
.gradient-text {
  background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-border {
  position: relative;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.5), rgba(96, 165, 250, 0.3), rgba(52, 211, 153, 0.2));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ============================================
   Glow Effects
   ============================================ */
.glow-primary {
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.3), 0 0 40px rgba(167, 139, 250, 0.1);
}

.glow-success {
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.3), 0 0 40px rgba(52, 211, 153, 0.1);
}

.glow-error {
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3), 0 0 40px rgba(239, 68, 68, 0.1);
}

/* ============================================
   Animated Background
   ============================================ */
.animated-bg {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(167, 139, 250, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(96, 165, 250, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(52, 211, 153, 0.05) 0%, transparent 70%),
    hsl(222 47% 6%);
  min-height: 100vh;
}

/* ============================================
   Input Styles
   ============================================ */
.input-glow:focus {
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--primary) / 0.3);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ============================================
   Button Styles
   ============================================ */
.btn-lift {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.btn-lift:active {
  transform: translateY(0);
}

/* ============================================
   Card Hover Effects
   ============================================ */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow:
    0 20px 40px -10px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(167, 139, 250, 0.2);
}

/* ============================================
   Table Row Hover
   ============================================ */
.table-row-hover {
  transition: all 0.15s ease;
}

.table-row-hover:hover {
  background: rgba(167, 139, 250, 0.05);
}

/* ============================================
   Status Badge Animations
   ============================================ */
@keyframes pulse-soft {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.status-pending {
  animation: pulse-soft 2s ease-in-out infinite;
}

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

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

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

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

/* ============================================
   Shimmer Effect (Loading)
   ============================================ */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    hsl(var(--secondary)) 25%,
    hsl(var(--muted)) 50%,
    hsl(var(--secondary)) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ============================================
   Focus Styles (Accessibility)
   ============================================ */
.focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--primary));
}

/* ============================================
   Touch Targets (Mobile)
   ============================================ */
.touch-target {
  min-height: 44px;
  min-width: 44px;
}

/* ============================================
   Responsive Utilities
   ============================================ */
@media (max-width: 640px) {
  .glass-card {
    padding: 1rem;
  }

  .animated-bg {
    background-attachment: fixed;
  }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  .glass,
  .glass-card {
    background: white !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }

  .animated-bg {
    background: white !important;
  }

  .gradient-text {
    background: none !important;
    -webkit-text-fill-color: black !important;
    color: black !important;
  }
}

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

  .status-pending {
    animation: none;
  }
}

/* ============================================
   High Contrast Mode
   ============================================ */
@media (prefers-contrast: high) {
  .glass-card {
    border-width: 2px;
    border-color: white;
  }

  .gradient-border::before {
    display: none;
  }
}

/* ============================================
   Switch Component (iOS-style toggle)
   ============================================ */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: hsl(var(--secondary));
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background-color: hsl(var(--foreground));
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch-slider {
  background-color: hsl(var(--primary));
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.switch input:checked + .switch-slider:before {
  transform: translateX(20px);
}

.switch input:focus + .switch-slider {
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--primary) / 0.3);
}

/* Avatar Component */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 14px;
  border: 2px solid rgba(139, 92, 246, 0.3);
  background: linear-gradient(to bottom right, rgba(139, 92, 246, 0.2), rgba(79, 70, 229, 0.2));
  color: hsl(var(--primary));
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

/* Notification Badge */
.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: hsl(var(--primary));
  border-radius: 50%;
  box-shadow: 0 0 0 2px hsl(var(--background));
}

/* Amount Buttons */
.amount-btn {
  padding: 0.625rem 1rem;
  min-height: 40px;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(30, 41, 59, 0.5);
  color: hsl(var(--muted-foreground));
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.amount-btn:hover {
  background: rgba(30, 41, 59, 0.7);
  color: hsl(var(--foreground));
  border-color: rgba(255, 255, 255, 0.1);
}

.amount-btn.active {
  background: var(--violet-500);
  color: white;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
  border-color: var(--violet-500);
}

/* Quick Date Buttons */
.quick-date-btn {
  padding: 0.625rem 1rem;
  min-height: 40px;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(30, 41, 59, 0.3);
  color: hsl(var(--muted-foreground));
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.quick-date-btn:hover {
  background: rgba(30, 41, 59, 0.6);
  color: hsl(var(--foreground));
  border-color: rgba(255, 255, 255, 0.1);
}

.quick-date-btn.active {
  background: var(--violet-500);
  color: white;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
  border-color: var(--violet-500);
}

/* Duration Toggle Buttons */
.duration-btn {
  padding: 0.625rem 1rem;
  min-height: 40px;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(30, 41, 59, 0.5);
  color: hsl(var(--muted-foreground));
  border: none;
  cursor: pointer;
}

.duration-btn:hover {
  color: hsl(var(--foreground));
}

.duration-btn.active {
  background: var(--violet-500);
  color: white;
}

/* Form Controls */
.form-control {
  height: 48px;
  border-radius: 0.75rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  padding: 0 1rem;
}

.form-select {
  height: 48px;
  border-radius: 0.75rem;
  background: rgba(30, 41, 59, 0.5) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%28255, 255, 255, 0.6%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") right 0.75rem center/16px 12px no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  padding: 0 1rem;
  padding-right: 2.5rem;
  appearance: none;
}

.form-control::placeholder {
  color: hsl(var(--muted-foreground));
}

.form-control:focus {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--primary) / 0.3);
  color: hsl(var(--foreground));
  outline: none;
}

.form-select:focus {
  background: rgba(30, 41, 59, 0.5) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%28255, 255, 255, 0.6%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") right 0.75rem center/16px 12px no-repeat;
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--primary) / 0.3);
  color: hsl(var(--foreground));
  outline: none;
}

/* Form Labels */
.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(to right, var(--violet-500), var(--indigo-600));
  border: none;
  color: white;
  font-weight: 600;
  border-radius: 0.75rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
  background: linear-gradient(to right, rgba(139, 92, 246, 0.9), rgba(79, 70, 229, 0.9));
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.btn-primary:focus {
  background: linear-gradient(to right, var(--violet-500), var(--indigo-600));
  color: white;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--primary) / 0.3);
}

/* Slot Buttons */
.slot-btn {
  padding: 0.5rem 0.875rem !important;
  border-radius: 0.5rem !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 70px;
  box-sizing: border-box;
}

/* Table Styles */
.table {
  color: hsl(var(--foreground));
  margin-bottom: 0;
}

.table thead th {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.75rem;
  background: transparent;
}

.table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table tbody td {
  padding: 1rem 0.75rem;
  vertical-align: middle;
}

/* Rounded Corners */
.rounded-2xl {
  border-radius: 1rem !important;
}

.rounded-xl {
  border-radius: 0.75rem !important;
}

.rounded-lg {
  border-radius: 0.5rem !important;
}
