const { useState, useEffect, useCallback } = React;

// Custom Hook for responsive design
const useResponsive = () => {
  const [dimensions, setDimensions] = useState({
    width: typeof window !== 'undefined' ? window.innerWidth : 1200,
    height: typeof window !== 'undefined' ? window.innerHeight : 800,
    isMobile: typeof window !== 'undefined' ? window.innerWidth <= 768 : false,
    isTablet: typeof window !== 'undefined' ? (window.innerWidth > 768 && window.innerWidth <= 1024) : false,
    isDesktop: typeof window !== 'undefined' ? window.innerWidth > 1024 : true
  });

  useEffect(() => {
    const handleResize = () => {
      const width = window.innerWidth;
      const height = window.innerHeight;
      setDimensions({
        width,
        height,
        isMobile: width <= 768,
        isTablet: width > 768 && width <= 1024,
        isDesktop: width > 1024
      });
    };

    window.addEventListener('resize', handleResize);
    handleResize();
    return () => window.removeEventListener('resize', handleResize);
  }, []);

  return dimensions;
};

// Icon Components
const ChevronDown = ({ size = 16 }) => 
  React.createElement('svg', {
    width: size,
    height: size,
    viewBox: "0 0 24 24",
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "2"
  },
    React.createElement('polyline', { points: "6 9 12 15 18 9" })
  );

const Menu = ({ size = 24 }) =>
  React.createElement('svg', {
    width: size,
    height: size,
    viewBox: "0 0 24 24",
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "2"
  },
    React.createElement('line', { x1: "3", y1: "12", x2: "21", y2: "12" }),
    React.createElement('line', { x1: "3", y1: "6", x2: "21", y2: "6" }),
    React.createElement('line', { x1: "3", y1: "18", x2: "21", y2: "18" })
  );

const X = ({ size = 24 }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
    <line x1="18" y1="6" x2="6" y2="18"></line>
    <line x1="6" y1="6" x2="18" y2="18"></line>
  </svg>
);

const Copy = ({ size = 16 }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
    <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
    <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
  </svg>
);

const Check = ({ size = 16 }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
    <polyline points="20 6 9 17 4 12"></polyline>
  </svg>
);

const Play = ({ size = 16 }) => (
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
    <polygon points="5 3 19 12 5 21 5 3"></polygon>
  </svg>
);

// Authentication Overlay Component
function AuthOverlay({ onAuthenticate, authError, isAuthenticating, responsive }) {
  const [localApiKey, setLocalApiKey] = useState('');

  const handleSubmit = () => {
    if (localApiKey.trim()) {
      onAuthenticate(localApiKey.trim());
    }
  };

  return (
    <div style={{
      position: 'fixed',
      top: 0,
      left: 0,
      width: '100%',
      height: '100%',
      zIndex: 10000,
      background: '#0a0a0a',
      display: 'flex',
      flexDirection: 'column',
      overflow: 'auto'
    }}>
      
      {/* Logo - Fixed position on all devices */}
      <div style={{
        padding: '20px',
        background: 'rgba(10, 10, 10, 0.9)',
        borderBottom: '1px solid rgba(255, 107, 53, 0.1)',
        position: 'sticky',
        top: 0,
        zIndex: 10002,
        backdropFilter: 'blur(10px)'
      }}>
        <div style={{
          display: 'flex',
          alignItems: 'center',
          flexWrap: 'wrap'
        }}>
          <img
            src="./logo_Reverb.svg"
            alt="REVERB API"
            style={{
              height: responsive.isMobile ? '32px' : '40px',
              width: 'auto',
              verticalAlign: 'middle'
            }}
          />
          <span style={{ 
            color: '#ffffff', 
            fontWeight: 'bold', 
            marginLeft: '10px', 
            fontSize: responsive.isMobile ? '1.3rem' : '1.6rem', // Increased from 1rem/1.2rem
            verticalAlign: 'middle',
            WebkitTextFillColor: '#ffffff',
            position: 'relative',
            top: '1.5px'
          }}>for Developers</span>
        </div>
      </div>
      
      {/* Animated Background */}
      <div style={{ position: 'fixed', width: '100%', height: '100%', top: 0, left: 0, zIndex: 0, pointerEvents: 'none' }}>
        {/* Primary orange orbs - increased opacity and size */}
        <div style={{ position: 'absolute', width: '600px', height: '600px', top: '5%', right: '15%', background: 'radial-gradient(circle, rgba(255, 107, 53, 0.45), rgba(255, 140, 66, 0.2), transparent)', filter: 'blur(60px)', animation: 'wander1 6s ease-in-out infinite' }}></div>
        <div style={{ position: 'absolute', width: '550px', height: '550px', bottom: '10%', left: '5%', background: 'radial-gradient(circle, rgba(255, 140, 66, 0.4), rgba(255, 87, 34, 0.18), transparent)', filter: 'blur(50px)', animation: 'wander2 8s ease-in-out infinite' }}></div>
        <div style={{ position: 'absolute', width: '500px', height: '500px', top: '35%', left: '35%', background: 'radial-gradient(circle, rgba(255, 87, 34, 0.42), rgba(237, 134, 49, 0.15), transparent)', filter: 'blur(55px)', animation: 'wander3 5s ease-in-out infinite' }}></div>
        <div style={{ position: 'absolute', width: '450px', height: '450px', top: '55%', right: '25%', background: 'radial-gradient(circle, rgba(255, 107, 53, 0.35), rgba(255, 140, 66, 0.12), transparent)', filter: 'blur(45px)', animation: 'wander4 7s ease-in-out infinite' }}></div>
        
        {/* Additional orange elements for more warmth */}
        <div style={{ position: 'absolute', width: '300px', height: '300px', top: '15%', left: '10%', background: 'radial-gradient(circle, rgba(237, 134, 49, 0.3), transparent)', filter: 'blur(40px)', animation: 'wander1 9s ease-in-out infinite reverse' }}></div>
        <div style={{ position: 'absolute', width: '350px', height: '350px', bottom: '25%', right: '10%', background: 'radial-gradient(circle, rgba(255, 140, 66, 0.28), transparent)', filter: 'blur(50px)', animation: 'wander2 7s ease-in-out infinite reverse' }}></div>
        <div style={{ position: 'absolute', width: '250px', height: '250px', top: '70%', left: '60%', background: 'radial-gradient(circle, rgba(255, 87, 34, 0.25), transparent)', filter: 'blur(35px)', animation: 'wander3 6s ease-in-out infinite reverse' }}></div>
        <div style={{ position: 'absolute', width: '400px', height: '400px', top: '20%', right: '45%', background: 'radial-gradient(circle, rgba(255, 107, 53, 0.2), transparent)', filter: 'blur(65px)', animation: 'wander4 10s ease-in-out infinite reverse' }}></div>
      </div>
      
      {/* Frosted glass overlay */}
      <div style={{ 
        position: 'fixed', 
        width: '100%', 
        height: '100%', 
        background: 'rgba(0, 0, 0, 0.5)', 
        backdropFilter: 'blur(8px) saturate(150%)', 
        WebkitBackdropFilter: 'blur(8px) saturate(150%)',
        zIndex: 1,
        pointerEvents: 'none'
      }}></div>
      
      {/* Main Content Area - Scrollable */}
      <div style={{
        flex: 1,
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center',
        padding: responsive.isMobile ? '1rem' : '2rem',
        position: 'relative',
        zIndex: 2,
        minHeight: responsive.isMobile ? 'auto' : '500px'
      }}>
        <div style={{
          maxWidth: responsive.isMobile ? '100%' : '900px',
          width: '100%',
          display: 'grid',
          gridTemplateColumns: responsive.isMobile ? '1fr' : '1fr 1fr',
          gap: responsive.isMobile ? '1.5rem' : '2rem'
        }}>
          {/* Existing Clients Login Card */}
          <div style={{
            background: 'rgba(20, 20, 20, 0.95)',
            backdropFilter: 'blur(20px) saturate(120%)',
            WebkitBackdropFilter: 'blur(20px) saturate(120%)',
            border: '1px solid rgba(255, 107, 53, 0.2)',
            borderRadius: '16px',
            padding: responsive.isMobile ? '1.5rem' : '2.5rem',
            boxShadow: '0 20px 40px rgba(0, 0, 0, 0.5), 0 0 60px rgba(255, 107, 53, 0.1)'
          }}>
            <h2 style={{
              color: '#ed8631',
              marginBottom: '1rem',
              fontSize: responsive.isMobile ? '1.25rem' : '1.5rem'
            }}>Reverb Clients</h2>
            <div>
              <input
                type="password"
                placeholder="Enter your API key"
                autoComplete="off"
                style={{
                  width: '100%',
                  padding: responsive.isMobile ? '0.75rem' : '0.875rem',
                  background: 'rgba(0, 0, 0, 0.7)',
                  border: '1px solid rgba(255, 107, 53, 0.2)',
                  borderRadius: '8px',
                  color: '#ffffff',
                  fontFamily: "'SF Mono', monospace",
                  marginBottom: '1rem',
                  transition: 'all 0.3s',
                  fontSize: '16px'
                }}
                value={localApiKey}
                onChange={(e) => setLocalApiKey(e.target.value)}
                onKeyPress={(e) => {
                  if (e.key === 'Enter' && localApiKey.trim()) {
                    handleSubmit();
                  }
                }}
                onFocus={(e) => {
                  e.target.style.borderColor = 'rgba(255, 107, 53, 0.5)';
                  e.target.style.boxShadow = '0 0 20px rgba(255, 107, 53, 0.2)';
                }}
                onBlur={(e) => {
                  e.target.style.borderColor = 'rgba(255, 107, 53, 0.2)';
                  e.target.style.boxShadow = 'none';
                }}
              />
              <button
                onClick={handleSubmit}
                disabled={isAuthenticating || !localApiKey.trim()}
                style={{
                  width: '100%',
                  padding: responsive.isMobile ? '0.75rem' : '0.875rem',
                  background: 'linear-gradient(135deg, #ed8631, rgba(255, 140, 66, 0.9))',
                  color: 'white',
                  border: 'none',
                  borderRadius: '8px',
                  fontWeight: 600,
                  cursor: isAuthenticating || !localApiKey.trim() ? 'not-allowed' : 'pointer',
                  transition: 'all 0.3s',
                  boxShadow: '0 4px 15px rgba(255, 107, 53, 0.3)',
                  opacity: isAuthenticating || !localApiKey.trim() ? 0.7 : 1,
                  fontSize: responsive.isMobile ? '0.875rem' : '1rem'
                }}
                onMouseEnter={(e) => {
                  if (!isAuthenticating && localApiKey.trim() && !responsive.isMobile) {
                    e.target.style.transform = 'translateY(-2px)';
                    e.target.style.boxShadow = '0 6px 25px rgba(255, 107, 53, 0.5)';
                  }
                }}
                onMouseLeave={(e) => {
                  if (!responsive.isMobile) {
                    e.target.style.transform = 'translateY(0)';
                    e.target.style.boxShadow = '0 4px 15px rgba(255, 107, 53, 0.3)';
                  }
                }}
              >
                {isAuthenticating ? 'Validating...' : 'Authenticate'}
              </button>
            </div>
            {authError && <div style={{
              color: '#ef4444',
              marginTop: '1rem',
              fontSize: '0.875rem'
            }}>{authError}</div>}
            <p style={{
              color: '#a0a0a0',
              marginTop: '1.5rem',
              fontSize: responsive.isMobile ? '0.8rem' : '0.875rem',
              wordBreak: 'break-word'
            }}>
              Don't have an API key or having trouble? Contact{' '}
              <a href="mailto:reverbtechsupport@bcguardian.com" style={{
                color: '#ed8631',
                textDecoration: 'none',
                transition: 'all 0.3s'
              }}>reverbtechsupport@bcguardian.com</a>
            </p>
          </div>
          
          {/* New Clients Info Card */}
          <div style={{
            background: 'rgba(20, 20, 20, 0.95)',
            backdropFilter: 'blur(20px) saturate(120%)',
            WebkitBackdropFilter: 'blur(20px) saturate(120%)',
            border: '1px solid rgba(255, 107, 53, 0.2)',
            borderRadius: '16px',
            padding: responsive.isMobile ? '1.5rem' : '2.5rem',
            boxShadow: '0 20px 40px rgba(0, 0, 0, 0.5), 0 0 60px rgba(255, 107, 53, 0.1)'
          }}>
            <h2 style={{
              color: '#ffffff',
              marginBottom: '1rem',
              fontSize: responsive.isMobile ? '1.25rem' : '1.5rem'
            }}>Are you a Music Rights Owner?</h2>
            <p style={{
              color: '#cccccc',
              marginBottom: '1.5rem',
              lineHeight: 1.8,
              fontSize: responsive.isMobile ? '0.875rem' : '1rem'
            }}>
              The Reverb Catalog API enables rights owners to seamlessly synchronize their catalog with Reverb, 
              BCGuardian's proprietary artificial intelligence and machine learning platform that helps rights 
              owners recover lost revenue.
            </p>
            <p style={{
              color: '#cccccc',
              marginBottom: '1.5rem',
              lineHeight: 1.8,
              fontSize: responsive.isMobile ? '0.875rem' : '1rem'
            }}>To request access for your organization:</p>
            <div style={{
              textAlign: 'center',
              marginTop: '20px'
            }}>
              <a href="mailto:reverb@bcguardian.info" style={{
                display: 'inline-block',
                padding: responsive.isMobile ? '0.75rem 1rem' : '0.5rem 1rem',
                background: 'linear-gradient(135deg, #ed8631, rgba(255, 140, 66, 0.9))',
                color: 'white',
                border: 'none',
                borderRadius: '8px',
                fontWeight: 600,
                cursor: 'pointer',
                transition: 'all 0.3s',
                boxShadow: '0 4px 15px rgba(255, 107, 53, 0.3)',
                textDecoration: 'none',
                fontSize: '0.875rem'
              }}
              onMouseEnter={(e) => {
                if (!responsive.isMobile) {
                  e.target.style.transform = 'translateY(-2px)';
                  e.target.style.boxShadow = '0 6px 25px rgba(255, 107, 53, 0.5)';
                }
              }}
              onMouseLeave={(e) => {
                if (!responsive.isMobile) {
                  e.target.style.transform = 'translateY(0)';
                  e.target.style.boxShadow = '0 4px 15px rgba(255, 107, 53, 0.3)';
                }
              }}>Contact Us</a>
            </div>
          </div>
        </div>
      </div>
      
      {/* Footer - Sticky at bottom */}
      <footer style={{
        background: 'rgba(20, 20, 20, 0.95)',
        backdropFilter: 'blur(20px)',
        borderTop: '1px solid rgba(255, 107, 53, 0.2)',
        padding: responsive.isMobile ? '0.75rem 1rem' : '1rem 0',
        textAlign: 'center',
        position: 'sticky',
        bottom: 0,
        zIndex: 10002
      }}>
        <p style={{
          color: '#a0a0a0',
          fontSize: responsive.isMobile ? '0.75rem' : '0.875rem',
          margin: 0
        }}>BCGuardian Proprietary and Confidential. All Rights Reserved © 2025-2030</p>
      </footer>
      
      {/* Animation Styles */}
      <style>{`
        @keyframes wander1 {
          0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
          25% { transform: translate(-100px, 150px) scale(1.4) rotate(90deg); }
          50% { transform: translate(150px, -100px) scale(0.8) rotate(180deg); }
          75% { transform: translate(-50px, -120px) scale(1.2) rotate(270deg); }
        }
        @keyframes wander2 {
          0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
          33% { transform: translate(120px, -100px) scale(1.3) rotate(120deg); }
          66% { transform: translate(-150px, 80px) scale(0.7) rotate(240deg); }
        }
        @keyframes wander3 {
          0%, 100% { transform: translate(0, 0) scale(1); }
          20% { transform: translate(-100px, -100px) scale(0.8); }
          40% { transform: translate(100px, 120px) scale(1.5); }
          60% { transform: translate(130px, -60px) scale(1.2); }
          80% { transform: translate(-60px, 80px) scale(0.9); }
        }
        @keyframes wander4 {
          0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
          30% { transform: translate(100px, 100px) scale(1.2) rotate(60deg); }
          60% { transform: translate(-120px, -130px) scale(0.8) rotate(180deg); }
          90% { transform: translate(60px, -50px) scale(1.1) rotate(300deg); }
        }
        
        /* Add class for authenticated content */
        .authenticated-content {
          min-width: 1200px;
        }
      `}</style>
    </div>
  );
}

