/**
 * Help Button Component Styles
 * Feature: "How Reviews Work" Help Button
 * Created: 2026-01-20
 *
 * Two color groups:
 * - Group A (Purple #7B3FE4): agencies.html, agency-ranking.html
 * - Group B (Orange #FF6B35): share-experience.html, state-scoreboard.html
 *
 * REFACTORED: Phase 2 Icon Standardization (2026-02-01)
 * Base properties moved to floating-icons-base.css
 * This file contains ONLY help-button-specific overrides and unique styles.
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  --help-btn-purple: #7B3FE4;
  --help-btn-purple-hover: #9B5FFF;
  --help-btn-purple-glow: rgba(123, 63, 228, 0.6);
  --help-btn-orange: #FF6B35;
  --help-btn-orange-hover: #FF8555;
  --help-btn-orange-glow: rgba(255, 107, 53, 0.6);
}

/* ============================================
   HELP BUTTON CONTAINER
   Base container from floating-icons-base.css
   ============================================ */
.help-button-container {
  bottom: 445px;
  z-index: 9850;
}

/* ============================================
   HELP BUTTON - Circle Icon
   Base circle from floating-icons-base.css
   Base FA from floating-icons-base.css
   ============================================ */

/* Base FA color override */
.help-button-icon i {
  color: #ffffff;
}

