{% extends "base.html" %}

{% block head %}
  <style>
    * {
      box-sizing: border-box;
    }

    body {
      padding: 10px;
      background: #f2f2f2;
    }

    .tabs {
      display: flex;
      flex-wrap: wrap;
      max-width: 700px;
      background: #efefef;
      box-shadow: 0 48px 80px -32px rgba(0,0,0,0.3);
    }

    .input {
      position: absolute;
      opacity: 0;
    }

    .label {
      width: 100%;
      padding: 20px 30px;
      background: #e5e5e5;
      cursor: pointer;
      font-weight: bold;
      font-size: 18px;
      color: #7f7f7f;
      transition: background 0.1s, color 0.1s;
    }

    .label:hover {
      background: #d8d8d8;
    }

    .label:active {
      background: #ccc;
    }

    .input:focus + .label {
      box-shadow: inset 0px 0px 0px 3px #2aa1c0;
      z-index: 1;
    }

    .input:checked + .label {
      background: #fff;
      color: #000;
    }

    @media (min-width: 600px) {
      .label {
        width: auto;
      }
    }

    .panel {
      display: none;
      padding: 20px 30px 30px;
      background: #fff;
    }

    @media (min-width: 600px) {
      .panel {
        order: 99;
      }
    }

    .input:checked + .label + .panel {
      display: block;
    }
  </style>
{% endblock %}

{% block content %}
  <div class="tabs">
    {% set ns = namespace(counter=0) %}
    {% for name, table in tables %}
      {% if ns.counter == 0 %}
        <input name="tabs" type="radio" id="{{ name }}" checked="checked" class="input"/>
      {% else %}
        <input name="tabs" type="radio" id="{{ name }}" class="input"/>
      {% endif %}
      {% set ns.counter = ns.counter + 1 %}
      <label for="{{ name }}" class="label">{{ name }}</label>
      <div class="panel">
      {% if name == "lfc" %}
        <h1>Log-Fold Change (LFC)</h1>
          <p>Positive numbers indicate enrichment relative to the intercept,
          negative numbers indicate depletion relative to the intercept.</p><br>
      {% elif name == "p_val" %}
        <h1><i>p</i>-Values</h1>
      {% elif name == "q_val" %}
        <h1><i>q</i>-Values: FDR Corrected <i>p</i>-Values</h1>
      {% elif name == "se" %}
        <h1>Standard Error</h1>
      {% elif name == "w" %}
        <h1><i>W</i>-Scores: Log-Fold Change divided by the Standard Error</h1>
      {% else %}
        <h1>{{ name }}</h1>
      {% endif %}
      {% if intercept_single %}
        <p><b>Groups used to define the intercept:</b></p>
        <p>{{ intercept_single }} (and any numerical metadata columns)</p>
      {% else %}
        <p><b>Groups used to define the intercept:</b></p>
        <p>{{ ", ".join(intercept_multi) }} (and any numerical metadata columns)</p>
      {% endif %}
      <table class="dataframe table table-striped table-hover" border="0">{{ table }}</table>
      </div>
    {% endfor %}
  </div>
{% endblock %}