// Main Application Component
function ReverbAPIDocumentation() {
  const responsive = useResponsive();
  const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
  const [dropdownOpen, setDropdownOpen] = useState(false);
  const [isAuthenticated, setIsAuthenticated] = useState(false);
  const [apiKey, setApiKey] = useState('');
  const [authError, setAuthError] = useState('');
  const [isAuthenticating, setIsAuthenticating] = useState(false);
  const [activePage, setActivePage] = useState('introduction');
  const [copiedStates, setCopiedStates] = useState({});
  const [activeLanguages, setActiveLanguages] = useState({});
  const [testConsoles, setTestConsoles] = useState({});
  const [formInputs, setFormInputs] = useState({
    search: {
      apiKey: '',
      artist: '',
      song: '',
      isrc: '',
      limit: '10'
    },
    add: {
      apiKey: '',
      artist1: '',
      song1: '',
      isrc1: '',
      copyright1: '',
      copyrightDate1: '',
      copyrightReg1: '',
      artist2: '',
      song2: '',
      isrc2: '',
      copyright2: '',
      copyrightDate2: '',
      copyrightReg2: ''
    },
    update: {
      apiKey: '',
      isrc: '',
      song: '',
      copyright: ''
    },
    csv: {
      apiKey: ''
    }
  });

  // Check for saved session on mount
  useEffect(() => {
    const savedApiKey = localStorage.getItem('reverb_api_key');
    if (savedApiKey) {
      validateApiKey(savedApiKey).catch(() => {
        localStorage.removeItem('reverb_api_key');
        localStorage.removeItem('reverb_client_id');
      });
    }
  }, []);

  // Add/remove authenticated-content class to body
  useEffect(() => {
    if (isAuthenticated && !responsive.isMobile) {
      document.body.classList.add('authenticated-content');
    } else {
      document.body.classList.remove('authenticated-content');
    }
    
    return () => {
      document.body.classList.remove('authenticated-content');
    };
  }, [isAuthenticated, responsive.isMobile]);

  const validateApiKey = async (key) => {
    setIsAuthenticating(true);
    setAuthError('');
    
    try {
      const response = await fetch('/api/v1/validate-key', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'X-API-Key': key
        },
        body: JSON.stringify({
          validate: true
        })
      });
  
      const data = await response.json();
  
      if (response.ok && data.success) {
        setIsAuthenticated(true);
        setApiKey(key);
        localStorage.setItem('reverb_api_key', key);
        
        if (data.client_id) {
          localStorage.setItem('reverb_client_id', data.client_id);
        }
        
        setFormInputs(prev => ({
          search: { ...prev.search, apiKey: key },
          add: { ...prev.add, apiKey: key },
          update: { ...prev.update, apiKey: key },
          csv: { ...prev.csv, apiKey: key }
        }));
      } else {
        setAuthError(data.error || 'Invalid API key. Please check your credentials.');
        localStorage.removeItem('reverb_api_key');
        localStorage.removeItem('reverb_client_id');
      }
    } catch (error) {
      console.error('Authentication error:', error);
      setAuthError('Failed to validate API key. Please check your connection and try again.');
      localStorage.removeItem('reverb_api_key');
      localStorage.removeItem('reverb_client_id');
    } finally {
      setIsAuthenticating(false);
    }
  };

  const handleAuthenticate = (enteredKey) => {
    if (!enteredKey) {
      setAuthError('Please enter your API key');
      return;
    }
    validateApiKey(enteredKey);
  };

  const handleLogout = () => {
    setIsAuthenticated(false);
    setApiKey('');
    localStorage.removeItem('reverb_api_key');
    localStorage.removeItem('reverb_client_id');
    setMobileMenuOpen(false);
  };

  const copyToClipboard = async (text, id) => {
    try {
      await navigator.clipboard.writeText(text);
      setCopiedStates(prev => ({ ...prev, [id]: true }));
      setTimeout(() => {
        setCopiedStates(prev => ({ ...prev, [id]: false }));
      }, 2000);
    } catch (err) {
      console.error('Failed to copy:', err);
    }
  };

  const scrollToSection = (sectionId) => {
    setTimeout(() => {
      const element = document.getElementById(sectionId);
      if (element) {
        element.scrollIntoView({ behavior: 'smooth', block: 'start' });
      }
    }, 100);
  };

  const testAPI = async (section) => {
    const consoleKey = `${section}-console`;
    
    setTestConsoles(prev => ({
      ...prev,
      [consoleKey]: { loading: true, data: null, error: null }
    }));

    try {
      let endpoint, method, body;
      
      switch(section) {
        case 'search':
          endpoint = `/api/v1/reverb-catalog-access?limit=${formInputs.search.limit || 10}${formInputs.search.artist ? `&artist=${encodeURIComponent(formInputs.search.artist)}` : ''}${formInputs.search.song ? `&song_title=${encodeURIComponent(formInputs.search.song)}` : ''}`;
          method = 'GET';
          break;
        case 'add':
          endpoint = '/api/v1/quick-batch';
          method = 'POST';
          body = JSON.stringify([{
            artist: formInputs.add.artist1 || 'Demo Artist',
            song_title: formInputs.add.song1 || 'Test Track',
            isrc: formInputs.add.isrc1 || 'XX0001234567',
            copyright_claimant: formInputs.add.copyright1 || undefined,
            copyright_date: formInputs.add.copyrightDate1 || undefined,
            copyright_registration_num: formInputs.add.copyrightReg1 || undefined
          }]);
          break;
        case 'update':
          endpoint = `/api/v1/revise-reverb-catalog?isrc=${formInputs.update.isrc || 'XX0001234567'}`;
          method = 'PATCH';
          body = JSON.stringify({
            song_title: formInputs.update.song || 'Updated Song'
          });
          break;
        case 'csv':
          setTestConsoles(prev => ({
            ...prev,
            [consoleKey]: {
              loading: false,
              data: {
                status: 200,
                statusText: 'OK',
                response: {
                  message: 'CSV upload endpoint ready. Use with actual CSV file.',
                  endpoint: '/api/v1/upload-csv',
                  method: 'POST',
                  headers: {
                    'X-API-Key': apiKey,
                    'Content-Type': 'text/csv'
                  }
                }
              },
              error: null
            }
          }));
          return;
        default:
          throw new Error('Unknown section');
      }

      const response = await fetch(endpoint, {
        method: method,
        headers: {
          'X-API-Key': apiKey,
          'Content-Type': 'application/json'
        },
        body: method !== 'GET' ? body : undefined
      });

      const data = await response.json();

      setTestConsoles(prev => ({
        ...prev,
        [consoleKey]: {
          loading: false,
          data: {
            status: response.status,
            statusText: response.statusText,
            response: data
          },
          error: null
        }
      }));
    } catch (error) {
      setTestConsoles(prev => ({
        ...prev,
        [consoleKey]: {
          loading: false,
          data: null,
          error: error.message
        }
      }));
    }
  };

  const updateInput = (section, field, value) => {
    setFormInputs(prev => ({
      ...prev,
      [section]: {
        ...prev[section],
        [field]: value
      }
    }));
  };

  const getCodeExamples = useCallback((section) => {
    const examples = {
      search: {
        curl: `curl -X GET "https://reverb2catalogapi.bcguardian.com/api/v1/reverb-catalog-access?limit=${formInputs.search.limit || 10}${formInputs.search.artist ? `&artist=${encodeURIComponent(formInputs.search.artist)}` : ''}${formInputs.search.song ? `&song_title=${encodeURIComponent(formInputs.search.song)}` : ''}" \\
  -H "X-API-Key: ${formInputs.search.apiKey || 'your-api-key-here'}" \\
  -H "Content-Type: application/json"`,
        javascript: `const searchCatalog = async () => {
  const params = new URLSearchParams({
    limit: ${formInputs.search.limit || 10}${formInputs.search.artist ? `,
    artist: "${formInputs.search.artist}"` : ''}${formInputs.search.song ? `,
    song_title: "${formInputs.search.song}"` : ''}${formInputs.search.isrc ? `,
    isrc: "${formInputs.search.isrc}"` : ''}
  });

  const response = await fetch(\`https://reverb2catalogapi.bcguardian.com/api/v1/reverb-catalog-access?\${params}\`, {
    method: 'GET',
    headers: {
      'X-API-Key': '${formInputs.search.apiKey || 'your-api-key-here'}',
      'Content-Type': 'application/json'
    }
  });

  const data = await response.json();
  console.log(data);
};

searchCatalog();`,
        python: `import requests

url = "https://reverb2catalogapi.bcguardian.com/api/v1/reverb-catalog-access"
headers = {
    "X-API-Key": "${formInputs.search.apiKey || 'your-api-key-here'}",
    "Content-Type": "application/json"
}
params = {
    "limit": ${formInputs.search.limit || 10}${formInputs.search.artist ? `,
    "artist": "${formInputs.search.artist}"` : ''}${formInputs.search.song ? `,
    "song_title": "${formInputs.search.song}"` : ''}${formInputs.search.isrc ? `,
    "isrc": "${formInputs.search.isrc}"` : ''}
}

response = requests.get(url, headers=headers, params=params)
data = response.json()
print(data)`,
        java: `import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class SearchCatalog {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        
        String url = "https://reverb2catalogapi.bcguardian.com/api/v1/reverb-catalog-access?limit=${formInputs.search.limit || 10}${formInputs.search.artist ? `&artist=${encodeURIComponent(formInputs.search.artist)}` : ''}${formInputs.search.song ? `&song_title=${encodeURIComponent(formInputs.search.song)}` : ''}";
        
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("X-API-Key", "${formInputs.search.apiKey || 'your-api-key-here'}")
            .header("Content-Type", "application/json")
            .GET()
            .build();
        
        HttpResponse<String> response = client.send(request, 
            HttpResponse.BodyHandlers.ofString());
        
        System.out.println(response.body());
    }
}`
      },
      add: {
        curl: `curl -X POST "https://reverb2catalogapi.bcguardian.com/api/v1/quick-batch" \\
  -H "X-API-Key: ${formInputs.add.apiKey || 'your-api-key-here'}" \\
  -H "Content-Type: application/json" \\
  -d '[{
    "artist": "${formInputs.add.artist1 || 'Demo Artist'}",
    "song_title": "${formInputs.add.song1 || 'Test Track One'}",
    "isrc": "${formInputs.add.isrc1 || 'XX0001234567'}"${formInputs.add.copyright1 ? `,
    "copyright_claimant": "${formInputs.add.copyright1}"` : ''}${formInputs.add.copyrightDate1 ? `,
    "copyright_date": "${formInputs.add.copyrightDate1}"` : ''}${formInputs.add.copyrightReg1 ? `,
    "copyright_registration_num": "${formInputs.add.copyrightReg1}"` : ''}
  }${formInputs.add.artist2 || formInputs.add.song2 || formInputs.add.isrc2 ? `,
  {
    "artist": "${formInputs.add.artist2 || 'Sample Band'}",
    "song_title": "${formInputs.add.song2 || 'Example Song'}",
    "isrc": "${formInputs.add.isrc2 || 'XX0001234568'}"${formInputs.add.copyright2 ? `,
    "copyright_claimant": "${formInputs.add.copyright2}"` : ''}
  }` : ''}]'`,
        javascript: `const addRecords = async () => {
  const records = [{
    artist: "${formInputs.add.artist1 || 'Demo Artist'}",
    song_title: "${formInputs.add.song1 || 'Test Track One'}",
    isrc: "${formInputs.add.isrc1 || 'XX0001234567'}"${formInputs.add.copyright1 ? `,
    copyright_claimant: "${formInputs.add.copyright1}"` : ''}${formInputs.add.copyrightDate1 ? `,
    copyright_date: "${formInputs.add.copyrightDate1}"` : ''}
  }${formInputs.add.artist2 || formInputs.add.song2 ? `,
  {
    artist: "${formInputs.add.artist2 || 'Sample Band'}",
    song_title: "${formInputs.add.song2 || 'Example Song'}",
    isrc: "${formInputs.add.isrc2 || 'XX0001234568'}"
  }` : ''}];

  const response = await fetch('https://reverb2catalogapi.bcguardian.com/api/v1/quick-batch', {
    method: 'POST',
    headers: {
      'X-API-Key': '${formInputs.add.apiKey || 'your-api-key-here'}',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(records)
  });

  const data = await response.json();
  console.log(data);
};

addRecords();`,
        python: `import requests
import json

url = "https://reverb2catalogapi.bcguardian.com/api/v1/quick-batch"
headers = {
    "X-API-Key": "${formInputs.add.apiKey || 'your-api-key-here'}",
    "Content-Type": "application/json"
}

records = [
    {
        "artist": "${formInputs.add.artist1 || 'Demo Artist'}",
        "song_title": "${formInputs.add.song1 || 'Test Track One'}",
        "isrc": "${formInputs.add.isrc1 || 'XX0001234567'}"${formInputs.add.copyright1 ? `,
        "copyright_claimant": "${formInputs.add.copyright1}"` : ''}${formInputs.add.copyrightDate1 ? `,
        "copyright_date": "${formInputs.add.copyrightDate1}"` : ''}
    }${formInputs.add.artist2 || formInputs.add.song2 ? `,
    {
        "artist": "${formInputs.add.artist2 || 'Sample Band'}",
        "song_title": "${formInputs.add.song2 || 'Example Song'}",
        "isrc": "${formInputs.add.isrc2 || 'XX0001234568'}"
    }` : ''}
]

response = requests.post(url, headers=headers, data=json.dumps(records))
data = response.json()
print(data)`,
        java: `import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.google.gson.Gson;
import java.util.List;
import java.util.Map;

public class AddRecords {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        Gson gson = new Gson();
        
        List<Map<String, String>> records = List.of(
            Map.of(
                "artist", "${formInputs.add.artist1 || 'Demo Artist'}",
                "song_title", "${formInputs.add.song1 || 'Test Track One'}",
                "isrc", "${formInputs.add.isrc1 || 'XX0001234567'}"${formInputs.add.copyright1 ? `,
                "copyright_claimant", "${formInputs.add.copyright1}"` : ''}
            )${formInputs.add.artist2 || formInputs.add.song2 ? `,
            Map.of(
                "artist", "${formInputs.add.artist2 || 'Sample Band'}",
                "song_title", "${formInputs.add.song2 || 'Example Song'}",
                "isrc", "${formInputs.add.isrc2 || 'XX0001234568'}"
            )` : ''}
        );
        
        String jsonBody = gson.toJson(records);
        
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://reverb2catalogapi.bcguardian.com/api/v1/quick-batch"))
            .header("X-API-Key", "${formInputs.add.apiKey || 'your-api-key-here'}")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonBody))
            .build();
        
        HttpResponse<String> response = client.send(request, 
            HttpResponse.BodyHandlers.ofString());
        
        System.out.println(response.body());
    }
}`
      },
      update: {
        curl: `curl -X PATCH "https://reverb2catalogapi.bcguardian.com/api/v1/revise-reverb-catalog?isrc=${formInputs.update.isrc || 'XX0001234567'}" \\
  -H "X-API-Key: ${formInputs.update.apiKey || 'your-api-key-here'}" \\
  -H "Content-Type: application/json" \\
  -d '{
    "song_title": "${formInputs.update.song || 'Updated Demo Song'}"${formInputs.update.copyright ? `,
    "copyright_claimant": "${formInputs.update.copyright}"` : ''}
  }'`,
        javascript: `const updateRecord = async () => {
  const updates = {
    song_title: "${formInputs.update.song || 'Updated Demo Song'}"${formInputs.update.copyright ? `,
    copyright_claimant: "${formInputs.update.copyright}"` : ''}
  };

  const response = await fetch(
    'https://reverb2catalogapi.bcguardian.com/api/v1/revise-reverb-catalog?isrc=${formInputs.update.isrc || 'XX0001234567'}',
    {
      method: 'PATCH',
      headers: {
        'X-API-Key': '${formInputs.update.apiKey || 'your-api-key-here'}',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(updates)
    }
  );

  const data = await response.json();
  console.log(data);
};

updateRecord();`,
        python: `import requests
import json

url = "https://reverb2catalogapi.bcguardian.com/api/v1/revise-reverb-catalog"
headers = {
    "X-API-Key": "${formInputs.update.apiKey || 'your-api-key-here'}",
    "Content-Type": "application/json"
}
params = {
    "isrc": "${formInputs.update.isrc || 'XX0001234567'}"
}

updates = {
    "song_title": "${formInputs.update.song || 'Updated Demo Song'}"${formInputs.update.copyright ? `,
    "copyright_claimant": "${formInputs.update.copyright}"` : ''}
}

response = requests.patch(url, headers=headers, params=params, data=json.dumps(updates))
data = response.json()
print(data)`,
        java: `import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.google.gson.Gson;
import java.util.Map;

public class UpdateRecord {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        Gson gson = new Gson();
        
        Map<String, String> updates = Map.of(
            "song_title", "${formInputs.update.song || 'Updated Demo Song'}"${formInputs.update.copyright ? `,
            "copyright_claimant", "${formInputs.update.copyright}"` : ''}
        );
        
        String jsonBody = gson.toJson(updates);
        
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://reverb2catalogapi.bcguardian.com/api/v1/revise-reverb-catalog?isrc=${formInputs.update.isrc || 'XX0001234567'}"))
            .header("X-API-Key", "${formInputs.update.apiKey || 'your-api-key-here'}")
            .header("Content-Type", "application/json")
            .method("PATCH", HttpRequest.BodyPublishers.ofString(jsonBody))
            .build();
        
        HttpResponse<String> response = client.send(request, 
            HttpResponse.BodyHandlers.ofString());
        
        System.out.println(response.body());
    }
}`
      },
      csv: {
        curl: `curl -X POST "https://reverb2catalogapi.bcguardian.com/api/v1/upload-csv" \\
  -H "X-API-Key: ${formInputs.csv.apiKey || 'your-api-key-here'}" \\
  -H "Content-Type: text/csv" \\
  --data-binary @catalog.csv

# Or with inline CSV data:
curl -X POST "https://reverb2catalogapi.bcguardian.com/api/v1/upload-csv" \\
  -H "X-API-Key: ${formInputs.csv.apiKey || 'your-api-key-here'}" \\
  -H "Content-Type: text/csv" \\
  --data-binary 'artist,song_title,isrc,copyright_claimant
Stellar Wave,Digital Dreams,USRC12345001,Wave Music Group
The Echo Chamber,Midnight Reflections,USRC12345002,Echo Productions LLC'`,
        javascript: `const uploadCSV = async () => {
  const csvContent = \`artist,song_title,isrc,copyright_claimant,copyright_date
The Crickets,Yesterday,GBUM71505079,Apple Records,2024-01-15
King,Best Day,GBUM71500023,King Music Ltd,2024-02-20
Pink,You Were Here,GBDRL7500001,Pink Music,2024-03-10\`;

  const response = await fetch('https://reverb2catalogapi.bcguardian.com/api/v1/upload-csv', {
    method: 'POST',
    headers: {
      'X-API-Key': '${formInputs.csv.apiKey || 'your-api-key-here'}',
      'Content-Type': 'text/csv'
    },
    body: csvContent
  });

  const data = await response.json();
  console.log(data);
};

// Or upload from file input
const uploadCSVFile = async (file) => {
  const csvContent = await file.text();
  
  const response = await fetch('https://reverb2catalogapi.bcguardian.com/api/v1/upload-csv', {
    method: 'POST',
    headers: {
      'X-API-Key': '${formInputs.csv.apiKey || 'your-api-key-here'}',
      'Content-Type': 'text/csv'
    },
    body: csvContent
  });

  const data = await response.json();
  console.log(data);
};

uploadCSV();`,
        python: `import requests

url = "https://reverb2catalogapi.bcguardian.com/api/v1/upload-csv"
headers = {
    "X-API-Key": "${formInputs.csv.apiKey || 'your-api-key-here'}",
    "Content-Type": "text/csv"
}

# From file
with open('catalog.csv', 'r') as file:
    csv_content = file.read()

# Or inline
csv_content = """artist,song_title,isrc,copyright_claimant,copyright_date,copyright_registration_num
Demo Artist,Test Track One,TEST12345001,Demo Publishing LLC,2024-01-15,REG2024001
Sample Band,Example Song,TEST12345002,Sample Music Group,2024-02-20,REG2024002
Studio Crew,Digital Dreams,TEST12345003,Studio Records Inc,2024-03-10,REG2024003
Echo Chamber,Midnight Run,TEST12345004,Echo Productions,2024-04-05,"""

response = requests.post(url, headers=headers, data=csv_content)
data = response.json()
print(data)`,
        java: `import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Paths;

public class UploadCSV {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        
        // Read CSV from file
        String csvContent = Files.readString(Paths.get("catalog.csv"));
        
        // Or use inline CSV
        /*
        String csvContent = """
            artist,song_title,isrc,copyright_claimant
            Stellar Wave,Digital Dreams,USRC12345001,Wave Music Group
            The Echo Chamber,Midnight Reflections,USRC12345002,Echo Productions LLC
            Neon Skyline,Electric Pulse,USRC12345003,Skyline Records Inc
            """;
        */
        
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://reverb2catalogapi.bcguardian.com/api/v1/upload-csv"))
            .header("X-API-Key", "${formInputs.csv.apiKey || 'your-api-key-here'}")
            .header("Content-Type", "text/csv")
            .POST(HttpRequest.BodyPublishers.ofString(csvContent))
            .build();
        
        HttpResponse<String> response = client.send(request, 
            HttpResponse.BodyHandlers.ofString());
        
        System.out.println(response.body());
    }
}`
      }
    };
    return examples[section] || {};
  }, [formInputs]);

  if (!isAuthenticated) {
    return <AuthOverlay onAuthenticate={handleAuthenticate} authError={authError} isAuthenticating={isAuthenticating} responsive={responsive} />;
  }

  // Main app after authentication
  return (
    <div style={{
      fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
      background: '#0a0a0a',
      color: '#ffffff',
      minHeight: '100vh',
      position: 'relative',
      lineHeight: 1.6,
      width: '100%',
      overflowX: responsive.isMobile ? 'hidden' : 'auto'
    }}>
      
      {/* Static Background - No animations after login */}
      <div style={{
        position: 'fixed',
        width: '100%',
        height: '100%',
        top: 0,
        left: 0,
        zIndex: -1,
        overflow: 'hidden'
      }}>
        {/* Primary large orange orbs */}
        <div style={{
          position: 'absolute',
          width: '900px',
          height: '900px',
          background: 'radial-gradient(circle, rgba(237, 134, 49, 0.25), rgba(255, 140, 66, 0.08), transparent)',
          top: '-350px',
          right: '-250px',
          borderRadius: '50%',
          filter: 'blur(120px)'
        }}></div>
        <div style={{
          position: 'absolute',
          width: '700px',
          height: '700px',
          background: 'radial-gradient(circle, rgba(255, 107, 53, 0.22), rgba(255, 87, 34, 0.06), transparent)',
          bottom: '-250px',
          left: '-200px',
          borderRadius: '50%',
          filter: 'blur(120px)'
        }}></div>
        <div style={{
          position: 'absolute',
          width: '600px',
          height: '600px',
          background: 'radial-gradient(circle, rgba(255, 140, 66, 0.2), rgba(237, 134, 49, 0.05), transparent)',
          top: '40%',
          left: '40%',
          borderRadius: '50%',
          filter: 'blur(120px)'
        }}></div>
        
        {/* Additional medium orange elements */}
        <div style={{
          position: 'absolute',
          width: '400px',
          height: '400px',
          background: 'radial-gradient(circle, rgba(255, 87, 34, 0.18), transparent)',
          top: '10%',
          left: '15%',
          borderRadius: '50%',
          filter: 'blur(80px)'
        }}></div>
        <div style={{
          position: 'absolute',
          width: '350px',
          height: '350px',
          background: 'radial-gradient(circle, rgba(237, 134, 49, 0.16), transparent)',
          bottom: '15%',
          right: '20%',
          borderRadius: '50%',
          filter: 'blur(70px)'
        }}></div>
        <div style={{
          position: 'absolute',
          width: '300px',
          height: '300px',
          background: 'radial-gradient(circle, rgba(255, 140, 66, 0.14), transparent)',
          top: '60%',
          left: '70%',
          borderRadius: '50%',
          filter: 'blur(60px)'
        }}></div>
        
        {/* Smaller accent orbs */}
        <div style={{
          position: 'absolute',
          width: '200px',
          height: '200px',
          background: 'radial-gradient(circle, rgba(255, 107, 53, 0.12), transparent)',
          top: '25%',
          left: '25%',
          borderRadius: '50%',
          filter: 'blur(40px)'
        }}></div>
        <div style={{
          position: 'absolute',
          width: '250px',
          height: '250px',
          background: 'radial-gradient(circle, rgba(255, 87, 34, 0.1), transparent)',
          bottom: '35%',
          left: '60%',
          borderRadius: '50%',
          filter: 'blur(50px)'
        }}></div>
      </div>

      {/* Navigation */}
      <nav style={{
        background: 'rgba(255, 255, 255, 0.04)',
        backdropFilter: 'blur(24px) saturate(150%)',
        WebkitBackdropFilter: 'blur(24px) saturate(150%)',
        borderBottom: '1px solid rgba(255, 255, 255, 0.08)',
        padding: '1.25rem 0',
        position: 'sticky',
        top: 0,
        zIndex: 100
      }}>
        <div style={{
          maxWidth: responsive.isMobile ? '100%' : '1400px',
          margin: '0 auto',
          padding: responsive.isMobile ? '0 1rem' : '0 2rem',
          display: 'flex',
          justifyContent: 'space-between',
          alignItems: 'center'
        }}>
          <div style={{
            fontSize: responsive.isMobile ? '1.2rem' : '1.5rem',
            fontWeight: 600,
            letterSpacing: '-0.02em',
            cursor: 'pointer',
            display: 'flex',
            alignItems: 'center',
            flexWrap: 'wrap'
          }}>
            <img
              src="./logo_Reverb.svg"
              alt="REVERB API"
              style={{
                height: responsive.isMobile ? '24px' : '30px',
                width: 'auto',
                verticalAlign: 'middle'
              }}
            />
            <span style={{ 
              color: '#ffffff', 
              fontWeight: 'bold', 
              marginLeft: '10px', 
              verticalAlign: 'middle', 
              position: 'relative', 
              top: '0px',
              WebkitTextFillColor: '#ffffff'
            }}>for Developers</span>
          </div>

          {/* Desktop Navigation */}
          {responsive.isDesktop && (
            <ul style={{
              display: 'flex',
              gap: '2rem',
              listStyle: 'none',
              alignItems: 'center',
              margin: 0,
              padding: 0
            }}>
              <li>
                <a
                  href="#"
                  style={{
                    color: activePage === 'introduction' ? '#ed8631' : '#a0a0a0',
                    textDecoration: 'none',
                    fontSize: '0.95rem',
                    fontWeight: 500,
                    transition: 'color 0.2s ease',
                    cursor: 'pointer'
                  }}
                  onClick={(e) => {
                    e.preventDefault();
                    setActivePage('introduction');
                  }}
                  onMouseEnter={(e) => e.target.style.color = '#ffffff'}
                  onMouseLeave={(e) => e.target.style.color = activePage === 'introduction' ? '#ed8631' : '#a0a0a0'}
                >
                  Introduction
                </a>
              </li>

              {/* Dropdown Menu Item */}
              <li
                style={{ position: 'relative' }}
                onMouseEnter={() => setDropdownOpen(true)}
                onMouseLeave={() => setDropdownOpen(false)}
              >
                <a
                  href="#"
                  style={{
                    color: activePage === 'catalog-management' ? '#ed8631' : '#a0a0a0',
                    textDecoration: 'none',
                    fontSize: '0.95rem',
                    fontWeight: 500,
                    transition: 'color 0.2s ease',
                    cursor: 'pointer',
                    display: 'flex',
                    alignItems: 'center',
                    gap: '0.5rem'
                  }}
                  onClick={(e) => {
                    e.preventDefault();
                    setActivePage('catalog-management');
                    scrollToSection('search-section');
                  }}
                  onMouseEnter={(e) => e.currentTarget.style.color = '#ffffff'}
                  onMouseLeave={(e) => e.currentTarget.style.color = activePage === 'catalog-management' ? '#ed8631' : '#a0a0a0'}
                >
                  Catalog Management <ChevronDown size={12} />
                </a>
                {dropdownOpen && (
                  <div
                    style={{
                      position: 'absolute',
                      top: '100%',
                      left: '50%',
                      transform: 'translateX(-50%)',
                      paddingTop: '0.5rem', // UPDATED: Changed from marginTop to remove hover gap
                      background: 'rgba(20, 20, 20, 0.98)',
                      backdropFilter: 'blur(20px) saturate(150%)',
                      WebkitBackdropFilter: 'blur(20px) saturate(150%)',
                      border: '1px solid rgba(255, 255, 255, 0.1)',
                      borderRadius: '8px',
                      padding: '0.5rem',
                      minWidth: '200px',
                      boxShadow: '0 10px 30px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 107, 53, 0.1)',
                      zIndex: 1000
                    }}
                    // UPDATED: Removed redundant onMouseEnter/onMouseLeave handlers from this div
                  >
                    <a
                      href="#search-section"
                      style={{
                        display: 'block',
                        padding: '0.75rem 1rem',
                        color: '#a0a0a0',
                        textDecoration: 'none',
                        borderRadius: '6px',
                        transition: 'all 0.2s',
                        fontSize: '0.9rem',
                        cursor: 'pointer'
                      }}
                      onClick={(e) => {
                        e.preventDefault();
                        setActivePage('catalog-management');
                        setDropdownOpen(false);
                        scrollToSection('search-section');
                      }}
                      onMouseEnter={(e) => {
                        e.target.style.background = 'rgba(255, 107, 53, 0.15)';
                        e.target.style.color = '#ed8631';
                      }}
                      onMouseLeave={(e) => {
                        e.target.style.background = 'transparent';
                        e.target.style.color = '#a0a0a0';
                      }}
                    >
                      Search & Retrieve
                    </a>
                    <a
                      href="#add-section"
                      style={{
                        display: 'block',
                        padding: '0.75rem 1rem',
                        color: '#a0a0a0',
                        textDecoration: 'none',
                        borderRadius: '6px',
                        transition: 'all 0.2s',
                        fontSize: '0.9rem',
                        cursor: 'pointer'
                      }}
                      onClick={(e) => {
                        e.preventDefault();
                        setActivePage('catalog-management');
                        setDropdownOpen(false);
                        scrollToSection('add-section');
                      }}
                      onMouseEnter={(e) => {
                        e.target.style.background = 'rgba(255, 107, 53, 0.15)';
                        e.target.style.color = '#ed8631';
                      }}
                      onMouseLeave={(e) => {
                        e.target.style.background = 'transparent';
                        e.target.style.color = '#a0a0a0';
                      }}
                    >
                      Add Records
                    </a>
                    <a
                      href="#csv-section"
                      style={{
                        display: 'block',
                        padding: '0.75rem 1rem',
                        color: '#a0a0a0',
                        textDecoration: 'none',
                        borderRadius: '6px',
                        transition: 'all 0.2s',
                        fontSize: '0.9rem',
                        cursor: 'pointer'
                      }}
                      onClick={(e) => {
                        e.preventDefault();
                        setActivePage('catalog-management');
                        setDropdownOpen(false);
                        scrollToSection('csv-section');
                      }}
                      onMouseEnter={(e) => {
                        e.target.style.background = 'rgba(255, 107, 53, 0.15)';
                        e.target.style.color = '#ed8631';
                      }}
                      onMouseLeave={(e) => {
                        e.target.style.background = 'transparent';
                        e.target.style.color = '#a0a0a0';
                      }}
                    >
                      CSV Upload
                    </a>
                    <a
                      href="#update-section"
                      style={{
                        display: 'block',
                        padding: '0.75rem 1rem',
                        color: '#a0a0a0',
                        textDecoration: 'none',
                        borderRadius: '6px',
                        transition: 'all 0.2s',
                        fontSize: '0.9rem',
                        cursor: 'pointer'
                      }}
                      onClick={(e) => {
                        e.preventDefault();
                        setActivePage('catalog-management');
                        setDropdownOpen(false);
                        scrollToSection('update-section');
                      }}
                      onMouseEnter={(e) => {
                        e.target.style.background = 'rgba(255, 107, 53, 0.15)';
                        e.target.style.color = '#ed8631';
                      }}
                      onMouseLeave={(e) => {
                        e.target.style.background = 'transparent';
                        e.target.style.color = '#a0a0a0';
                      }}
                    >
                      Update Records
                    </a>
                    <div style={{
                      height: '1px',
                      background: 'rgba(255, 255, 255, 0.1)',
                      margin: '0.5rem 0'
                    }}></div>
                    <a
                      href="#troubleshooting-section"
                      style={{
                        display: 'block',
                        padding: '0.75rem 1rem',
                        color: '#a0a0a0',
                        textDecoration: 'none',
                        borderRadius: '6px',
                        transition: 'all 0.2s',
                        fontSize: '0.9rem',
                        cursor: 'pointer'
                      }}
                      onClick={(e) => {
                        e.preventDefault();
                        setActivePage('catalog-management');
                        setDropdownOpen(false);
                        scrollToSection('troubleshooting-section');
                      }}
                      onMouseEnter={(e) => {
                        e.target.style.background = 'rgba(255, 107, 53, 0.15)';
                        e.target.style.color = '#ed8631';
                      }}
                      onMouseLeave={(e) => {
                        e.target.style.background = 'transparent';
                        e.target.style.color = '#a0a0a0';
                      }}
                    >
                      Troubleshooting
                    </a>
                  </div>
                )}
              </li>
              <li>
                <button
                  onClick={handleLogout}
                  style={{
                    padding: '0.5rem 1rem',
                    background: 'rgba(255, 107, 53, 0.15)',
                    color: '#ed8631',
                    border: '1px solid rgba(255, 107, 53, 0.3)',
                    borderRadius: '6px',
                    fontSize: '0.875rem',
                    cursor: 'pointer',
                    transition: 'all 0.3s'
                  }}
                  onMouseEnter={(e) => {
                    e.target.style.background = '#ed8631';
                    e.target.style.color = 'white';
                  }}
                  onMouseLeave={(e) => {
                    e.target.style.background = 'rgba(255, 107, 53, 0.15)';
                    e.target.style.color = '#ed8631';
                  }}
                >
                  Logout
                </button>
              </li>
            </ul>
          )}
          {/* Mobile/Tablet Menu Button */}
          {!responsive.isDesktop && (
            <button
              onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
              style={{
                background: 'transparent',
                border: 'none',
                color: '#ffffff',
                padding: '0.5rem',
                cursor: 'pointer'
              }}
            >
              {mobileMenuOpen ? <X size={24} /> : <Menu size={24} />}
            </button>
          )}
        </div>

        {/* Mobile/Tablet Menu */}
        {!responsive.isDesktop && mobileMenuOpen && (
          <div style={{
            background: 'rgba(0, 0, 0, 0.95)',
            backdropFilter: 'blur(24px)',
            borderTop: '1px solid rgba(255, 255, 255, 0.08)',
            padding: '1rem 2rem'
          }}>
            <div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
              <button
                onClick={() => {
                  setActivePage('introduction');
                  setMobileMenuOpen(false);
                }}
                style={{
                  background: activePage === 'introduction' ? 'rgba(237, 134, 49, 0.2)' : 'transparent',
                  color: activePage === 'introduction' ? '#ed8631' : '#a0a0a0',
                  border: 'none',
                  padding: '0.75rem 1rem',
                  borderRadius: '8px',
                  textAlign: 'left',
                  cursor: 'pointer',
                  fontSize: '0.95rem',
                  fontWeight: 500
                }}
              >
                Introduction
              </button>
              <button
                onClick={() => {
                  setActivePage('catalog-management');
                  setMobileMenuOpen(false);
                }}
                style={{
                  background: activePage === 'catalog-management' ? 'rgba(237, 134, 49, 0.2)' : 'transparent',
                  color: activePage === 'catalog-management' ? '#ed8631' : '#a0a0a0',
                  border: 'none',
                  padding: '0.75rem 1rem',
                  borderRadius: '8px',
                  textAlign: 'left',
                  cursor: 'pointer',
                  fontSize: '0.95rem',
                  fontWeight: 500
                }}
              >
                Catalog Management
              </button>
              <button
                onClick={() => {
                  setActivePage('troubleshooting');
                  setMobileMenuOpen(false);
                }}
                style={{
                  background: activePage === 'troubleshooting' ? 'rgba(237, 134, 49, 0.2)' : 'transparent',
                  color: activePage === 'troubleshooting' ? '#ed8631' : '#a0a0a0',
                  border: 'none',
                  padding: '0.75rem 1rem',
                  borderRadius: '8px',
                  textAlign: 'left',
                  cursor: 'pointer',
                  fontSize: '0.95rem',
                  fontWeight: 500
                }}
              >
                Troubleshooting
              </button>
              <button
                onClick={handleLogout}
                style={{
                  background: 'rgba(255, 107, 53, 0.15)',
                  color: '#ed8631',
                  border: '1px solid rgba(255, 107, 53, 0.3)',
                  padding: '0.75rem 1rem',
                  borderRadius: '8px',
                  textAlign: 'left',
                  cursor: 'pointer',
                  fontSize: '0.95rem',
                  fontWeight: 500
                }}
              >
                Logout
              </button>
            </div>
          </div>
        )}
      </nav>

      {/* Main Content */}
      <main style={{
        maxWidth: responsive.isMobile ? '100%' : '1400px',
        margin: '0 auto',
        padding: responsive.isMobile ? '1rem 1rem 60px 1rem' : '2rem 2rem 80px 2rem'
      }}>
        {activePage === 'introduction' && <IntroductionPage setActivePage={setActivePage} responsive={responsive} />}
        {activePage === 'catalog-management' && (
          <CatalogManagementPage
            formInputs={formInputs}
            updateInput={updateInput}
            activeLanguages={activeLanguages}
            setActiveLanguages={setActiveLanguages}
            getCodeExamples={getCodeExamples}
            copyToClipboard={copyToClipboard}
            copiedStates={copiedStates}
            testAPI={testAPI}
            testConsoles={testConsoles}
            responsive={responsive}
          />
        )}
      </main>

      {/* Footer */}
      <footer style={{
        background: 'rgba(255, 255, 255, 0.04)',
        backdropFilter: 'blur(20px)',
        borderTop: '1px solid rgba(255, 255, 255, 0.08)',
        padding: '3rem 0',
        marginTop: '4rem',
        textAlign: 'center'
      }}>
        <p style={{
          color: '#a0a0a0',
          fontSize: '0.875rem',
          margin: 0
        }}>
          BCGuardian Proprietary and Confidential. All Rights Reserved © 2025-2030
        </p>
      </footer>
    </div>
  );
}