/* Group A: Purple (agencies, agency-ranking) */
.help-button-icon--purple {
  background: linear-gradient(135deg, var(--help-btn-purple) 0%, #9B5FFF 100%);
  box-shadow: 0 0 20px var(--help-btn-purple-glow), 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: helpPurpleGlow 3s ease-in-out infinite;
}

/* Base hover scale from floating-icons-base.css */
.help-button-icon--purple:hover {
  box-shadow: 0 0 30px rgba(123, 63, 228, 0.9), 0 6px 20px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #9B5FFF 0%, var(--help-btn-purple) 100%);
}

/* Base focus from floating-icons-base.css */

@keyframes helpPurpleGlow {
  0%, 100% {
    box-shadow: 0 0 20px var(--help-btn-purple-glow), 0 4px 12px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 35px rgba(123, 63, 228, 0.9), 0 6px 16px rgba(0, 0, 0, 0.3);
  }
}

/* Group B: Orange (share-experience, state-scoreboard) */
.help-button-icon--orange {
  background: linear-gradient(135deg, var(--help-btn-orange) 0%, #FF8555 100%);
  box-shadow: 0 0 20px var(--help-btn-orange-glow), 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: helpOrangeGlow 3s ease-in-out infinite;
}

/* Base hover scale from floating-icons-base.css */
.help-button-icon--orange:hover {
  box-shadow: 0 0 30px rgba(255, 107, 53, 0.9), 0 6px 20px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #FF8555 0%, var(--help-btn-orange) 100%);
}

/* Base focus from floating-icons-base.css */

@keyframes helpOrangeGlow {
  0%, 100% {
    box-shadow: 0 0 20px var(--help-btn-orange-glow), 0 4px 12px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 35px rgba(255, 107, 53, 0.9), 0 6px 16px rgba(0, 0, 0, 0.3);
  }
}

/* ============================================
   HELP MODAL STYLES
   (Modal styles are unique - not part of base)
   ============================================ */
.help-modal {
  display: none;
  position: fixed;
  z-index: 10001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  justify-content: center;
  align-items: center;
}

.help-modal.show {
  display: flex !important;
}

.help-modal-content {
  background-color: #000000;
  border: 3px solid #ffee00;
  padding: 2em;
  text-align: left;
  border-radius: 10px;
  margin: 5% auto;
  width: 90%;
  max-width: 730px;
  position: relative;
  animation: slideDown 0.3s ease;
  box-shadow: 0 10px 40px rgba(255, 238, 0, 0.4);
  color: #919499;
  letter-spacing: 0.015em;
  box-sizing: border-box;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Modal Header */
.help-modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1.5em;
  position: relative;
}

.help-modal-title {
  color: #ffee00;
  margin: 0;
  font-size: 2em;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  width: 100%;
}

.help-modal-title i {
  font-size: 1em;
}

.help-modal--purple .help-modal-title i {
  color: var(--help-btn-purple);
}

.help-modal--orange .help-modal-title i {
  color: var(--help-btn-orange);
}

/* Close button */
.help-modal-close {
  color: #ffee00;
  font-size: 28px;
  font-weight: bold;
  line-height: 20px;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  background: none;
  border: none;
  padding: 0;
  position: absolute;
  top: 0;
  right: 0;
}

.help-modal-close:hover,
.help-modal-close:focus {
  color: #fff;
  transform: scale(1.1);
  text-decoration: none;
  outline: 2px solid #ffee00;
  outline-offset: 2px;
}

/* Modal Body */
.help-modal-body {
  color: #ffffff;
}

.help-modal-section {
  margin-bottom: 1.5em;
}

.help-modal-section:last-child {
  margin-bottom: 0;
}

.help-modal-section-title {
  color: #ffee00;
  font-size: 1.1em;
  font-weight: 600;
  margin: 0 0 0.5em 0;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.help-modal-section-title i {
  font-size: 0.9em;
}

.help-modal--purple .help-modal-section-title i {
  color: var(--help-btn-purple);
}

.help-modal--orange .help-modal-section-title i {
  color: var(--help-btn-orange);
}

.help-modal-section p {
  color: #d0d0d0;
  line-height: 1.6;
  margin: 0 0 0.5em 0;
}

.help-modal-section p:last-child {
  margin-bottom: 0;
}

/* Links in modal */
.help-modal-link {
  color: #ffee00;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.help-modal-link:hover {
  color: #28a745;
}

/* Modal Footer */
.help-modal-footer {
  margin-top: 2em;
  text-align: center;
}

.help-modal-close-btn {
  background: #28a745;
  color: #ffffff !important;
  border: none;
  border-radius: 999px;
  padding: 0.85em 2em;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-width: 200px;
}

.help-modal-close-btn:hover {
  background: #218838;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.help-modal-close-btn:focus {
  outline: 2px solid #ffee00;
  outline-offset: 2px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  /* Mobile container: base gap=0 from floating-icons-base.css */
  .help-button-container {
    bottom: calc(445px + env(safe-area-inset-bottom, 0px));
    right: 20px; /* Match other floating icons */
    z-index: 9850;
  }

  /* Hide label on mobile, show only icon */
  .help-button-label {
    display: none;
  }

  /* OVERRIDE: Help Button uses 36px mobile size (45px CSS = 36px visual after body zoom:0.8) */
  .help-button-icon {
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    min-height: 45px !important;
    max-width: 45px !important;
    max-height: 45px !important;
    aspect-ratio: 1 / 1 !important;
    padding: 0 !important; /* Override btn-standard padding */
    box-sizing: border-box !important; /* Ensure border is included in dimensions */
  }

  /* Mobile FA size (20px) handled by floating-icons-base.css */

  /* Modal adjustments */
  .help-modal-content {
    width: 95%;
    margin: 3% auto;
    padding: 1.5em;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .help-modal-title {
    font-size: 1.6em;
  }

  .help-modal-section-title {
    font-size: 1em;
  }
}

@media (max-width: 480px) {
  .help-modal-content {
    width: 98%;
    padding: 1em;
  }

  .help-modal-title {
    font-size: 1.4em;
  }

  .help-modal-close {
    font-size: 24px;
  }

  .help-modal-close-btn {
    width: 100%;
    max-width: 280px;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Reduced motion for icon handled by floating-icons-base.css */
@media (prefers-reduced-motion: reduce) {
  .help-modal-content {
    animation: none !important;
    transition: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .help-button-icon {
    border-width: 50px;
  }

  .help-modal-content {
    border-width: 4px;
  }
}

/* Focus-visible for icon handled by floating-icons-base.css */
.help-modal-close:focus-visible,
.help-modal-close-btn:focus-visible {
  outline: 3px solid #ffee00;
  outline-offset: 3px;
}

/* Print styles for container handled by floating-icons-base.css */
@media print {
  .help-modal {
    display: none !important;
  }
}

/* ============================================
   DYNAMIC AD-AWARE POSITIONING
   ============================================ */

body.adsense-anchor-active .help-button-container {
  bottom: calc(445px + var(--ad-offset, 0px));
}

@media (max-width: 768px) {
  body.adsense-anchor-active .help-button-container {
    bottom: calc(445px + var(--ad-offset, 0px) + env(safe-area-inset-bottom, 0px));
  }
}
