/* ============================================================
   BUTTON FIX — Ensure All Clicks Work Perfectly
   ============================================================ */

/* Fix overlays blocking buttons */
.modal-overlay {
  pointer-events: auto !important;
}

.modal-overlay:not(.show) {
  pointer-events: none !important;
}

.modal {
  pointer-events: auto !important;
}

/* Ensure all buttons are clickable */
button,
.btn-primary,
.btn-danger,
.btn-ghost,
.btn-watch,
.btn-premium,
.btn-hd-access,
.btn-user-avatar,
.btn-play,
.pkg-card,
.cat-tab,
.poster-card,
.qa-btn {
  cursor: pointer !important;
  pointer-events: auto !important;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Fix disabled button states */
button:disabled,
.btn-primary:disabled,
.btn-danger:disabled {
  cursor: not-allowed !important;
  pointer-events: auto !important;
}

/* Mobile touch optimization */
@media (max-width: 768px) {
  button,
  .btn-primary,
  .btn-danger,
  .btn-ghost,
  .pkg-card {
    min-height: 44px; /* iOS minimum touch target */
    -webkit-tap-highlight-color: transparent;
  }
  
  .pkg-card {
    min-height: 120px;
  }
}

/* Fix z-index layering */
.modal-overlay {
  z-index: 999 !important;
}

.modal {
  z-index: 1000 !important;
}

#main-header {
  z-index: 100 !important;
}

.cat-tabs-wrap {
  z-index: 90 !important;
}

/* Ensure package cards are fully clickable */
.pkg-card {
  position: relative;
  z-index: 1;
}

.pkg-card::before,
.pkg-card::after {
  pointer-events: none;
}

.pkg-popular-badge {
  pointer-events: none;
}

/* Fix button transitions */
button {
  transform: translateZ(0);
  will-change: transform;
}

button:active:not(:disabled) {
  transform: scale(0.98) translateZ(0);
}

/* Prevent double-tap zoom on iOS */
button,
.btn-primary,
.btn-danger,
.pkg-card {
  touch-action: manipulation;
}

/* Fix input focus blocking buttons */
input:focus,
textarea:focus,
select:focus {
  z-index: 2;
}

/* Ensure form buttons are above inputs */
form button[type="submit"],
form button[type="button"] {
  position: relative;
  z-index: 3;
}

/* Fix overlay pointer events properly */
.paywall-overlay {
  pointer-events: none;
}

.paywall-overlay.show {
  pointer-events: auto;
}

.paywall-overlay.show .modal {
  pointer-events: auto;
}

/* Payment button premium glow fix */
.btn-premium-pay {
  position: relative;
  z-index: 5;
  isolation: isolate;
}

.btn-shine {
  pointer-events: none;
}

/* Ensure all onclick handlers work */
[onclick] {
  cursor: pointer !important;
}

/* Fix admin buttons */
.admin-tab-btn,
.admin-tab-btn:not(:disabled) {
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* Category tabs fix */
.cat-tab {
  position: relative;
  z-index: 1;
}

.cat-tab:hover,
.cat-tab.active {
  z-index: 2;
}

/* Hamburger menu fix */
.hamburger-btn,
.menu-toggle {
  z-index: 101;
  cursor: pointer !important;
}

/* Notification bell fix */
.notif-bell-btn {
  cursor: pointer !important;
  z-index: 101;
}

/* Logo click fix */
.logo {
  cursor: pointer !important;
  user-select: none;
}

/* Search input not blocking header buttons */
.header-search {
  z-index: auto;
}

.header-right {
  z-index: 102;
}

/* Sidebar overlay fix */
.sidebar-overlay {
  pointer-events: none;
}

.sidebar-overlay.show {
  pointer-events: auto;
}

.sidebar {
  pointer-events: auto;
}

/* Fix video player controls */
.video-controls,
.video-control-btn {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* Ensure toast notifications don't block clicks */
.toast,
.toast-wrap {
  pointer-events: none;
}

.toast.show {
  pointer-events: auto;
}

/* Profile page buttons */
.profile-btn,
.profile-action-btn {
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* PWA install button */
#headerInstallBtn {
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 102;
}

/* Language toggle button */
#headerLangBtn {
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 102;
}

/* Hero banner buttons */
.hero-btn,
.hero-info-btn {
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 2;
}

/* Movie detail modal buttons */
.detail-actions button {
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* Fix skeleton cards not blocking real content */
.skeleton-card {
  pointer-events: none;
}

/* Ensure package selection works on first click */
.pkg-card {
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Fix auth modal buttons */
.auth-modal button,
.signup-modal button {
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* Quick actions bar buttons */
.qa-btn {
  backface-visibility: hidden;
}

/* Continue watching section buttons */
.cw-section-wrap button {
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* See all button */
.see-all-btn {
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* Admin confirm/grant modals */
.confirm-overlay,
.grant-overlay {
  pointer-events: none;
}

.confirm-overlay.show,
.grant-overlay.show {
  pointer-events: auto;
}

.confirm-box,
.grant-box {
  pointer-events: auto;
}

.confirm-box button,
.grant-box button {
  cursor: pointer !important;
}

/* Payment methods badges (not clickable) */
.pm-badge {
  pointer-events: none;
  user-select: none;
}

/* Trust badges (not clickable) */
.trust-badges,
.trust-item {
  pointer-events: none;
  user-select: none;
}

/* Loading spinner not blocking */
.spinner {
  pointer-events: none;
}

/* Fix bottom navigation if exists */
.bottom-nav,
.bottom-nav-btn {
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* Ensure backdrop doesn't block modal content */
.modal-backdrop {
  pointer-events: none;
}

/* Hardware acceleration for smooth animations */
button,
.pkg-card,
.modal {
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
}

/* Fix for iOS Safari button rendering */
@supports (-webkit-touch-callout: none) {
  button {
    -webkit-appearance: none;
    appearance: none;
  }
}

/* Prevent text selection on buttons */
button * {
  pointer-events: none;
  user-select: none;
}

/* Ensure icon inside buttons don't block clicks */
button i,
button .fa,
button .fas {
  pointer-events: none !important;
}

/* Fix for Windows high contrast mode */
@media (prefers-contrast: high) {
  button {
    border: 2px solid currentColor !important;
  }
}

/* Performance optimization */
.pkg-card,
button,
.modal {
  will-change: transform, opacity;
}

/* Remove any conflicting transforms */
button:not(:active):not(:hover) {
  transform: none !important;
}

/* Ensure click area matches visual button */
button,
.pkg-card {
  box-sizing: border-box;
}

/* Fix for very small screens */
@media (max-width: 360px) {
  button {
    min-height: 42px;
    font-size: 0.85rem !important;
  }
}