// Introduction Page Component (unchanged)
function IntroductionPage({ setActivePage, responsive }) {
  return (
    <div style={{ display: 'block' }}>
      <section style={{
        padding: responsive.isMobile ? '2rem 0' : '3rem 0',
        textAlign: 'center'
      }}>
        <h1 style={{
          fontSize: responsive.isMobile ? '2rem' : '3rem',
          fontWeight: 700,
          letterSpacing: '-0.03em',
          marginBottom: '1rem',
          background: 'linear-gradient(135deg, #ffffff 0%, #ed8631 100%)',
          WebkitBackgroundClip: 'text',
          WebkitTextFillColor: 'transparent'
        }}>Reverb Catalog API Documentation</h1>
        <p style={{
          fontSize: '1.125rem',
          color: '#a0a0a0',
          maxWidth: '700px',
          margin: '0 auto 2rem'
        }}>
          Easily integrate and manage your catalog with Reverb to protect and recover lost revenue.
        </p>
      </section>

      <section style={{ marginBottom: '4rem' }}>
        <div style={{
          background: 'linear-gradient(135deg, rgba(237, 134, 49, 0.06), rgba(255, 107, 53, 0.03))',
          backdropFilter: 'blur(16px) saturate(150%)',
          WebkitBackdropFilter: 'blur(16px) saturate(150%)',
          border: '1px solid rgba(255, 107, 53, 0.12)',
          borderRadius: '16px',
          padding: responsive.isMobile ? '1.5rem' : '2.5rem',
          marginBottom: '2rem',
          boxShadow: '0 4px 15px rgba(255, 107, 53, 0.03), 0 0 80px rgba(237, 134, 49, 0.2)'
        }}>
          <h2 style={{
            fontSize: responsive.isMobile ? '1.5rem' : '2rem',
            fontWeight: 600,
            marginBottom: '1rem',
            color: '#ffffff'
          }}>Introduction</h2>
          
          <div style={{ marginBottom: '2rem' }}>
            <h3 style={{
              fontSize: '1.25rem',
              marginBottom: '1rem',
              color: '#ffffff'
            }}>How Reverb Works</h3>
            <p style={{
              color: '#a0a0a0',
              lineHeight: 1.8
            }}>
              Reverb enables you to recover lost licensing revenue in real time. It is BCGuardian's proprietary artificial intelligence and machine learning application 
              that detects, verifies, and monitors unauthorized use of your music on social media in real time.
            </p>
          </div>

          <div style={{
            background: 'rgba(0, 0, 0, 0.5)',
            borderRadius: '12px',
            padding: responsive.isMobile ? '1.5rem' : '2rem',
            border: '1px solid rgba(255, 255, 255, 0.08)',
            marginTop: '1.5rem'
          }}>
            <h3 style={{
              fontSize: '1.25rem',
              marginBottom: '1rem',
              color: '#ffffff'
            }}>Reverb's Technology:</h3>
            <p style={{
              color: '#a0a0a0',
              lineHeight: 1.8
            }}>
              Reverb's technology is a multi-step real-time proprietary workflow that blends state of the art technology and human expertise generally composed of these steps:
            </p>
            
            <div style={{
              display: 'flex',
              flexDirection: 'column',
              gap: '1.5rem',
              marginTop: '1.5rem'
            }}>
              {[
                { num: "1", title: "Post Collection", desc: "This is where we collect the posts from the different social media networks." },
                { num: "2", title: "Music Identification", desc: "This is where we split and identify the music inside the post. This also when we preserve the videos and the music." },
                { num: "3", title: "Catalog Matching", desc: "This is where we take the post with the identified music and match it to your catalog. Records are then pushed into Reverb, and they are available to you with an initial status." },
                { num: "4", title: "Human Verification", desc: "BCGuardian content review specialists (CRS) review the records and update the status. These statuses are pushed to Reverb app in real-time." },
                { num: "5", title: "Still/Image Preservation", desc: "For all BCGuardian-Verified posts, Reverb triggers image/still preservation, capturing engagement metrics, comments, etc." }
              ].map((step) => (
                <div key={step.num} style={{ display: 'flex', gap: '1rem' }}>
                  <div style={{
                    background: 'rgba(255, 255, 255, 0.04)',
                    backdropFilter: 'blur(10px)',
                    border: '1px solid rgba(255, 255, 255, 0.08)',
                    width: '32px',
                    height: '32px',
                    borderRadius: '50%',
                    display: 'flex',
                    alignItems: 'center',
                    justifyContent: 'center',
                    fontWeight: 600,
                    flexShrink: 0,
                    color: '#ed8631'
                  }}>{step.num}</div>
                  <div style={{ flex: 1 }}>
                    <strong style={{ color: '#ffffff' }}>{step.title}</strong>
                    <p style={{
                      color: '#a0a0a0',
                      marginTop: '0.25rem',
                      fontSize: '0.95rem'
                    }}>{step.desc}</p>
                  </div>
                </div>
              ))}
            </div>
          </div>

          <div style={{
            background: 'linear-gradient(135deg, rgba(237, 134, 49, 0.06), rgba(255, 107, 53, 0.03))',
            backdropFilter: 'blur(16px) saturate(150%)',
            WebkitBackdropFilter: 'blur(16px) saturate(150%)',
            border: '1px solid rgba(255, 107, 53, 0.12)',
            borderRadius: '16px',
            padding: responsive.isMobile ? '1.5rem' : '2.5rem',
            marginBottom: '2rem',
            boxShadow: '0 4px 15px rgba(255, 107, 53, 0.03), 0 0 80px rgba(237, 134, 49, 0.2)'
          }}>
            <h3 style={{
              fontSize: '1.25rem',
              marginBottom: '1rem',
              color: '#ffffff'
            }}>Why Your Catalog Matters</h3>
            <p style={{
              color: '#a0a0a0',
              lineHeight: 1.8
            }}>
              During the third phase of Reverb, collected posts are automatically matched against your catalog's assets. 
              A robust, up to date catalog helps Reverb identify more unauthorized use of your music, which can translate to more recovered licensing revenue. 
              This API was specifically built to allow your technical team to automatically integrate and maintain an up-to-date catalog, 
              eliminating the need for manual exports and emails.
            </p>
            <div style={{ textAlign: 'center', marginTop: '1.5rem' }}>
              <a href="https://reverb.bcguardian.com/" target="_blank" rel="noopener noreferrer" style={{
                display: 'inline-block',
                padding: '0.75rem 1.5rem',
                background: 'linear-gradient(135deg, #ed8631, rgba(255, 140, 66, 0.9))',
                color: 'white',
                border: 'none',
                borderRadius: '8px',
                fontWeight: 600,
                cursor: 'pointer',
                transition: 'all 0.3s',
                boxShadow: '0 4px 15px rgba(255, 107, 53, 0.3)',
                textDecoration: 'none',
                fontSize: '0.875rem'
              }}
              onMouseEnter={(e) => {
                if (!responsive.isMobile) {
                  e.target.style.transform = 'translateY(-2px)';
                  e.target.style.boxShadow = '0 6px 25px rgba(255, 107, 53, 0.5)';
                }
              }}
              onMouseLeave={(e) => {
                if (!responsive.isMobile) {
                  e.target.style.transform = 'translateY(0)';
                  e.target.style.boxShadow = '0 4px 15px rgba(255, 107, 53, 0.3)';
                }
              }}>
                Go to Reverb
              </a>
            </div>
          </div>

          <div style={{ textAlign: 'center', marginTop: '3rem' }}>
            <button onClick={() => setActivePage('catalog-management')} style={{
              display: 'inline-block',
              padding: '0.75rem 1.5rem',
              background: 'linear-gradient(135deg, #ed8631, rgba(255, 140, 66, 0.9))',
              color: 'white',
              border: 'none',
              borderRadius: '8px',
              fontWeight: 600,
              cursor: 'pointer',
              transition: 'all 0.3s',
              boxShadow: '0 4px 15px rgba(255, 107, 53, 0.3)',
              fontSize: '0.875rem'
            }}
            onMouseEnter={(e) => {
              if (!responsive.isMobile) {
                e.target.style.transform = 'translateY(-2px)';
                e.target.style.boxShadow = '0 6px 25px rgba(255, 107, 53, 0.5)';
              }
            }}
            onMouseLeave={(e) => {
              if (!responsive.isMobile) {
                e.target.style.transform = 'translateY(0)';
                e.target.style.boxShadow = '0 4px 15px rgba(255, 107, 53, 0.3)';
              }
            }}>
              Get Started with API Documentation →
            </button>
          </div>
        </div>
      </section>
    </div>
  );
}

