/* ============================================================
   SHARED UX ENHANCEMENTS - All Themes
   Ortak UX iyileştirmeleri - Tüm temalar için
   ============================================================ */

/* ── Accessibility ─────────────────────────────────────────── */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border-width: 0 !important;
}

.skip-to-content {
  position: absolute;
  top: -60px;
  left: 10px;
  background: #6366F1;
  color: white;
  padding: 12px 24px;
  z-index: 10000;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.3s;
}
.skip-to-content:focus {
  top: 10px;
}

*:focus-visible {
  outline: 3px solid #6366F1;
  outline-offset: 2px;
}

/* ── Loading States ────────────────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.3s;
}
.page-loader.hidden {
  opacity: 0;
  pointer-events: none;
}
.loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #f3f4f6;
  border-top-color: #6366F1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

/* ── Mobile Bottom Bar ─────────────────────────────────────── */
.mobile-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
  display: none;
  z-index: 1000;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  justify-content: space-around;
  border-top: 1px solid #e2e8f0;
}

.bottom-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #475569;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.25s;
  position: relative;
  min-width: 64px;
  min-height: 48px;
}
.bottom-bar-item .icon {
  font-size: 1.4rem;
  margin-bottom: 2px;
}
.bottom-bar-item .label {
  font-size: 0.7rem;
  font-weight: 500;
}
.bottom-bar-item .badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: #6366F1;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.bottom-bar-item:hover,
.bottom-bar-item.active {
  color: #6366F1;
  background: rgba(99,102,241,.08);
}

@media (max-width: 768px) {
  .mobile-bottom-bar { display: flex; }
  body { padding-bottom: 70px; }
}

/* ── Empty States ──────────────────────────────────────────── */
.empty-state-container {
  padding: 80px 20px;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}
.empty-state-icon {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto 24px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.empty-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 32px;
}

/* ── Touch Targets ─────────────────────────────────────────── */
/* Applies only to standalone tap targets (nav/action buttons). Compact
   inline controls (qty steppers, input-groups, small/close buttons) are
   excluded so they don't overflow their containers (e.g. cart offcanvas). */
@media (max-width: 768px) {
  button:not(.btn-sm):not(.btn-close):not(.input-group > button):not(.navbar-toggler),
  a.btn:not(.btn-sm),
  .clickable:not(.btn-sm) {
    min-width: 48px;
    min-height: 48px;
  }
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(1.1); }
}

.heartbeat {
  animation: heartBeat 0.6s ease;
}

/* ── Responsive Images ─────────────────────────────────────── */
img {
  max-width: 100%;
  height: auto;
}

.image-wrapper {
  position: relative;
  overflow: hidden;
}

/* ── Print Styles ──────────────────────────────────────────── */
@media print {
  .mobile-bottom-bar,
  .skip-to-content,
  #ydc-scroll-top,
  #ydc-toast-container {
    display: none !important;
  }
}

/* ============================================================
   PREMIUM POLISH LAYER — "Apple-quality" refinement pass
   Global, theme-agnostic refinements: smoother motion, calmer
   depth, crisper type rendering. Applies on top of every theme
   without altering any theme's layout or color identity.
   ============================================================ */

/* Smooth, consistent easing for anything that already transitions */
a, button, .btn, .card, img, .ydc-product-card, [class*="product-card"],
[class*="hero"], [class*="campaign-card"], [class*="blog-card"] {
  transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Calmer, more consistent focus ring that still meets a11y contrast */
*:focus-visible {
  outline-color: var(--ydc-primary, #6366F1);
  border-radius: 4px;
}

/* Buttons: subtle press feedback instead of an abrupt state change */
.btn, button, a.btn {
  transition: transform 0.15s cubic-bezier(0.25, 0.1, 0.25, 1),
              box-shadow 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
              opacity 0.2s ease;
}
.btn:active, button:active, a.btn:active {
  transform: scale(0.97);
}

/* Product / campaign / blog cards: gentle lift on hover, no layout theme has to opt into */
.ydc-product-card,
[class*="product-card"],
[class*="campaign-card"],
[class*="blog-card"] {
  transition: transform 0.25s cubic-bezier(0.25, 0.1, 0.25, 1),
              box-shadow 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}
@media (hover: hover) {
  .ydc-product-card:hover,
  [class*="product-card"]:hover,
  [class*="campaign-card"]:hover,
  [class*="blog-card"]:hover {
    transform: translateY(-4px);
  }
}

/* Respect users who've asked for reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
