/**
 * Custom CSS - Zpay Application
 * Additional styles beyond Tailwind CSS
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Alpine.js cloak - hide until initialized */
[x-cloak] {
  display: none !important;
}

/* ==========================================================================
   Typography & Font Smoothing
   ========================================================================== */

/* Better font rendering on macOS/iOS */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   Animations
   ========================================================================== */

/* Spin animation for loading spinners */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

/* Slide in from bottom */
@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.slide-in-up {
  animation: slideInUp 0.3s ease-out;
}

/* ==========================================================================
   Custom Scrollbar Styles
   ========================================================================== */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

/* ==========================================================================
   Focus Styles
   ========================================================================== */

/* Remove default outline and add custom focus styles */
*:focus {
  outline: none;
}

/* Custom focus ring for interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #5b70ff;
  outline-offset: 2px;
}

/* ==========================================================================
   Transitions
   ========================================================================== */

/* Smooth transitions for interactive elements */
button,
a,
input,
select,
textarea {
  transition: all 0.2s ease;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ==========================================================================
   Backdrop Blur Support
   ========================================================================== */

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(28px)) {
  .backdrop-blur-synth {
    background-color: rgba(255, 255, 255, 0.95);
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  /* Hide navigation and non-essential elements */
  nav,
  aside,
  footer,
  button {
    display: none !important;
  }

  /* Ensure content is visible */
  main {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Print-friendly colors */
  * {
    background: white !important;
    color: black !important;
  }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Make visible on focus for keyboard navigation */
.sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Hide scrollbar but keep functionality */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Prevent text selection */
.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* GPU acceleration for smoother animations */
.gpu-accelerate {
  transform: translateZ(0);
  will-change: transform;
}

/* ==========================================================================
   Form Enhancements
   ========================================================================== */

/* Better input placeholder styling */
input::placeholder,
textarea::placeholder {
  color: #94a3b8;
  opacity: 1;
}

/* Autofill styling */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: #1e293b;
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* Number input remove spinners */
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;
}

/* ==========================================================================
   Modal/Overlay Styles
   ========================================================================== */

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

/* ==========================================================================
   Card Hover Effects
   ========================================================================== */

.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.15);
}

/* ==========================================================================
   Status Indicators
   ========================================================================== */

/* Status dot with pulse animation */
.status-dot {
  position: relative;
}

.status-dot::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ==========================================================================
   Responsive Text
   ========================================================================== */

/* Prevent text overflow */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Multi-line truncate */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Browser-Specific Fixes
   ========================================================================== */

/* Fix for Safari */
@supports (-webkit-overflow-scrolling: touch) {
  .safari-fix {
    -webkit-overflow-scrolling: touch;
  }
}

/* Fix for Edge */
@supports (-ms-ime-align: auto) {
  .edge-fix {
    /* Edge-specific styles if needed */
  }
}