// Catalog Management Page Component - Updated with all fields
function CatalogManagementPage({ 
  formInputs, 
  updateInput, 
  activeLanguages,
  setActiveLanguages,
  getCodeExamples,
  copyToClipboard,
  copiedStates,
  testAPI,
  testConsoles,
  responsive
}) {
  const setLanguage = (section, language) => {
    setActiveLanguages(prev => ({ ...prev, [section]: language }));
  };

  return (
    <div style={{ display: 'block' }}>
      <section style={{ marginBottom: '4rem' }}>
        <div style={{
          background: 'linear-gradient(135deg, rgba(237, 134, 49, 0.06), rgba(255, 107, 53, 0.03))',
          backdropFilter: 'blur(16px) saturate(150%)',
          WebkitBackdropFilter: 'blur(16px) saturate(150%)',
          border: '1px solid rgba(255, 107, 53, 0.12)',
          borderRadius: '16px',
          padding: responsive.isMobile ? '1.5rem' : '2.5rem',
          marginBottom: '2rem',
          boxShadow: '0 4px 15px rgba(255, 107, 53, 0.03), 0 0 80px rgba(237, 134, 49, 0.2)'
        }}>
          <h2 style={{
            fontSize: responsive.isMobile ? '1.5rem' : '2rem',
            fontWeight: 600,
            marginBottom: '1rem',
            color: '#ffffff'
          }}>Overview of Reverb Catalog Schema</h2>
          <p style={{
            color: '#a0a0a0',
            lineHeight: 1.8
          }}>
            At the moment, Reverb's third phase works exclusively with recording information, so your catalog must include the corresponding details. 
            If you are a publisher and do not have the necessary recording information, please contact us at{' '}
            <a href="mailto:reverbaccountsupport@bcguardian.com" style={{
              display: 'inline-block',
              padding: '0.15rem 0.3rem',
              background: 'linear-gradient(135deg, #ed8631, rgba(255, 140, 66, 0.9))',
              color: 'white',
              border: 'none',
              borderRadius: '6px',
              fontWeight: 600,
              cursor: 'pointer',
              transition: 'all 0.3s',
              boxShadow: '0 2px 8px rgba(255, 107, 53, 0.3)',
              textDecoration: 'none',
              fontSize: '0.8rem',
              margin: '0 2px'
            }}
            onMouseEnter={(e) => {
              if (!responsive.isMobile) {
                e.target.style.transform = 'translateY(-1px)';
                e.target.style.boxShadow = '0 4px 12px rgba(255, 107, 53, 0.5)';
              }
            }}
            onMouseLeave={(e) => {
              if (!responsive.isMobile) {
                e.target.style.transform = 'translateY(0)';
                e.target.style.boxShadow = '0 2px 8px rgba(255, 107, 53, 0.3)';
              }
            }}>
              reverbaccountsupport@bcguardian.com
            </a>.
          </p>
        </div>

        <div style={{
          background: 'linear-gradient(135deg, rgba(237, 134, 49, 0.06), rgba(255, 107, 53, 0.03))',
          backdropFilter: 'blur(16px) saturate(150%)',
          WebkitBackdropFilter: 'blur(16px) saturate(150%)',
          border: '1px solid rgba(255, 107, 53, 0.12)',
          borderRadius: '16px',
          padding: responsive.isMobile ? '1.5rem' : '2.5rem',
          marginBottom: '2rem',
          boxShadow: '0 4px 15px rgba(255, 107, 53, 0.03), 0 0 80px rgba(237, 134, 49, 0.2)'
        }}>
          <h3 style={{
            fontSize: '1.25rem',
            marginBottom: '1rem',
            color: '#ffffff'
          }}>Catalog Database Structure</h3>
          <p style={{
            color: '#a0a0a0',
            lineHeight: 1.8
          }}>Your catalog is stored in our backend structure. Each record represents a single song in your catalog.</p>
          
          <div style={{
            overflowX: 'auto',
            margin: responsive.isMobile ? '0.75rem 0' : '1.5rem 0'
          }}>
            <table style={{
              width: '100%',
              minWidth: responsive.isMobile ? '600px' : 'auto',
              borderCollapse: 'collapse',
              background: 'rgba(0, 0, 0, 0.4)',
              border: '1px solid rgba(255, 255, 255, 0.1)',
              fontFamily: "'SF Mono', monospace",
              fontSize: responsive.isMobile ? '0.8rem' : '0.9rem'
            }}>
              <thead>
                <tr>
                  <th colSpan="6" style={{
                    padding: '1rem',
                    textAlign: 'center',
                    color: '#ed8631',
                    fontWeight: 600,
                    letterSpacing: '0.05em',
                    textTransform: 'uppercase',
                    background: 'linear-gradient(135deg, rgba(237, 134, 49, 0.15), rgba(237, 134, 49, 0.05))',
                    borderBottom: '2px solid #ed8631'
                  }}>Table: reverb_catalog</th>
                </tr>
                <tr style={{ background: 'rgba(0, 0, 0, 0.5)' }}>
                  {['Column', 'Type', 'Constraint', 'Optional', 'Default', 'Description'].map(header => (
                    <th key={header} style={{
                      padding: '0.75rem',
                      textAlign: 'center',
                      color: '#ffffff',
                      border: '1px solid rgba(255, 255, 255, 0.1)',
                      fontWeight: 500
                    }}>{header}</th>
                  ))}
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80' }}>artist</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#fbbf24' }}>VARCHAR(255)</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>-</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ef4444', fontWeight: 600 }}>NO</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>-</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>Recording artist or band name</td>
                </tr>
                <tr>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80' }}>song_title</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#fbbf24' }}>VARCHAR(255)</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>-</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ef4444', fontWeight: 600 }}>NO</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>-</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>Recording track or song title</td>
                </tr>
                <tr style={{ background: 'rgba(237, 134, 49, 0.03)' }}>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80', fontWeight: 600 }}>isrc</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#fbbf24' }}>VARCHAR(12)</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ed8631', fontWeight: 600 }}>PRIMARY KEY</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ef4444', fontWeight: 600 }}>NO</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>-</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>Unique recording identifier (12 characters)</td>
                </tr>
                <tr>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80' }}>copyright_claimant</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#fbbf24' }}>VARCHAR(255)</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>-</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80' }}>YES</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>NULL</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>Copyright owner or publisher</td>
                </tr>
                <tr>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80' }}>copyright_date</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#fbbf24' }}>VARCHAR(255)</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>-</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80' }}>YES</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>NULL</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>Copyright registration date</td>
                </tr>
                <tr>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80' }}>copyright_registration_num</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#fbbf24' }}>VARCHAR(50)</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>-</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80' }}>YES</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>NULL</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>Official registration number</td>
                </tr>
                <tr style={{ background: 'rgba(237, 134, 49, 0.03)' }}>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80', fontWeight: 600 }}>api_id</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#fbbf24' }}>VARCHAR(100)</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#3b82f6', fontWeight: 600 }}>UNIQUE</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ef4444', fontWeight: 600 }}>NO</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80', fontStyle: 'italic' }}>AUTO</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>System-generated unique API identifier</td>
                </tr>
                <tr>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80' }}>date_updated_to_table_sql</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#fbbf24' }}>TIMESTAMP</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>-</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ef4444', fontWeight: 600 }}>NO</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#4ade80', fontStyle: 'italic' }}>CURRENT_TIMESTAMP</td>
                  <td style={{ padding: '0.75rem', border: '1px solid rgba(255, 255, 255, 0.05)', textAlign: 'center', color: '#ffffff' }}>Last modification timestamp</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </section>

      {/* API Endpoints */}
      <div id="search-section">
        <APIEndpoint
          title="Search & Retrieve Catalog"
          description="Search and retrieve songs from your catalog with powerful filtering options."
          method="GET"
          endpoint="/api/v1/reverb-catalog-access"
          methodColor="rgba(74, 222, 128, 0.15)"
          methodTextColor="#4ade80"
          section="search"
          formInputs={formInputs}
          updateInput={updateInput}
          activeLanguage={activeLanguages.search || 'curl'}
          setLanguage={setLanguage}
          getCodeExamples={getCodeExamples}
          copyToClipboard={copyToClipboard}
          copiedStates={copiedStates}
          testAPI={testAPI}
          testConsole={testConsoles['search-console']}
          responsive={responsive}
          fields={[
            { name: 'apiKey', label: 'API Key', type: 'text', placeholder: 'your-api-key-here' },
            { name: 'artist', label: 'Artist', type: 'text', placeholder: 'e.g., Sample Artist' },
            { name: 'song', label: 'Song Title', type: 'text', placeholder: 'e.g., Demo Track' },
            { name: 'isrc', label: 'ISRC', type: 'text', placeholder: 'e.g., XX0001234567' },
            { name: 'limit', label: 'Limit', type: 'number', placeholder: '10', min: 1, max: 1000 }
          ]}
        />
      </div>

      <div id="add-section">
        <APIEndpoint
          title="Add Records to Catalog"
          description="Add new songs to your catalog using JSON batch uploads. If ISRC already is in our dataset we will update the records based on the fields you provide."
          method="POST"
          endpoint="/api/v1/quick-batch"
          methodColor="rgba(59, 130, 246, 0.15)"
          methodTextColor="#3b82f6"
          section="add"
          formInputs={formInputs}
          updateInput={updateInput}
          activeLanguage={activeLanguages.add || 'curl'}
          setLanguage={setLanguage}
          getCodeExamples={getCodeExamples}
          copyToClipboard={copyToClipboard}
          copiedStates={copiedStates}
          testAPI={testAPI}
          testConsole={testConsoles['add-console']}
          responsive={responsive}
          fields={[
            { name: 'apiKey', label: 'API Key', type: 'text', placeholder: 'your-api-key-here' },
            { name: 'artist1', label: 'Artist', type: 'text', placeholder: 'e.g., Demo Artist' },
            { name: 'song1', label: 'Song Title', type: 'text', placeholder: 'e.g., Test Track One' },
            { name: 'isrc1', label: 'ISRC', type: 'text', placeholder: 'e.g., XX0001234567' },
            { name: 'copyright1', label: 'Copyright Claimant (optional)', type: 'text', placeholder: 'Copyright Claimant' },
            { name: 'copyrightDate1', label: 'Copyright Date (optional)', type: 'text', placeholder: 'e.g., 2024-01-15' },
            { name: 'copyrightReg1', label: 'Copyright Registration # (optional)', type: 'text', placeholder: 'REG2024001' }
          ]}
        />
      </div>

      <div id="csv-section">
        <CSVUploadSection
          formInputs={formInputs}
          updateInput={updateInput}
          activeLanguages={activeLanguages}
          setLanguage={setLanguage}
          getCodeExamples={getCodeExamples}
          copyToClipboard={copyToClipboard}
          copiedStates={copiedStates}
          testAPI={testAPI}
          testConsole={testConsoles['csv-console']}
          responsive={responsive}
        />
      </div>

      <div id="update-section">
        <APIEndpoint
          title="Update Records"
          description="Update existing catalog records using ISRC or API ID as the identifier."
          method="PATCH"
          endpoint="/api/v1/revise-reverb-catalog"
          methodColor="rgba(251, 191, 36, 0.15)"
          methodTextColor="#fbbf24"
          section="update"
          formInputs={formInputs}
          updateInput={updateInput}
          activeLanguage={activeLanguages.update || 'curl'}
          setLanguage={setLanguage}
          getCodeExamples={getCodeExamples}
          copyToClipboard={copyToClipboard}
          copiedStates={copiedStates}
          testAPI={testAPI}
          testConsole={testConsoles['update-console']}
          responsive={responsive}
          fields={[
            { name: 'apiKey', label: 'API Key', type: 'text', placeholder: 'your-api-key-here' },
            { name: 'isrc', label: 'ISRC to Update', type: 'text', placeholder: 'e.g., XX0001234567' },
            { name: 'song', label: 'New Song Title', type: 'text', placeholder: 'Updated Song Title' },
            { name: 'copyright', label: 'New Copyright', type: 'text', placeholder: 'New Publisher' }
          ]}
        />
      </div>

      <div id="troubleshooting-section">
        <TroubleshootingPage responsive={responsive} />
      </div>
    </div>
  );
}


