/**
 * Fallback & Helper Styles untuk V2
 */

/* ============================================
   BUTTON & LINK FIXES
   ============================================ */
a.btn,
a.btn:hover,
a.btn:focus,
.btn,
.btn:hover,
.btn:focus,
.btn-selengkapnya,
.btn-selengkapnya:hover,
.btn-selengkapnya:focus,
.btn-selengkapnya-filled,
.btn-selengkapnya-filled:hover,
.btn-selengkapnya-filled:focus,
.penawaran-btn,
.penawaran-btn:hover,
.penawaran-btn:focus,
.call-center-btn,
.call-center-btn:hover,
.call-center-btn:focus {
  text-decoration: none !important;
}

/* ============================================
   IMAGE FALLBACK & PLACEHOLDER
   ============================================ */
img {
  max-width: 100%;
  height: auto;
}

img[src=""],
img:not([src]) {
  background: var(--gray-200);
  display: inline-block;
  position: relative;
}

img[src=""]:before,
img:not([src]):before {
  content: '';
  display: block;
  padding-top: 56.25%; /* 16:9 aspect ratio */
}

/* Lazy loading placeholder */
img.lazy {
  background: var(--gray-200);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary-500);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ============================================
   SKELETON LOADERS
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 2rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

/* ============================================
   FOCUS VISIBLE (Accessibility)
   ============================================ */
*:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .topbar,
  .navbar,
  .footer,
  .floating-buttons,
  .scroll-to-top,
  .accessibility-widget,
  .no-print {
    display: none !important;
  }

  .page-header {
    background: none !important;
    color: #000 !important;
  }

  a {
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
  }
}

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

  .hero-slide {
    transition: none !important;
  }
}

/* ============================================
   HIGH CONTRAST MODE (Accessibility)
   ============================================ */
@media (prefers-contrast: high) {
  :root {
    --primary-500: #000080;
    --secondary-500: #008080;
    --gray-700: #000000;
  }

  .btn {
    border-width: 3px;
  }
}

/* ============================================
   UTILITY: NO SCROLL
   ============================================ */
body.no-scroll,
body.menu-open,
body.modal-open {
  overflow: hidden;
}

/* ============================================
   UTILITY: SCREEN READER ONLY
   ============================================ */
.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;
}

/* ============================================
   HOVER EFFECTS
   ============================================ */
@media (hover: hover) {
  a:hover,
  button:hover {
    transition: var(--transition-fast);
  }
}

/* ============================================
   SAFE AREA (for notched devices)
   ============================================ */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  .container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}
