/**
 * Custom CSS - Zazoo Application
 * Additional styles beyond Tailwind CSS
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

html {
  scroll-behavior: smooth;
}

[x-cloak] {
  display: none !important;
}

/* ==========================================================================
   Typography & Font Smoothing
   ========================================================================== */

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@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-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;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

/* ==========================================================================
   Focus Styles
   ========================================================================== */

*:focus {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #5b70ff;
  outline-offset: 2px;
}

/* ==========================================================================
   Transitions
   ========================================================================== */

button,
a,
input,
select,
textarea {
  transition: all 0.2s ease;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.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;
  }
}

/* ==========================================================================
   Public Page Loading Skeleton
   ========================================================================== */

.public-page-loader {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.public-page-loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #e2e8f0;
  border-top-color: #5b70ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

body:has(main:not([x-cloak])) .public-page-loader,
body.alpine-ready .public-page-loader {
  display: none !important;
}

/* ==========================================================================
   Backdrop Blur Support
   ========================================================================== */

@supports not (backdrop-filter: blur(28px)) {
  .backdrop-blur-synth {
    background-color: rgba(255, 255, 255, 0.95);
  }
}

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

@media print {
  nav,
  aside,
  footer,
  button {
    display: none !important;
  }

  main {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  * {
    background: white !important;
    color: black !important;
  }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.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;
}

.sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

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

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

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.gpu-accelerate {
  transform: translateZ(0);
  will-change: transform;
}

/* ==========================================================================
   Form Enhancements
   ========================================================================== */

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
  opacity: 1;
}

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;
}

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
   ========================================================================== */

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 {
  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
   ========================================================================== */

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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
   ========================================================================== */

@supports (-webkit-overflow-scrolling: touch) {
  .safari-fix {
    -webkit-overflow-scrolling: touch;
  }
}

/* ==========================================================================
   Mobile Layout Adjustments
   ========================================================================== */

html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Ensure interactive buttons have minimum touch target size */
button:not(.icon-only),
a[role='button']:not(.icon-only),
input[type='submit'],
input[type='button'] {
  min-height: 44px;
}

button.icon-only,
a.icon-only {
  min-height: 44px;
  min-width: 44px;
}

/* Ensure form inputs are readable on mobile (prevents zoom on iOS) */
input,
select,
textarea {
  font-size: 16px;
}

/* ==========================================================================
   iOS Safe Area
   ========================================================================== */

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

@supports (padding: max(0px)) {
  .safe-area-bottom {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }
}