// New CSV Upload Section Component
function CSVUploadSection({
  formInputs,
  updateInput,
  activeLanguages,
  setLanguage,
  getCodeExamples,
  copyToClipboard,
  copiedStates,
  testAPI,
  testConsole,
  responsive
}) {
  const languages = ['curl', 'javascript', 'python', 'java'];
  const examples = getCodeExamples('csv');
  const activeLanguage = activeLanguages.csv || 'curl';

  return (
    <section style={{ marginBottom: '4rem' }}>
      <div style={{
        background: 'linear-gradient(135deg, rgba(237, 134, 49, 0.06), rgba(255, 107, 53, 0.03))',
        backdropFilter: 'blur(16px) saturate(150%)',
        WebkitBackdropFilter: 'blur(16px) saturate(150%)',
        border: '1px solid rgba(255, 107, 53, 0.12)',
        borderRadius: '16px',
        padding: responsive.isMobile ? '1.5rem' : '2.5rem',
        marginBottom: '2rem',
        boxShadow: '0 4px 15px rgba(255, 107, 53, 0.03), 0 0 80px rgba(237, 134, 49, 0.2)'
      }}>
        <h2 style={{
          fontSize: responsive.isMobile ? '1.5rem' : '2rem',
          fontWeight: 600,
          marginBottom: '1rem',
          color: '#ffffff'
        }}>Bulk Upload via CSV</h2>
        <p style={{
          color: '#a0a0a0',
          marginBottom: '2rem',
          fontSize: '1rem'
        }}>
          Upload multiple catalog records at once using a CSV file. Supports batch processing of up to thousands of records with strict header validation. 
          If an ISRC already exists in our dataset, we will update the record based on the fields you provide.
        </p>

        <div style={{
          background: 'rgba(0, 0, 0, 0.5)',
          border: '1px solid rgba(255, 255, 255, 0.08)',
          borderRadius: '12px',
          marginBottom: '2rem',
          overflow: 'hidden'
        }}>
          {/* Endpoint Header */}
          <div style={{
            display: 'flex',
            alignItems: 'center',
            gap: '1rem',
            padding: responsive.isMobile ? '1rem' : '1.5rem',
            borderBottom: '1px solid rgba(255, 255, 255, 0.08)',
            flexWrap: 'wrap'
          }}>
            <span style={{
              padding: '0.5rem 1rem',
              borderRadius: '6px',
              fontWeight: 600,
              fontSize: '0.875rem',
              textTransform: 'uppercase',
              letterSpacing: '0.05em',
              background: 'rgba(59, 130, 246, 0.15)',
              color: '#3b82f6',
              border: '1px solid rgba(59, 130, 246, 0.3)'
            }}>POST</span>
            <span style={{
              fontFamily: "'SF Mono', monospace",
              color: '#ffffff',
              fontSize: responsive.isMobile ? '0.875rem' : '1rem',
              fontWeight: 500,
              wordBreak: 'break-all'
            }}>/api/v1/upload-csv</span>
          </div>

          {/* CSV Format Requirements */}
          <div style={{
            padding: responsive.isMobile ? '1rem' : '1.5rem',
            background: 'rgba(0, 0, 0, 0.3)',
            borderBottom: '1px solid rgba(255, 255, 255, 0.08)'
          }}>
            <h4 style={{ color: '#ed8631', marginBottom: '1rem' }}>CSV Format Requirements</h4>
            
            <div style={{ marginBottom: '1.5rem' }}>
              <p style={{ color: '#ffffff', marginBottom: '0.5rem', fontWeight: 600 }}>Required Headers (case-sensitive):</p>
              <code style={{
                background: 'rgba(237, 134, 49, 0.1)',
                padding: '0.5rem',
                borderRadius: '4px',
                display: 'inline-block',
                color: '#ed8631',
                fontFamily: "'SF Mono', monospace",
                fontSize: '0.875rem'
              }}>
                artist, song_title, isrc
              </code>
            </div>

            <div style={{ marginBottom: '1.5rem' }}>
              <p style={{ color: '#ffffff', marginBottom: '0.5rem', fontWeight: 600 }}>Optional Headers:</p>
              <code style={{
                background: 'rgba(59, 130, 246, 0.1)',
                padding: '0.5rem',
                borderRadius: '4px',
                display: 'inline-block',
                color: '#3b82f6',
                fontFamily: "'SF Mono', monospace",
                fontSize: '0.875rem'
              }}>
                copyright_claimant, copyright_date, copyright_registration_num
              </code>
            </div>

            <div style={{
              background: 'rgba(239, 68, 68, 0.1)',
              border: '1px solid rgba(239, 68, 68, 0.3)',
              padding: '1rem',
              borderRadius: '4px'
            }}>
              <p style={{ color: '#ef4444', fontWeight: 600, marginBottom: '0.5rem' }}>Strict Requirements:</p>
              <ul style={{ color: '#a0a0a0', marginLeft: '1.5rem', fontSize: '0.9rem' }}>
                <li>Headers must match exactly (case-sensitive)</li>
                <li>Use underscores, not spaces: <code style={{ color: '#fbbf24' }}>song_title</code> not <code style={{ color: '#ef4444', textDecoration: 'line-through' }}>song title</code></li>
                <li>No variations accepted: <code style={{ color: '#fbbf24' }}>artist</code> not <code style={{ color: '#ef4444', textDecoration: 'line-through' }}>Artist</code> or <code style={{ color: '#ef4444', textDecoration: 'line-through' }}>artist_name</code></li>
                <li>All required fields must have non-empty values</li>
                <li>Maximum file size: 50MB</li>
                <li>Supported delimiters: comma (,) or tab (\t)</li>
              </ul>
            </div>
          </div>

          {/* Example CSV Format */}
          <div style={{
            padding: responsive.isMobile ? '1rem' : '1.5rem',
            background: 'rgba(0, 0, 0, 0.3)',
            borderBottom: '1px solid rgba(255, 255, 255, 0.08)'
          }}>
            <h4 style={{ color: '#ed8631', marginBottom: '1rem' }}>Example CSV Format</h4>
            <pre style={{
              background: 'rgba(0, 0, 0, 0.6)',
              padding: '1rem',
              borderRadius: '4px',
              color: '#10b981',
              fontFamily: "'SF Mono', monospace",
              fontSize: responsive.isMobile ? '0.75rem' : '0.875rem',
              overflowX: 'auto',
              margin: 0
            }}>
{`artist,song_title,isrc,copyright_claimant,copyright_date,copyright_registration_num
Demo Artist,Test Track One,TEST12345001,Demo Publishing LLC,2024-01-15,REG2024001
Sample Band,Example Song,TEST12345002,Sample Music Group,2024-02-20,REG2024002
Studio Crew,Digital Dreams,TEST12345003,Studio Records Inc,2024-03-10,REG2024003
Echo Chamber,Midnight Run,TEST12345004,Echo Productions,2024-04-05,`}
            </pre>
          </div>

          {/* API Key Input */}
          <div style={{
            padding: responsive.isMobile ? '1rem' : '1.5rem',
            background: 'rgba(0, 0, 0, 0.3)',
            borderBottom: '1px solid rgba(255, 255, 255, 0.08)'
          }}>
            <h4 style={{ marginBottom: '1rem', color: '#ed8631' }}>Configure Parameters</h4>
            <div style={{
              display: 'grid',
              gridTemplateColumns: responsive.isMobile ? '1fr' : '150px 1fr',
              gap: '1rem',
              alignItems: 'center'
            }}>
              <label style={{ color: '#a0a0a0', fontSize: responsive.isMobile ? '0.875rem' : '1rem' }}>API Key:</label>
              <input
                type="text"
                placeholder="your-api-key-here"
                value={formInputs.csv?.apiKey || ''}
                onChange={(e) => updateInput('csv', 'apiKey', e.target.value)}
                style={{
                  padding: '0.5rem',
                  background: 'rgba(0,0,0,0.3)',
                  border: '1px solid rgba(255, 255, 255, 0.08)',
                  borderRadius: '4px',
                  color: '#ffffff',
                  fontSize: '16px'
                }}
              />
            </div>
          </div>

          {/* Code Examples */}
          <div>
            <div style={{
              display: 'flex',
              gap: '0.5rem',
              padding: responsive.isMobile ? '0 1rem' : '0 1.5rem',
              borderBottom: '1px solid rgba(255, 255, 255, 0.08)',
              overflowX: 'auto'
            }}>
              {languages.map((lang) => (
                <button
                  key={lang}
                  style={{
                    padding: '0.75rem 1.25rem',
                    background: 'transparent',
                    border: 'none',
                    color: activeLanguage === lang ? '#ed8631' : '#a0a0a0',
                    cursor: 'pointer',
                    fontWeight: 500,
                    fontSize: '0.9rem',
                    transition: 'all 0.2s',
                    borderBottom: activeLanguage === lang ? '2px solid #ed8631' : '2px solid transparent',
                    marginBottom: '-1px',
                    whiteSpace: 'nowrap'
                  }}
                  onClick={() => setLanguage('csv', lang)}
                  onMouseEnter={(e) => {
                    if (activeLanguage !== lang && !responsive.isMobile) e.target.style.color = '#ffffff';
                  }}
                  onMouseLeave={(e) => {
                    if (activeLanguage !== lang && !responsive.isMobile) e.target.style.color = '#a0a0a0';
                  }}
                >
                  {lang === 'curl' ? 'cURL' : lang === 'java' ? 'Java' : lang.charAt(0).toUpperCase() + lang.slice(1)}
                </button>
              ))}
            </div>

            <div style={{ padding: responsive.isMobile ? '1rem' : '1.5rem' }}>
              <div style={{
                background: 'rgba(0, 0, 0, 0.6)',
                border: '1px solid rgba(255, 255, 255, 0.08)',
                borderRadius: '8px',
                overflow: 'hidden'
              }}>
                <div style={{
                  display: 'flex',
                  justifyContent: 'space-between',
                  alignItems: 'center',
                  padding: '0.75rem 1rem',
                  background: 'rgba(0, 0, 0, 0.4)',
                  borderBottom: '1px solid rgba(255, 255, 255, 0.08)',
                  flexWrap: 'wrap',
                  gap: '0.5rem'
                }}>
                  <span style={{
                    color: '#a0a0a0',
                    fontSize: '0.875rem',
                    fontWeight: 500
                  }}>
                    {activeLanguage === 'curl' ? 'cURL' : activeLanguage === 'java' ? 'Java' : activeLanguage.charAt(0).toUpperCase() + activeLanguage.slice(1)} Request
                  </span>
                  <div style={{ display: 'flex', gap: '0.5rem' }}>
                    <button
                      onClick={() => copyToClipboard(examples[activeLanguage], `csv-${activeLanguage}`)}
                      style={{
                        padding: '0.375rem 0.75rem',
                        background: 'transparent',
                        border: '1px solid rgba(255, 255, 255, 0.08)',
                        color: '#a0a0a0',
                        borderRadius: '6px',
                        fontSize: '0.75rem',
                        cursor: 'pointer',
                        transition: 'all 0.2s',
                        textTransform: 'uppercase',
                        letterSpacing: '0.05em',
                        fontWeight: 500,
                        display: 'flex',
                        alignItems: 'center',
                        gap: '0.25rem'
                      }}
                      onMouseEnter={(e) => {
                        if (!responsive.isMobile) {
                          e.target.style.background = '#ed8631';
                          e.target.style.color = 'white';
                          e.target.style.borderColor = '#ed8631';
                        }
                      }}
                      onMouseLeave={(e) => {
                        if (!responsive.isMobile) {
                          e.target.style.background = 'transparent';
                          e.target.style.color = '#a0a0a0';
                          e.target.style.borderColor = 'rgba(255, 255, 255, 0.08)';
                        }
                      }}
                    >
                      {copiedStates[`csv-${activeLanguage}`] ? <Check size={14} /> : <Copy size={14} />}
                      {copiedStates[`csv-${activeLanguage}`] ? ' Copied' : ' Copy'}
                    </button>
                    <button
                      onClick={() => testAPI('csv')}
                      style={{
                        padding: '0.375rem 0.75rem',
                        background: '#ed8631',
                        color: 'white',
                        border: '1px solid #ed8631',
                        borderRadius: '6px',
                        fontSize: '0.75rem',
                        cursor: 'pointer',
                        transition: 'all 0.2s',
                        textTransform: 'uppercase',
                        letterSpacing: '0.05em',
                        fontWeight: 500,
                        display: 'flex',
                        alignItems: 'center',
                        gap: '0.25rem'
                      }}
                      onMouseEnter={(e) => {
                        if (!responsive.isMobile) {
                          e.target.style.background = '#ff8c42';
                        }
                      }}
                      onMouseLeave={(e) => {
                        if (!responsive.isMobile) {
                          e.target.style.background = '#ed8631';
                        }
                      }}
                    >
                      <Play size={14} /> Test Info
                    </button>
                  </div>
                </div>
                <pre style={{
                  margin: 0,
                  padding: responsive.isMobile ? '1rem' : '1.5rem',
                  overflowX: 'auto'
                }}>
                  <code style={{
                    fontFamily: "'SF Mono', 'Monaco', 'Inconsolata', monospace",
                    fontSize: responsive.isMobile ? '0.8rem' : '0.875rem',
                    lineHeight: 1.6,
                    color: '#ffffff',
                    whiteSpace: 'pre'
                  }}>{examples[activeLanguage]}</code>
                </pre>
              </div>
            </div>
          </div>

          {/* Response Format Examples */}
          <div style={{ padding: responsive.isMobile ? '1rem' : '1.5rem' }}>
            <div style={{
              background: 'rgba(16, 185, 129, 0.05)',
              border: '1px solid rgba(16, 185, 129, 0.2)',
              padding: '1.5rem',
              borderRadius: '8px',
              marginBottom: '1rem'
            }}>
              <h5 style={{ color: '#10b981', marginBottom: '1rem' }}>Success Response Format</h5>
              <pre style={{
                background: 'rgba(0, 0, 0, 0.4)',
                padding: '1rem',
                borderRadius: '4px',
                overflowX: 'auto',
                margin: 0
              }}>
                <code style={{
                  color: '#ffffff',
                  fontSize: '0.875rem',
                  fontFamily: "'SF Mono', monospace"
                }}>{`{
  "success": true,
  "message": "CSV processed successfully with strict validation",
  "validation_summary": {
    "strict_mode": true,
    "required_headers_validated": true,
    "exact_match_enforced": true,
    "case_sensitive": true
  },
  "results": {
    "total_processed": 150,
    "added": 120,
    "updated": 30,
    "failed": 0,
    "parse_errors": 0
  },
  "header_analysis": {
    "required_found": ["artist", "song_title", "isrc"],
    "optional_found": ["copyright_claimant"],
    "delimiter_used": ","
  },
  "processing_time": "245ms"
}`}</code>
              </pre>
            </div>

            <div style={{
              background: 'rgba(239, 68, 68, 0.05)',
              border: '1px solid rgba(239, 68, 68, 0.2)',
              padding: '1.5rem',
              borderRadius: '8px'
            }}>
              <h5 style={{ color: '#ef4444', marginBottom: '1rem' }}>Error Response Format</h5>
              <pre style={{
                background: 'rgba(0, 0, 0, 0.4)',
                padding: '1rem',
                borderRadius: '4px',
                overflowX: 'auto',
                margin: 0
              }}>
                <code style={{
                  color: '#ffffff',
                  fontSize: '0.875rem',
                  fontFamily: "'SF Mono', monospace"
                }}>{`{
  "success": false,
  "error": "Missing Required Headers",
  "message": "CSV is missing required column headers",
  "validation_details": {
    "required_headers": ["artist", "song_title", "isrc"],
    "missing_headers": ["isrc"],
    "found_headers": ["artist", "title"],
    "header_count": 2
  },
  "common_mistakes": [
    "Found 'title' - should be 'song_title'",
    "Using 'ISRC' instead of 'isrc'"
  ],
  "correct_example": "artist,song_title,isrc,copyright_claimant"
}`}</code>
              </pre>
            </div>
          </div>

          {/* Test Console */}
          {testConsole && (
            <div style={{
              margin: responsive.isMobile ? '1rem' : '1.5rem',
              padding: '1rem',
              background: 'rgba(0, 0, 0, 0.8)',
              border: '1px solid rgba(255, 255, 255, 0.08)',
              borderRadius: '8px'
            }}>
              <h4 style={{
                color: '#ed8631',
                marginBottom: '0.5rem'
              }}>API Response</h4>
              <pre style={{
                background: 'rgba(0, 0, 0, 0.3)',
                padding: '1rem',
                borderRadius: '4px',
                color: testConsole.error ? '#ef4444' : '#10b981',
                maxHeight: '300px',
                overflowY: 'auto',
                fontFamily: "'SF Mono', monospace",
                fontSize: responsive.isMobile ? '0.8rem' : '0.875rem',
                whiteSpace: 'pre-wrap',
                wordBreak: 'break-all',
                margin: 0
              }}>
                {testConsole.loading && 'Loading endpoint information...'}
                {testConsole.error && `Error: ${testConsole.error}`}
                {testConsole.data && (
                  <>
                    {`Response Status: ${testConsole.data.status} ${testConsole.data.statusText}\n\n`}
                    {JSON.stringify(testConsole.data.response, null, 2)}
                  </>
                )}
              </pre>
            </div>
          )}
        </div>
      </div>
    </section>
  );
}

