/* ============================================================================
   1. SETUP, THEME & GLOBALS
   ========================================================================= */
   :root {
      --background: #121212;
      --surface-1: rgba(255, 255, 255, 0.05); /* Cards, containers */
      --surface-2: rgba(255, 255, 255, 0.08); /* Hover states */
      --glass-surface: rgba(18, 18, 18, 0.6); /* Blurred backgrounds */
      --primary: #00bcd4; /* Cyan */
      --primary-light: #e0f7fa;
      --text-primary: #ffffff;
      --text-secondary: #b0bec5; /* Lighter grey for less important text */
      --text-tertiary: #78909c;
      --border-color: rgba(255, 255, 255, 0.1);
      --shadow-color: rgba(0, 0, 0, 0.5);
    
      --font-family: 'Poppins', sans-serif;
      --font-monospace: 'Roboto Mono', monospace;
      --border-radius: 12px;
      --transition-speed: 0.3s;
    }
    
    * { box-sizing: border-box; margin: 0; padding: 0; }
    
    body {
      font-family: var(--font-family);
      background-color: var(--background);
      color: var(--text-primary);
      line-height: 1.6;
      font-size: 16px;
      display: flex;
      flex-direction: column;
      min-height: 100vh;
    }
    
    a {
      color: var(--primary);
      text-decoration: none;
      transition: color var(--transition-speed);
    }
    a:hover { color: #ffffff; }
    
    h1, h2, h3, h4 { font-weight: 600; }
    h1 { font-size: 2.75rem; line-height: 1.2; }
    h2 { font-size: 1.75rem; margin-bottom: 1.5rem; color: var(--text-primary); border-left: 3px solid var(--primary); padding-left: 1rem; }
    h3 { font-size: 1.25rem; color: var(--text-secondary); }
    
    /* ============================================================================
       2. LAYOUT & STRUCTURE
       ========================================================================= */
.content-wrapper {
  flex-grow: 1;
  /* FIX: Increased top padding to push content below the fixed header */
  padding-top: 100px; 
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
  padding-bottom: 4rem;
}
    
    .page-content {
      display: grid;
      grid-template-columns: 350px 1fr;
      gap: 2rem;
      align-items: start;
      opacity: 0;
      transform: translateY(20px);
      transition: opacity 0.5s ease, transform 0.5s ease;
    }
    
    .page-content.visible {
      opacity: 1;
      transform: translateY(0);
    }
    
    .sidebar {
      position: sticky;
      top: 100px; /* 80px header + 20px gap */
      display: flex;
      flex-direction: column;
      gap: 1.5rem;
    }
    
    .main-content {
      display: flex;
      flex-direction: column;
      gap: 2rem;
    }
    
    @media (max-width: 1024px) {
      .page-content { grid-template-columns: 1fr; }
      .sidebar { position: static; }
    }
    
    /* ============================================================================
       3. HEADER & FOOTER
       ========================================================================= */
    .site-header {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      padding: 0 2rem;
      z-index: 1000;
      background: var(--glass-surface);
      backdrop-filter: blur(10px);
      border-bottom: 1px solid var(--border-color);
    }
    .header-content {
      height: 80px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 2rem;
      max-width: 1400px;
      margin: 0 auto;
    }
    .site-title {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      font-size: 1.5rem;
      font-weight: 600;
      color: var(--text-primary);
    }
    .site-title .material-symbols-outlined {
      color: var(--primary);
      font-size: 2rem;
    }
    .search-form {
      position: relative;
      flex-grow: 1;
      max-width: 600px;
    }
    .search-form .search-icon {
      position: absolute;
      top: 50%;
      left: 1rem;
      transform: translateY(-50%);
      color: var(--text-tertiary);
      pointer-events: none;
    }
    .search-form input[type="search"] {
      width: 100%;
      height: 50px;
      padding: 0 1rem 0 3.5rem;
      border: 1px solid var(--border-color);
      border-radius: var(--border-radius);
      background-color: var(--surface-1);
      color: var(--text-primary);
      font-family: var(--font-family);
      font-size: 1rem;
      transition: all var(--transition-speed);
    }
    .search-form input[type="search"]:focus {
      outline: none;
      background-color: var(--surface-2);
      border-color: var(--primary);
      box-shadow: 0 0 15px rgba(0, 188, 212, 0.3);
    }
    
    .site-footer {
      background-color: var(--surface-1);
      border-top: 1px solid var(--border-color);
      color: var(--text-secondary);
      text-align: center;
      padding: 2rem;
      font-size: 0.9rem;
      line-height: 1.8;
    }
    .site-footer p {
      margin: 0 auto;
    }
    .site-footer a {
      font-weight: 500;
      color: var(--primary);
    }
    
    
    /* ============================================================================
       4. COMPONENTS
       ========================================================================= */
    
    /* --- Loading Spinner --- */
    .loading-container {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      padding: 5rem 0; gap: 1.5rem; color: var(--text-secondary);
    }
    .spinner {
      width: 50px; height: 50px; border: 4px solid var(--surface-1);
      border-top-color: var(--primary); border-radius: 50%;
      animation: spin 1s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    
    
    /* --- General Card Style --- */
    .card {
      background-color: var(--surface-1);
      border: 1px solid var(--border-color);
      border-radius: var(--border-radius);
      padding: 1.5rem;
      box-shadow: 0 4px 20px var(--shadow-color);
    }
    
    /* --- Sidebar Components --- */
    .sidebar #product-name { margin-bottom: 0.5rem; }
    .sidebar .chip-set { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
    .chip {
      display: inline-block; padding: 0.3rem 0.8rem; border-radius: 20px;
      margin: 0.2rem;
      background-color: var(--surface-2); font-size: 0.8rem; font-weight: 500;
      color: var(--text-secondary); transition: all var(--transition-speed);
    }
    .chip:hover { background-color: var(--primary); color: var(--background); cursor: pointer; }
    .identifier-list {
      list-style: none; display: flex; flex-direction: column; gap: 0.75rem;
      margin-top: 0;
    }
    .identifier-list li {
      display: flex; justify-content: space-between; align-items: center;
      font-size: 0.9rem;
    }
    .identifier-list dt { color: var(--text-tertiary); }
    .identifier-list dd {
      font-family: var(--font-monospace); font-weight: 500; color: var(--text-secondary);
      background-color: var(--background); padding: 0.25rem 0.5rem;
      border: 1px solid var(--border-color); border-radius: 6px;
    }
    .company-info { margin-top: 0; font-size: 0.9rem; }
    .company-info .company-name { font-weight: 600; color: var(--text-primary); }
    .company-info .company-address { color: var(--text-secondary); }
    
    /* --- Component Tiles (Formulation) --- */
    .component-grid {
      list-style: none; display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 1.5rem;
    }
    .component-tile {
      background: linear-gradient(145deg, var(--surface-1), #1c1c1c);
      border: 1px solid var(--border-color); border-radius: var(--border-radius);
      padding: 1.5rem; display: flex; flex-direction: column;
      transition: all var(--transition-speed) ease;
      box-shadow: 0 4px 20px var(--shadow-color);
      cursor: pointer;
    }
    .component-tile:hover {
      transform: translateY(-5px);
      border-color: var(--primary);
      box-shadow: 0 10px 30px rgba(0, 188, 212, 0.2);
    }
    .tile-header {
      display: flex; justify-content: space-between; align-items: flex-start;
      margin-bottom: 1rem;
    }
    .component-name { font-size: 1.25rem; color: var(--text-primary); }
    .component-portion {
      font-size: 1rem; font-weight: 600; color: var(--primary);
      white-space: nowrap;
    }
    .smiles-container { flex-grow: 1; display: flex; align-items: center; justify-content: center; }
    .smiles-container svg { max-width: 100%; height: auto; }
    .component-meta {
      margin-top: 1rem; font-size: 0.8rem; color: var(--text-tertiary);
    }
    .component-meta span { display: block; }
    .tile-footer {
      margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color);
    }
    .component-role {
      font-size: 0.85rem; font-weight: 500; color: var(--text-secondary);
    }
    
    /* --- Indications (Accordion) --- */
    .indications-list { display: flex; flex-direction: column; gap: 1rem; }
    .indication-item summary {
      display: flex; justify-content: space-between; align-items: center;
      padding: 1rem 1.5rem; border-radius: var(--border-radius);
      background-color: var(--surface-1); border: 1px solid var(--border-color);
      cursor: pointer; transition: background-color var(--transition-speed);
      list-style: none;
    }
    .indication-item summary:hover { background-color: var(--surface-2); }
    .indication-item[open] summary {
      border-bottom-left-radius: 0; border-bottom-right-radius: 0;
      border-bottom-color: transparent;
    }
    .summary-main { display: flex; flex-direction: column; }
    .summary-crop { font-weight: 600; font-size: 1.1rem; color: var(--text-primary); }
    .summary-pest { color: var(--text-secondary); font-size: 0.9rem; }
    .indication-item .chevron {
      color: var(--text-tertiary); font-size: 2rem;
      transition: transform var(--transition-speed) ease;
    }
    .indication-item[open] .chevron { transform: rotate(180deg); }
    .indication-details {
      background-color: var(--surface-1);
      border: 1px solid var(--border-color); border-top: none;
      border-radius: 0 0 var(--border-radius) var(--border-radius);
      padding: 1.5rem;
    }
    .indication-dl {
      display: grid; grid-template-columns: 150px 1fr;
      gap: 1rem; font-size: 0.9rem;
    }
    .indication-dl dt { font-weight: 500; color: var(--text-tertiary); }
    .indication-dl dd { color: var(--text-secondary); }
    .obligations { padding-left: 1.25rem; }
    
    /* --- Data Tables (Hazards) --- */
    .data-table-container { overflow-x: auto; }
    .data-table {
      width: 100%; border-collapse: collapse;
    }
    .data-table th, .data-table td {
      padding: 0.75rem 1rem; text-align: left;
      border-bottom: 1px solid var(--border-color);
    }
    .data-table th { font-weight: 600; color: var(--text-secondary); font-size: 0.9rem; }
    
    /* ============================================================================
       5. UTILITIES
       ========================================================================= */
    .hidden { display: none !important; }
    .faded-out { opacity: 0; visibility: hidden; }

    
    /* Prevent long substance names from overflowing the sidebar card */
#substance-name{
  /* shrink gently on narrow sidebars */
  font-size: clamp(1.25rem, 1rem + 1.2vw, 2rem);
  line-height: 1.2;

  /* wrap even on long unbroken tokens and hyphenate where possible */
  overflow-wrap: anywhere;   /* modern */
  word-break: break-word;    /* fallback */
  hyphens: auto;

  /* safety nets */
  max-width: 100%;
}

/* If identifiers can be long, allow wrapping there too */
.identifier-list dt,
.identifier-list dd {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sidebar .card { overflow: hidden; }
