/**
 * GP AdBlock Frontend Styles
 * Premium, responsive, glassmorphic design inspired by DeBlocker.
 */

:root {
  --gpab-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --gpab-radius: 16px;
  --gpab-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --gpab-overlay-bg: rgba(15, 23, 42, 0.82);
  --gpab-modal-bg: #ffffff;
  --gpab-text-color: #0f172a;
  --gpab-accent-color: #dc2626;
  --gpab-btn-text: #ffffff;
  --gpab-blur-val: 8px;
}

/* Page content blur container when active */
body.gpab-blur-active > *:not(.gpab-root-overlay):not(script):not(style) {
  filter: blur(var(--gpab-blur-val)) !important;
  pointer-events: none !important;
  user-select: none !important;
  transition: filter 0.3s ease;
}

/* Fullscreen Overlay Container */
.gpab-root-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999999 !important;
  display: flex;
  box-sizing: border-box;
  font-family: var(--gpab-font);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
  overflow-y: auto;
  padding: 1.5rem;
}

.gpab-root-overlay.gpab-visible {
  opacity: 1;
  visibility: visible;
}

/* Overlay Background for Modal & Fullscreen */
.gpab-overlay-backdrop {
  position: fixed;
  inset: 0;
  background-color: var(--gpab-overlay-bg);
  backdrop-filter: blur(var(--gpab-blur-val));
  -webkit-backdrop-filter: blur(var(--gpab-blur-val));
  z-index: -1;
  pointer-events: auto;
}

/* Corner styles do not use full dim backdrop by default */
.gpab-layout-top_right .gpab-overlay-backdrop,
.gpab-layout-top_left .gpab-overlay-backdrop,
.gpab-layout-bottom_right .gpab-overlay-backdrop,
.gpab-layout-bottom_left .gpab-overlay-backdrop {
  background-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

/* --- Layout Positioning --- */

/* 1. Full Screen Lock */
.gpab-layout-fullscreen {
  align-items: center;
  justify-content: center;
}

.gpab-layout-fullscreen .gpab-card {
  max-width: 620px;
  width: 100%;
}

/* 2. Compact Centered Modal */
.gpab-layout-compact {
  align-items: center;
  justify-content: center;
}

.gpab-layout-compact .gpab-card {
  max-width: 520px;
  width: 100%;
}

/* 3. Top Right Corner */
.gpab-layout-top_right {
  align-items: flex-start;
  justify-content: flex-end;
  pointer-events: none;
}

.gpab-layout-top_right .gpab-card {
  pointer-events: auto;
  max-width: 440px;
  width: 100%;
  margin-top: 1rem;
}

/* 4. Top Left Corner */
.gpab-layout-top_left {
  align-items: flex-start;
  justify-content: flex-start;
  pointer-events: none;
}

.gpab-layout-top_left .gpab-card {
  pointer-events: auto;
  max-width: 440px;
  width: 100%;
  margin-top: 1rem;
}

/* 5. Bottom Right Corner */
.gpab-layout-bottom_right {
  align-items: flex-end;
  justify-content: flex-end;
  pointer-events: none;
}

.gpab-layout-bottom_right .gpab-card {
  pointer-events: auto;
  max-width: 440px;
  width: 100%;
  margin-bottom: 1rem;
}

/* 6. Bottom Left Corner */
.gpab-layout-bottom_left {
  align-items: flex-end;
  justify-content: flex-start;
  pointer-events: none;
}

.gpab-layout-bottom_left .gpab-card {
  pointer-events: auto;
  max-width: 440px;
  width: 100%;
  margin-bottom: 1rem;
}

/* --- Modal Card --- */
.gpab-card {
  position: relative;
  background-color: var(--gpab-modal-bg);
  color: var(--gpab-text-color);
  border-radius: var(--gpab-radius);
  box-shadow: var(--gpab-shadow);
  padding: 2.25rem 2rem 2rem;
  box-sizing: border-box;
  transform: translateY(20px) scale(0.98);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.gpab-visible .gpab-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Close Button (X) */
.gpab-close-btn {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.65;
  transition: opacity 0.2s, background-color 0.2s, transform 0.2s;
  padding: 0;
}

.gpab-close-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
  transform: rotate(90deg);
}

.gpab-close-btn svg {
  width: 18px;
  height: 18px;
}

/* Modal Header & Icon */
.gpab-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.gpab-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.1);
  color: var(--gpab-accent-color);
  margin-bottom: 1rem;
  animation: gpab-pulse 2.2s infinite;
}

.gpab-icon-wrapper img {
  max-width: 52px;
  max-height: 52px;
  object-fit: contain;
}

.gpab-icon-wrapper svg {
  width: 34px;
  height: 34px;
}

@keyframes gpab-pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  70% { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.gpab-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  color: inherit;
  letter-spacing: -0.02em;
}

.gpab-body {
  font-size: 0.96rem;
  line-height: 1.6;
  opacity: 0.85;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* --- Action Buttons --- */
.gpab-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.gpab-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--gpab-accent-color);
  color: var(--gpab-btn-text) !important;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 1.5rem;
  border-radius: calc(var(--gpab-radius) - 4px);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}

.gpab-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.38);
  filter: brightness(1.05);
}

.gpab-btn-primary:active {
  transform: translateY(0);
}

.gpab-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: transparent;
  color: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: calc(var(--gpab-radius) - 4px);
  border: 1px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  opacity: 0.8;
  transition: all 0.2s ease;
}

.gpab-btn-secondary:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.04);
}

.gpab-dismiss-link {
  font-size: 0.82rem;
  color: inherit;
  opacity: 0.55;
  text-align: center;
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
  margin-top: 0.5rem;
}

.gpab-dismiss-link:hover {
  opacity: 0.85;
}

/* --- Whitelist Guide Accordion / Tabs --- */
.gpab-guide-container {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: none;
}

.gpab-guide-container.gpab-guide-open {
  display: block;
  animation: gpab-fadein 0.25s ease;
}

@keyframes gpab-fadein {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.gpab-guide-tabs {
  display: flex;
  gap: 0.35rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.gpab-guide-tab {
  background: none;
  border: none;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: inherit;
  opacity: 0.6;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.gpab-guide-tab:hover {
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.04);
}

.gpab-guide-tab.active {
  opacity: 1;
  background: rgba(0, 0, 0, 0.07);
  color: var(--gpab-accent-color);
}

.gpab-guide-content {
  font-size: 0.86rem;
  line-height: 1.5;
}

.gpab-guide-pane {
  display: none;
}

.gpab-guide-pane.active {
  display: block;
}

.gpab-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.gpab-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gpab-accent-color);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Spinner for Re-Check button */
.gpab-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: gpab-spin 0.8s linear infinite;
}

.gpab-checking .gpab-spinner {
  display: inline-block;
}

.gpab-checking .gpab-btn-text-content {
  opacity: 0.75;
}

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

/* Anti-circumvention styles */
.gpab-no-select {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  user-select: none !important;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .gpab-root-overlay {
    padding: 1rem;
    align-items: flex-end !important;
    justify-content: center !important;
  }
  .gpab-card {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1.75rem 1.25rem 1.5rem;
  }
}