// Troubleshooting Page Component (New)
function TroubleshootingPage({ responsive }) {
  return (
    <div style={{ display: 'block' }}>
      <section style={{ marginBottom: '4rem' }}>
        <div style={{
          background: 'linear-gradient(135deg, rgba(237, 134, 49, 0.06), rgba(255, 107, 53, 0.03))',
          backdropFilter: 'blur(16px) saturate(150%)',
          WebkitBackdropFilter: 'blur(16px) saturate(150%)',
          border: '1px solid rgba(255, 107, 53, 0.12)',
          borderRadius: '16px',
          padding: responsive.isMobile ? '1.5rem' : '2.5rem',
          marginBottom: '2rem',
          boxShadow: '0 4px 15px rgba(255, 107, 53, 0.03), 0 0 80px rgba(237, 134, 49, 0.2)'
        }}>
          <h2 style={{
            fontSize: responsive.isMobile ? '1.5rem' : '2rem',
            fontWeight: 600,
            marginBottom: '1rem',
            color: '#ffffff'
          }}>Troubleshooting & FAQ</h2>
          <p style={{
            color: '#a0a0a0',
            marginBottom: '2rem',
            fontSize: '1rem'
          }}>
            Common error codes, their meanings, and frequently asked questions.
          </p>

          <div style={{
            background: 'rgba(0, 0, 0, 0.5)',
            borderRadius: '12px',
            // Continuing from TroubleshootingPage...
            padding: responsive.isMobile ? '1.5rem' : '2rem',
            border: '1px solid rgba(255, 255, 255, 0.08)',
            marginBottom: '2rem'
          }}>
            <h3 style={{
              fontSize: '1.25rem',
              marginBottom: '1.5rem',
              color: '#ffffff'
            }}>Error Code Reference</h3>
            
            <div style={{
              display: 'flex',
              flexDirection: 'column',
              gap: '1.5rem'
            }}>
              {/* 400 Bad Request */}
              <div style={{ borderLeft: '3px solid #fbbf24', paddingLeft: '1.5rem' }}>
                <div style={{
                  display: 'flex',
                  justifyContent: 'space-between',
                  alignItems: 'start',
                  marginBottom: '0.5rem',
                  flexWrap: 'wrap',
                  gap: '0.5rem'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '1.1rem' }}>400 Bad Request</strong>
                  <span style={{
                    background: 'rgba(251, 191, 36, 0.15)',
                    color: '#fbbf24',
                    padding: '0.25rem 0.75rem',
                    borderRadius: '4px',
                    fontSize: '0.875rem',
                    fontWeight: 600
                  }}>CLIENT ERROR</span>
                </div>
                <p style={{ color: '#a0a0a0', marginBottom: '0.75rem' }}>
                  The request contains invalid syntax or missing required parameters.
                </p>
                <div style={{
                  background: 'rgba(255, 255, 255, 0.04)',
                  padding: '1rem',
                  borderRadius: '6px'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '0.9rem' }}>Solution:</strong>
                  <p style={{
                    color: '#a0a0a0',
                    margin: '0.5rem 0 0 0',
                    fontSize: '0.9rem'
                  }}>
                    Review the request body and ensure all required fields are present with correct data types.
                  </p>
                </div>
              </div>

              {/* 401 Unauthorized */}
              <div style={{ borderLeft: '3px solid #ef4444', paddingLeft: '1.5rem' }}>
                <div style={{
                  display: 'flex',
                  justifyContent: 'space-between',
                  alignItems: 'start',
                  marginBottom: '0.5rem',
                  flexWrap: 'wrap',
                  gap: '0.5rem'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '1.1rem' }}>401 Unauthorized</strong>
                  <span style={{
                    background: 'rgba(239, 68, 68, 0.15)',
                    color: '#ef4444',
                    padding: '0.25rem 0.75rem',
                    borderRadius: '4px',
                    fontSize: '0.875rem',
                    fontWeight: 600
                  }}>AUTH ERROR</span>
                </div>
                <p style={{ color: '#a0a0a0', marginBottom: '0.75rem' }}>
                  Authentication is required but was not provided or is invalid.
                </p>
                <div style={{
                  background: 'rgba(255, 255, 255, 0.04)',
                  padding: '1rem',
                  borderRadius: '6px'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '0.9rem' }}>Solution:</strong>
                  <p style={{
                    color: '#a0a0a0',
                    margin: '0.5rem 0 0 0',
                    fontSize: '0.9rem'
                  }}>
                    Ensure the X-API-Key header is included with your valid API key.
                  </p>
                </div>
              </div>

              {/* 404 Not Found */}
              <div style={{ borderLeft: '3px solid #a0a0a0', paddingLeft: '1.5rem' }}>
                <div style={{
                  display: 'flex',
                  justifyContent: 'space-between',
                  alignItems: 'start',
                  marginBottom: '0.5rem',
                  flexWrap: 'wrap',
                  gap: '0.5rem'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '1.1rem' }}>404 Not Found</strong>
                  <span style={{
                    background: 'rgba(255, 255, 255, 0.04)',
                    color: '#a0a0a0',
                    padding: '0.25rem 0.75rem',
                    borderRadius: '4px',
                    fontSize: '0.875rem',
                    fontWeight: 600
                  }}>NOT FOUND</span>
                </div>
                <p style={{ color: '#a0a0a0', marginBottom: '0.75rem' }}>
                  The requested endpoint or resource does not exist.
                </p>
                <div style={{
                  background: 'rgba(255, 255, 255, 0.04)',
                  padding: '1rem',
                  borderRadius: '6px'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '0.9rem' }}>Solution:</strong>
                  <p style={{
                    color: '#a0a0a0',
                    margin: '0.5rem 0 0 0',
                    fontSize: '0.9rem'
                  }}>
                    Verify the endpoint URL matches documentation. All endpoints start with{' '}
                    <code style={{ color: '#ed8631' }}>/api/v1/</code>
                  </p>
                </div>
              </div>

              {/* 429 Rate Limit */}
              <div style={{ borderLeft: '3px solid #3b82f6', paddingLeft: '1.5rem' }}>
                <div style={{
                  display: 'flex',
                  justifyContent: 'space-between',
                  alignItems: 'start',
                  marginBottom: '0.5rem',
                  flexWrap: 'wrap',
                  gap: '0.5rem'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '1.1rem' }}>429 Too Many Requests</strong>
                  <span style={{
                    background: 'rgba(59, 130, 246, 0.15)',
                    color: '#3b82f6',
                    padding: '0.25rem 0.75rem',
                    borderRadius: '4px',
                    fontSize: '0.875rem',
                    fontWeight: 600
                  }}>RATE LIMIT</span>
                </div>
                <p style={{ color: '#a0a0a0', marginBottom: '0.75rem' }}>
                  Request rate limit exceeded. Default: 100 requests per minute per API-key.
                </p>
                <div style={{
                  background: 'rgba(255, 255, 255, 0.04)',
                  padding: '1rem',
                  borderRadius: '6px'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '0.9rem' }}>Solution:</strong>
                  <p style={{
                    color: '#a0a0a0',
                    margin: '0.5rem 0 0 0',
                    fontSize: '0.9rem'
                  }}>
                    Implement request throttling. Check{' '}
                    <code style={{ color: '#ed8631' }}>X-Rate-Limit-Remaining</code> header.
                  </p>
                </div>
              </div>

              {/* 500 Internal Server Error */}
              <div style={{ borderLeft: '3px solid #ef4444', paddingLeft: '1.5rem' }}>
                <div style={{
                  display: 'flex',
                  justifyContent: 'space-between',
                  alignItems: 'start',
                  marginBottom: '0.5rem',
                  flexWrap: 'wrap',
                  gap: '0.5rem'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '1.1rem' }}>500 Internal Server Error</strong>
                  <span style={{
                    background: 'rgba(239, 68, 68, 0.15)',
                    color: '#ef4444',
                    padding: '0.25rem 0.75rem',
                    borderRadius: '4px',
                    fontSize: '0.875rem',
                    fontWeight: 600
                  }}>SERVER ERROR</span>
                </div>
                <p style={{ color: '#a0a0a0', marginBottom: '0.75rem' }}>
                  An unexpected error occurred on the server.
                </p>
                <div style={{
                  background: 'rgba(255, 255, 255, 0.04)',
                  padding: '1rem',
                  borderRadius: '6px'
                }}>
                  <strong style={{ color: '#ffffff', fontSize: '0.9rem' }}>Solution:</strong>
                  <p style={{
                    color: '#a0a0a0',
                    margin: '0.5rem 0 0 0',
                    fontSize: '0.9rem'
                  }}>
                    Retry the request after a brief delay. If persistent, contact support.
                  </p>
                </div>
              </div>
            </div>
          </div>

          {/* FAQ Section */}
          <h3 style={{
            fontSize: '1.25rem',
            margin: '2rem 0 1rem 0',
            color: '#ffffff'
          }}>Frequently Asked Questions</h3>
          
          <div style={{
            display: 'flex',
            flexDirection: 'column',
            gap: '1.5rem'
          }}>
            <div style={{
              background: 'rgba(0, 0, 0, 0.5)',
              borderRadius: '8px',
              padding: '1.5rem',
              border: '1px solid rgba(255, 255, 255, 0.08)'
            }}>
              <h3 style={{
                color: '#ed8631',
                fontSize: '1.1rem',
                marginBottom: '0.5rem'
              }}>How do I handle duplicate ISRCs?</h3>
              <p style={{
                color: '#a0a0a0',
                lineHeight: 1.6
              }}>
                The system uses ISRC as a unique identifier. When you POST a record with an existing ISRC, 
                it will update the existing record rather than create a duplicate. Use the PATCH endpoint for explicit updates.
              </p>
            </div>

            <div style={{
              background: 'rgba(0, 0, 0, 0.5)',
              borderRadius: '8px',
              padding: '1.5rem',
              border: '1px solid rgba(255, 255, 255, 0.08)'
            }}>
              <h3 style={{
                color: '#ed8631',
                fontSize: '1.1rem',
                marginBottom: '0.5rem'
              }}>What is the maximum batch size for CSV uploads?</h3>
              <p style={{
                color: '#a0a0a0',
                lineHeight: 1.6
              }}>
                CSV uploads support up to 50MB file size. For optimal performance, we recommend batches of 5,000-10,000 records. 
                Larger catalogs should be split into multiple uploads.
              </p>
            </div>

            <div style={{
              background: 'rgba(0, 0, 0, 0.5)',
              borderRadius: '8px',
              padding: '1.5rem',
              border: '1px solid rgba(255, 255, 255, 0.08)'
            }}>
              <h3 style={{
                color: '#ed8631',
                fontSize: '1.1rem',
                marginBottom: '0.5rem'
              }}>How often should I synchronize my catalog?</h3>
              <p style={{
                color: '#a0a0a0',
                lineHeight: 1.6
              }}>
                We recommend daily or weekly synchronization depending on your catalog update frequency. 
                Implement incremental updates for changed records rather than full catalog replacements.
              </p>
            </div>

            <div style={{
              background: 'rgba(0, 0, 0, 0.5)',
              borderRadius: '8px',
              padding: '1.5rem',
              border: '1px solid rgba(255, 255, 255, 0.08)'
            }}>
              <h3 style={{
                color: '#ed8631',
                fontSize: '1.1rem',
                marginBottom: '0.5rem'
              }}>What happens if my API key is compromised?</h3>
              <p style={{
                color: '#a0a0a0',
                lineHeight: 1.6
              }}>
                Contact support immediately at{' '}
                <a href="mailto:reverbtechsupport@bcguardian.com" style={{
                  color: '#ed8631',
                  textDecoration: 'none'
                }}>reverbtechsupport@bcguardian.com</a>{' '}
                to revoke the compromised key and issue a replacement.
              </p>
            </div>
          </div>

          {/* Contact Support */}
          <div style={{
            background: 'rgba(255, 107, 53, 0.05)',
            border: '1px solid rgba(255, 107, 53, 0.2)',
            borderRadius: '8px',
            padding: '1.5rem',
            textAlign: 'center',
            marginTop: '2rem'
          }}>
            <h3 style={{
              color: '#ffffff',
              marginBottom: '0.5rem'
            }}>Need Additional Help?</h3>
            <p style={{
              color: '#a0a0a0',
              marginBottom: '1rem'
            }}>
              Our technical support team is available to assist with API integration issues.
            </p>
            <a href="mailto:reverbtechsupport@bcguardian.com" style={{
              display: 'inline-block',
              padding: '0.75rem 1.5rem',
              background: '#ed8631',
              color: 'white',
              textDecoration: 'none',
              borderRadius: '6px',
              fontWeight: 500,
              transition: 'all 0.3s'
            }}
            onMouseEnter={(e) => {
              if (!responsive.isMobile) {
                e.target.style.background = '#ff8c42';
                e.target.style.transform = 'translateY(-2px)';
              }
            }}
            onMouseLeave={(e) => {
              if (!responsive.isMobile) {
                e.target.style.background = '#ed8631';
                e.target.style.transform = 'translateY(0)';
              }
            }}>
              Contact Support
            </a>
          </div>
        </div>
      </section>
    </div>
  );
}

