/*
 * Stylesheet for the Global Air Pollution Dashboard
 * 
 * Author: Abdulrahman Baidaq
 * Project Repository: https://github.com/Abood991B/air-pollution-dashboard
 * 
 */

    :root {
      --primary-color: #0052D4;
      --secondary-color: #4364F7;
      --accent-color: #6FB1FC;
      --light-bg: #f5f7fa;
      --card-bg: #fff;
      --dark-text: #333;
      --light-text: #fff;
      --heading-font: 'Poppins', sans-serif;
      --body-font: 'Open Sans', sans-serif;
    }

    /* Dark-mode overrides */
    .dark-mode {
      --light-bg: #2e2e2e;
      --card-bg: #3a3a3a;
      --dark-text: #f0f0f0;
      --light-text: #ffffff;
      --primary-color: #B992F7;
      --secondary-color: #9364F7;
      --accent-color: #6FB1FC;
    }

    /* ---------------------------------------
       GLOBAL RESETS
       --------------------------------------- */
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: var(--body-font);
      background-color: var(--light-bg);
      color: var(--dark-text);
      line-height: 1.5;
      overflow-x: hidden;
      transition: background-color 0.3s, color 0.3s;
    }

    /* ---------------------------------------
       HEADER
       --------------------------------------- */
    header {
      background: linear-gradient(
        90deg,
        var(--primary-color),
        var(--secondary-color),
        var(--accent-color)
      );
      color: var(--light-text);
      text-align: center;
      padding: 2.5rem 1rem 2rem;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
      position: relative;
      z-index: 10;
      transition: background 0.3s;
    }

    header h1 {
      font-family: var(--heading-font);
      font-size: 3rem;
      font-weight: 700;
      letter-spacing: 0.5px;
      margin-bottom: 0.25rem;
    }

    header p {
      font-weight: 300;
      font-size: 1.1rem;
      opacity: 0.9;
      margin-top: 0.25rem;
    }

    /* ---------------------------------------
       FILTER CONTROLS
       --------------------------------------- */
    #filterControls {
      max-width: 1700px;
      margin: 1rem auto 0;
      width: 95%;
      display: flex;
      align-items: center;
      gap: 1.5rem;
      flex-wrap: wrap;
    }

    #filterControls label {
      font-size: 1rem;
      font-weight: 600;
      color: var(--primary-color);
      transition: color 0.3s;
    }

    #filterControls select {
      padding: 0.4rem 0.6rem;
      font-size: 0.95rem;
      border: 1px solid #ccc;
      border-radius: 6px;
      font-family: var(--body-font);
    }

    .switch-wrapper {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    .switch-wrapper span {
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--primary-color);
      transition: color 0.3s;
    }
    .switch {
      position: relative;
      display: inline-block;
      width: 46px;
      height: 24px;
    }
    .switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    .slider {
      position: absolute;
      cursor: pointer;
      top: 0; left: 0; right: 0; bottom: 0;
      background-color: #ccc;
      transition: .4s;
      border-radius: 34px;
    }
    .slider:before {
      position: absolute;
      content: "";
      height: 18px;
      width: 18px;
      left: 3px; bottom: 3px;
      background-color: white;
      transition: .4s;
      border-radius: 50%;
    }
    input:checked + .slider {
      background-color: #2196F3;
    }
    input:checked + .slider:before {
      transform: translateX(22px);
    }

    /* ---------------------------------------
       MAIN DASHBOARD LAYOUT
       --------------------------------------- */
    main {
      width: 95%;
      max-width: 1700px;
      margin: 1.5rem auto 3rem;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
      grid-gap: 2rem;
    }

    /* Each Chart Container (section) */
    section {
      background: var(--card-bg);
      border-radius: 10px;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
      padding: 1.5rem 1.5rem 2rem;
      display: flex;
      flex-direction: column;
      position: relative;

      /* set overflow to visible so if the chart or legend
         grows beyond the container, it isn't clipped */
      overflow: visible;

      transition: all 0.3s ease-in-out, background-color 0.3s;
    }

    section:hover {
      transform: translateY(-4px);
      box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    }

    section h2 {
      margin-bottom: 0.75rem;
      font-family: var(--heading-font);
      font-size: 1.25rem;
      font-weight: 600;
      color: var(--primary-color);
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding-bottom: 0.5rem;
      border-bottom: 2px solid rgba(0, 82, 212, 0.2);
      transition: color 0.3s, border-bottom-color 0.3s;
    }

    section .chart-desc {
      font-size: 0.9rem;
      margin-bottom: 1rem;
      color: #555;
      line-height: 1.4;
    }

    section h2 ion-icon {
      font-size: 1.2rem;
      color: var(--secondary-color);
      transition: color 0.3s;
    }

    section svg {
      /* the JS .attr("width", w).attr("height", h) will
         control the actual size of the chart */
      display: block;
    }

    /* ---------------------------------------
       TOOLTIP STYLING
       --------------------------------------- */
    .tooltip {
      position: absolute;
      text-align: center;
      padding: 0.75rem 1rem;
      background: rgba(0, 0, 0, 0.75);
      color: #fff;
      border-radius: 6px;
      pointer-events: none;
      font-size: 0.9rem;
      z-index: 9999;
      transition: opacity 0.2s ease;
    }

    /* ---------------------------------------
       FOOTER
       --------------------------------------- */
    footer {
      text-align: center;
      padding: 1.2rem;
      background: linear-gradient(
        90deg,
        var(--accent-color),
        var(--secondary-color),
        var(--primary-color)
      );
      color: var(--light-text);
      font-size: 1rem;
      margin-top: 2rem;
      transition: background 0.3s;
    }

    footer p {
      margin: 0;
      font-weight: 300;
    }

    footer p span {
      opacity: 0.85;
    }

    /* ---------------------------------------
       RESPONSIVENESS
       --------------------------------------- */
    @media (max-width: 768px) {
      header h1 {
        font-size: 2rem;
      }
      header p {
        font-size: 1rem;
      }
      section h2 {
        font-size: 1.1rem;
      }
    }
