/* Patent Button Overrides - Fix for Disney+ Layout Conflicts */
/* This file specifically overrides Disney+ layout styles for patent view buttons */

/* TARGET ACTUAL CLASS NAMES: _1mp1hfw0 is the container, _14aj7771 _14aj7770 are the buttons */

/* MAIN CONTAINER - Replace .patent-actions with actual class */
[data-testid="details-featured-actions"],
._1mp1hfw0 {
  display: flex !important;
  flex-direction: row !important; /* Horizontal layout for desktop */
  align-items: center !important;
  gap: 12px !important; /* Space between buttons */
  margin-top: 16px !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

/* ALL BUTTONS - Target the actual generated class names */
._14aj7771._14aj7770,
.enhanced-button,
[data-testid="view-patent-button"],
[data-testid="patent-details-button"],
[data-testid="add-to-collection-button"] {
  /* Force override Disney+ button resets */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 14px !important;
  line-height: 1.15 !important;
  margin: 0 !important;
  overflow: visible !important;
  text-transform: uppercase !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  border-style: none !important;
  
  /* Restore intended button styling */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  height: 48px !important;
  border: none !important;
  border-radius: 4px !important;
  font-weight: 700 !important;
  letter-spacing: 1.5px !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all 0.2s ease-in-out !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  position: relative !important;
  flex-shrink: 0 !important; /* Prevent buttons from shrinking */
}

/* VIEW PATENT BUTTON - Primary styling (white background, black text) */
[data-testid="view-patent-button"] {
  background-color: #f9f9f9 !important;
  color: #000 !important;
  border: none !important;
  padding: 0 24px !important;
}

[data-testid="view-patent-button"]:hover {
  background-color: #ffffff !important;
  transform: scale(1.02) !important;
  color: #000 !important;
}

/* DETAILS BUTTON - Secondary styling (transparent with white text) */
[data-testid="patent-details-button"] {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
  border: none !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  padding: 0 24px !important;
}

[data-testid="patent-details-button"]:hover {
  background-color: rgba(255, 255, 255, 0.25) !important;
  transform: scale(1.02) !important;
  color: #fff !important;
}

/* ADD TO COLLECTION BUTTON - Circular button */
[data-testid="add-to-collection-button"] {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  background-color: rgba(255, 255, 255, 0.2) !important;
  border: none !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  padding: 0 !important; /* Circular button has no padding */
  color: #fff !important;
}

[data-testid="add-to-collection-button"]:hover {
  background-color: rgba(255, 255, 255, 0.25) !important;
  transform: scale(1.02) !important;
}

/* ADD TO COLLECTION WRAPPER - Ensure it's inline */
._1kf6t6r0,
._19reous4 {
  position: relative !important;
  display: inline-block !important;
  margin: 0 !important; /* Remove margins that might cause stacking */
}

/* DESKTOP LAYOUT (768px and above) - Ensure horizontal layout */
@media (min-width: 768px) {
  [data-testid="details-featured-actions"],
  ._1mp1hfw0 {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
  }
  
  ._1kf6t6r0,
  ._19reous4 {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  [data-testid="view-patent-button"],
  [data-testid="patent-details-button"] {
    flex-shrink: 0 !important;
    width: auto !important; /* Allow natural width */
  }
}

/* Mobile responsive adjustments (767px and below) */
@media (max-width: 767px) {
  [data-testid="details-featured-actions"],
  ._1mp1hfw0 {
    flex-direction: column !important;
    gap: 1rem !important;
    align-items: stretch !important;
  }
  
  ._14aj7771._14aj7770,
  [data-testid="view-patent-button"],
  [data-testid="patent-details-button"] {
    width: 100% !important;
    justify-content: center !important;
  }
  
  ._1kf6t6r0,
  ._19reous4 {
    align-self: center !important;
  }
}

/* ICONS IN BUTTONS */
._14aj7771 svg,
._14aj7770 svg,
[data-testid="view-patent-button"] svg,
[data-testid="patent-details-button"] svg,
[data-testid="add-to-collection-button"] svg {
  width: 16px !important;
  height: 16px !important;
  fill: currentColor !important;
}

/* Focus states */
._14aj7771:focus,
._14aj7770:focus,
[data-testid="view-patent-button"]:focus,
[data-testid="patent-details-button"]:focus,
[data-testid="add-to-collection-button"]:focus {
  outline: 2px solid #ffffff !important;
  outline-offset: 2px !important;
}

/* HIGH SPECIFICITY: Override with body class for maximum specificity */
body.disney-prior-work-page [data-testid="details-featured-actions"],
body.disney-prior-work-page ._1mp1hfw0 {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
}

body.disney-prior-work-page [data-testid="view-patent-button"],
body.disney-prior-work-page [data-testid="patent-details-button"],
body.disney-prior-work-page [data-testid="add-to-collection-button"],
body.disney-prior-work-page ._14aj7771._14aj7770 {
  /* Ensure these styles take precedence over layout */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  text-decoration: none !important;
  cursor: pointer !important;
  border: none !important;
  border-radius: 4px !important;
  transition: all 0.2s ease-in-out !important;
  box-sizing: border-box !important;
  height: 48px !important;
  flex-shrink: 0 !important;
}

/* Restore specific button styling with body class */
body.disney-prior-work-page [data-testid="view-patent-button"] {
  background-color: #f9f9f9 !important;
  color: #000 !important;
  padding: 0 24px !important;
}

body.disney-prior-work-page [data-testid="patent-details-button"] {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  padding: 0 24px !important;
}

body.disney-prior-work-page [data-testid="add-to-collection-button"] {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  background-color: rgba(255, 255, 255, 0.2) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  padding: 0 !important;
  color: #fff !important;
}

/* Restore hover effects with body class */
body.disney-prior-work-page [data-testid="view-patent-button"]:hover {
  background-color: #ffffff !important;
  transform: scale(1.02) !important;
}

body.disney-prior-work-page [data-testid="patent-details-button"]:hover,
body.disney-prior-work-page [data-testid="add-to-collection-button"]:hover {
  background-color: rgba(255, 255, 255, 0.25) !important;
  transform: scale(1.02) !important;
}

/* Additional specificity for stubborn styles */
body ._14aj7771._14aj7770[data-testid="view-patent-button"] {
  background-color: #f9f9f9 !important;
  color: #000 !important;
}

body ._14aj7771._14aj7770[data-testid="patent-details-button"] {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
  backdrop-filter: blur(20px) !important;
}

body ._14aj7771._14aj7770[data-testid="add-to-collection-button"] {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
  backdrop-filter: blur(20px) !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  padding: 0 !important;
}

/* Force horizontal layout at desktop breakpoint */
@media (min-width: 768px) {
  body.disney-prior-work-page [data-testid="details-featured-actions"],
  body.disney-prior-work-page ._1mp1hfw0 {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
  }
}