// API Endpoint Component (with Java support)
function APIEndpoint({
  title,
  description,
  method,
  endpoint,
  methodColor,
  methodTextColor,
  section,
  formInputs,
  updateInput,
  activeLanguage,
  setLanguage,
  getCodeExamples,
  copyToClipboard,
  copiedStates,
  testAPI,
  testConsole,
  responsive,
  fields
}) {
  const languages = ['curl', 'javascript', 'python', 'java'];
  const examples = getCodeExamples(section);

  return (
    <section style={{ marginBottom: '4rem' }}>
      <div style={{
        background: 'linear-gradient(135deg, rgba(237, 134, 49, 0.06), rgba(255, 107, 53, 0.03))',
        backdropFilter: 'blur(16px) saturate(150%)',
        WebkitBackdropFilter: 'blur(16px) saturate(150%)',
        border: '1px solid rgba(255, 107, 53, 0.12)',
        borderRadius: '16px',
        padding: responsive.isMobile ? '1.5rem' : '2.5rem',
        marginBottom: '2rem',
        boxShadow: '0 4px 15px rgba(255, 107, 53, 0.03), 0 0 80px rgba(237, 134, 49, 0.2)'
      }}>
        <h2 style={{
          fontSize: responsive.isMobile ? '1.5rem' : '2rem',
          fontWeight: 600,
          marginBottom: '1rem',
          color: '#ffffff'
        }}>{title}</h2>
        <p style={{
          color: '#a0a0a0',
          marginBottom: '2rem',
          fontSize: '1rem'
        }}>{description}</p>

        <div style={{
          background: 'rgba(0, 0, 0, 0.5)',
          border: '1px solid rgba(255, 255, 255, 0.08)',
          borderRadius: '12px',
          marginBottom: '2rem',
          overflow: 'hidden'
        }}>
          {/* Endpoint Header */}
          <div style={{
            display: 'flex',
            alignItems: 'center',
            gap: '1rem',
            padding: responsive.isMobile ? '1rem' : '1.5rem',
            borderBottom: '1px solid rgba(255, 255, 255, 0.08)',
            flexWrap: 'wrap'
          }}>
            <span style={{
              padding: '0.5rem 1rem',
              borderRadius: '6px',
              fontWeight: 600,
              fontSize: '0.875rem',
              textTransform: 'uppercase',
              letterSpacing: '0.05em',
              background: methodColor,
              color: methodTextColor,
              border: `1px solid ${methodTextColor}33`
            }}>{method}</span>
            <span style={{
              fontFamily: "'SF Mono', monospace",
              color: '#ffffff',
              fontSize: responsive.isMobile ? '0.875rem' : '1rem',
              fontWeight: 500,
              wordBreak: 'break-all'
            }}>{endpoint}</span>
          </div>

          {/* Parameters Form */}
          <div style={{
            background: 'rgba(0, 0, 0, 0.3)',
            padding: responsive.isMobile ? '1rem' : '1.5rem',
            borderBottom: '1px solid rgba(255, 255, 255, 0.08)'
          }}>
            <h4 style={{
              marginBottom: '1rem',
              color: '#ed8631'
            }}>Configure Parameters</h4>
            <div style={{
              display: 'grid',
              gap: '1rem'
            }}>
              {fields.map((field) => (
                <div key={field.name} style={{
                  display: 'grid',
                  gridTemplateColumns: responsive.isMobile ? '1fr' : '200px 1fr',
                  gap: '1rem',
                  alignItems: 'center'
                }}>
                  <label style={{ color: '#a0a0a0', fontSize: responsive.isMobile ? '0.875rem' : '1rem' }}>{field.label}:</label>
                  <input
                    type={field.type}
                    placeholder={field.placeholder}
                    value={formInputs[section]?.[field.name] || ''}
                    onChange={(e) => updateInput(section, field.name, e.target.value)}
                    min={field.min}
                    max={field.max}
                    style={{
                      padding: '0.5rem',
                      background: 'rgba(0,0,0,0.3)',
                      border: '1px solid rgba(255, 255, 255, 0.08)',
                      borderRadius: '4px',
                      color: '#ffffff',
                      fontSize: '16px'
                    }}
                  />
                </div>
              ))}
            </div>
          </div>

          {/* Code Examples */}
          <div>
            <div style={{
              display: 'flex',
              gap: '0.5rem',
              padding: responsive.isMobile ? '0 1rem' : '0 1.5rem',
              borderBottom: '1px solid rgba(255, 255, 255, 0.08)',
              overflowX: 'auto'
            }}>
              {languages.map((lang) => (
                <button
                  key={lang}
                  style={{
                    padding: '0.75rem 1.25rem',
                    background: 'transparent',
                    border: 'none',
                    color: activeLanguage === lang ? '#ed8631' : '#a0a0a0',
                    cursor: 'pointer',
                    fontWeight: 500,
                    fontSize: '0.9rem',
                    transition: 'all 0.2s',
                    borderBottom: activeLanguage === lang ? '2px solid #ed8631' : '2px solid transparent',
                    marginBottom: '-1px',
                    whiteSpace: 'nowrap'
                  }}
                  onClick={() => setLanguage(section, lang)}
                  onMouseEnter={(e) => {
                    if (activeLanguage !== lang && !responsive.isMobile) e.target.style.color = '#ffffff';
                  }}
                  onMouseLeave={(e) => {
                    if (activeLanguage !== lang && !responsive.isMobile) e.target.style.color = '#a0a0a0';
                  }}
                >
                  {lang === 'curl' ? 'cURL' : lang === 'java' ? 'Java' : lang.charAt(0).toUpperCase() + lang.slice(1)}
                </button>
              ))}
            </div>

            <div style={{ padding: responsive.isMobile ? '1rem' : '1.5rem' }}>
              <div style={{
                background: 'rgba(0, 0, 0, 0.6)',
                border: '1px solid rgba(255, 255, 255, 0.08)',
                borderRadius: '8px',
                overflow: 'hidden'
              }}>
                <div style={{
                  display: 'flex',
                  justifyContent: 'space-between',
                  alignItems: 'center',
                  padding: '0.75rem 1rem',
                  background: 'rgba(0, 0, 0, 0.4)',
                  borderBottom: '1px solid rgba(255, 255, 255, 0.08)',
                  flexWrap: 'wrap',
                  gap: '0.5rem'
                }}>
                  <span style={{
                    color: '#a0a0a0',
                    fontSize: '0.875rem',
                    fontWeight: 500
                  }}>
                    {activeLanguage === 'curl' ? 'cURL' : activeLanguage === 'java' ? 'Java' : activeLanguage.charAt(0).toUpperCase() + activeLanguage.slice(1)} Request
                  </span>
                  <div style={{ display: 'flex', gap: '0.5rem' }}>
                    <button
                      onClick={() => copyToClipboard(examples[activeLanguage], `${section}-${activeLanguage}`)}
                      style={{
                        padding: '0.375rem 0.75rem',
                        background: 'transparent',
                        border: '1px solid rgba(255, 255, 255, 0.08)',
                        color: '#a0a0a0',
                        borderRadius: '6px',
                        fontSize: '0.75rem',
                        cursor: 'pointer',
                        transition: 'all 0.2s',
                        textTransform: 'uppercase',
                        letterSpacing: '0.05em',
                        fontWeight: 500,
                        display: 'flex',
                        alignItems: 'center',
                        gap: '0.25rem'
                      }}
                      onMouseEnter={(e) => {
                        if (!responsive.isMobile) {
                          e.target.style.background = '#ed8631';
                          e.target.style.color = 'white';
                          e.target.style.borderColor = '#ed8631';
                        }
                      }}
                      onMouseLeave={(e) => {
                        if (!responsive.isMobile) {
                          e.target.style.background = 'transparent';
                          e.target.style.color = '#a0a0a0';
                          e.target.style.borderColor = 'rgba(255, 255, 255, 0.08)';
                        }
                      }}
                    >
                      {copiedStates[`${section}-${activeLanguage}`] ? <Check size={14} /> : <Copy size={14} />}
                      {copiedStates[`${section}-${activeLanguage}`] ? ' Copied' : ' Copy'}
                    </button>
                    <button
                      onClick={() => testAPI(section)}
                      style={{
                        padding: '0.375rem 0.75rem',
                        background: '#ed8631',
                        color: 'white',
                        border: '1px solid #ed8631',
                        borderRadius: '6px',
                        fontSize: '0.75rem',
                        cursor: 'pointer',
                        transition: 'all 0.2s',
                        textTransform: 'uppercase',
                        letterSpacing: '0.05em',
                        fontWeight: 500,
                        display: 'flex',
                        alignItems: 'center',
                        gap: '0.25rem'
                      }}
                      onMouseEnter={(e) => {
                        if (!responsive.isMobile) {
                          e.target.style.background = '#ff8c42';
                        }
                      }}
                      onMouseLeave={(e) => {
                        if (!responsive.isMobile) {
                          e.target.style.background = '#ed8631';
                        }
                      }}
                    >
                      <Play size={14} /> Test API
                    </button>
                  </div>
                </div>
                <pre style={{
                  margin: 0,
                  padding: responsive.isMobile ? '1rem' : '1.5rem',
                  overflowX: 'auto'
                }}>
                  <code style={{
                    fontFamily: "'SF Mono', 'Monaco', 'Inconsolata', monospace",
                    fontSize: responsive.isMobile ? '0.8rem' : '0.875rem',
                    lineHeight: 1.6,
                    color: '#ffffff',
                    whiteSpace: 'pre'
                  }}>{examples[activeLanguage]}</code>
                </pre>
              </div>
            </div>
          </div>

          {/* Test Console */}
          {testConsole && (
            <div style={{
              margin: responsive.isMobile ? '1rem' : '1.5rem',
              padding: '1rem',
              background: 'rgba(0, 0, 0, 0.8)',
              border: '1px solid rgba(255, 255, 255, 0.08)',
              borderRadius: '8px'
            }}>
              <h4 style={{
                color: '#ed8631',
                marginBottom: '0.5rem'
              }}>API Response</h4>
              <pre style={{
                background: 'rgba(0, 0, 0, 0.3)',
                padding: '1rem',
                borderRadius: '4px',
                color: testConsole.error ? '#ef4444' : '#10b981',
                maxHeight: '300px',
                overflowY: 'auto',
                fontFamily: "'SF Mono', monospace",
                fontSize: responsive.isMobile ? '0.8rem' : '0.875rem',
                whiteSpace: 'pre-wrap',
                wordBreak: 'break-all',
                margin: 0
              }}>
                {testConsole.loading && 'Sending request...'}
                {testConsole.error && `Error: ${testConsole.error}`}
                {testConsole.data && (
                  <>
                    {`Response Status: ${testConsole.data.status} ${testConsole.data.statusText}\n\n`}
                    {JSON.stringify(testConsole.data.response, null, 2)}
                  </>
                )}
              </pre>
            </div>
          )}
        </div>
      </div>
    </section>
  );
}

// Render the component
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<ReverbAPIDocumentation />);