/**
 *  ___                  ___
 * | __|_ _ _ _  __ _  _| _ \__ _ __ _ ___ ___
 * | _/ _` | ' \/ _| || |  _/ _` / _` / -_|_-<
 * |_|\__,_|_||_\__|\_, |_| \__,_\__, \___/__/
 *                  |__/         |___/
 * 
 * This file is part of kristuff/apache-fancy-pages.
 * v0.2.1 - Copyright (c) 2021-2022 Kristuff <kristuff@kristuff.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
:root {
    --color-bg: #ffffff;
    --color-highlight: #000000;
    --color-text: #404040;
    --color-text-light: #444444;
    --color-text-xlight: #636363;
    --color-table-bg: whitesmoke;
    --color-table-bg--head: #161720;
    --color-table-bg--even: #e3e2e2;
    --color-table-border: rgba(0, 0, 0, 0.05);
    --color-table-text: #222222;
    --color-table-header-text: #dadada;
    --color-link-text: #115293;
    --color-link-text--visited: #115293;
    --color-button-hover: rgba(29, 155, 240, 0.1);
    --color-row-hover: rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #1f242b;
        --color-highlight: #ffffff;
        --color-text: #bbb;
        --color-text-light: #8a8a8a;
        --color-text-xlight: #5e5f6c;
        --color-table-bg: #282e37;
        --color-table-bg--head: #171b20;
        --color-table-bg--even: rgba(255, 255, 255, 0.03);
        --color-table-border: rgba(255, 255, 255, 0.1);
        --color-table-text: #bbbbbb;
        --color-table-header-text: #eaeaea;
        --color-link-text: #3499dd;
        --color-link-text--visited: #3499dd;
        --color-row-hover: rgba(255, 255, 255, 0.1);
    }

    * {
        scrollbar-color: #313137 #171b20;
    }
}

*,
*::after,
*::before {
    box-sizing: border-box;
}

html {
    line-hVeight: 2;
    font-size: 20px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    font-weight: 400;
    color: var(--color-text);
    background-color: var(--color-bg);
}

img {
    border-style: none;
}

button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    line-height: 2;
    margin: 0;
}

a {
    text-decoration: none;
    color: var(--color-link-text);
}

a:visited {
    color: var(--color-link-text--visited);
}

a:hover {
    text-decoration: underline;
}

.row {
    box-sizing: border-box;
    margin: 0 auto;
    width: 94%;
}

h1 {
    font-weight: 300;
}

tr.hidden,
.hidden {
    display: none !important;
}

/* ------------------- */
/* -- SECTION TITLE -- */
/* ------------------- */
section#section-title {
    margin: 12px 0;
    min-height: 60px;
}

section#section-title h1 {
    margin-top: 6px;
    margin-bottom: 9px;
    color: var(--color-highlight);
    min-height: 28px;
}

section#section-title div#breadcrumb {
    color: var(--color-text-xlight);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    max-width: 100%;
}

section#section-title div#breadcrumb a,
section#section-title div#breadcrumb a:visited {
    color: var(--color-text-light);
    padding: 6px;
}

section#section-title div#breadcrumb a.active,
section#section-title div#breadcrumb a.active:visited {
    color: var(--color-text-xlight);
}

.search-wrapper {
    display: flex;
    align-items: center;
    flex-direction: row;
    width: 100%;
    height: 36px;
    position: relative;
}

.search-wrapper .close-icon,
.search-wrapper .search-icon {
    display: flex;
    height: 100%;
    position: absolute;
}

.search-wrapper .close-icon::before,
.search-wrapper .search-icon::before {
    content: "";
    display: inline-flex;
    align-items: center;
    width: 20px;
    height: 100%;
    background-color: var(--color-text-light);
    mask-position: center;
    mask-size: contain;
    mask-repeat: no-repeat;
}

.search-wrapper .search-icon::before {
    margin-left: 12px;
    mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21.53 20.47l-3.66-3.66C19.195 15.24 20 13.214 20 11c0-4.97-4.03-9-9-9s-9 4.03-9 9 4.03 9 9 9c2.215 0 4.24-.804 5.808-2.13l3.66 3.66c.147.146.34.22.53.22s.385-.073.53-.22c.295-.293.295-.767.002-1.06zM3.5 11c0-4.135 3.365-7.5 7.5-7.5s7.5 3.365 7.5 7.5-3.365 7.5-7.5 7.5-7.5-3.365-7.5-7.5z"/></svg>');
}

.search-wrapper .close-icon::before {
    background-color: var(--color-link-text);
    mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.414 12l5.793-5.793c.39-.39.39-1.023 0-1.414s-1.023-.39-1.414 0L12 10.586 6.207 4.793c-.39-.39-1.023-.39-1.414 0s-.39 1.023 0 1.414L10.586 12l-5.793 5.793c-.39.39-.39 1.023 0 1.414.195.195.45.293.707.293s.512-.098.707-.293L12 13.414l5.793 5.793c.195.195.45.293.707.293s.512-.098.707-.293c.39-.39.39-1.023 0-1.414L13.414 12z"/></svg>');
}

.search-wrapper input,
.search-wrapper input[type=text] {
    width: 100%;
    padding-left: 36px;
    height: 100%;
    border-radius: 100em;
}

.search-wrapper button.close-search {
    position: absolute;
    right: 6px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    border: none;
    background: none;
    outline: none;
    cursor: pointer;
}

.search-wrapper button.close-search:focus {
    outline: 2px solid var(--color-link-text);
}

.search-wrapper button.close-search:not(.active) {
    display: none;
}

.search-wrapper button.close-search:hover {
    background: var(--color-button-hover);
}

input#filter {
    border: 1px solid var(--color-table-border);
    background-color: var(--color-table-bg--even);
    outline: 0;
    display: block;
    width: 100%;
    color: var(--color-text);
}

input#filter:focus,
input#filter:focus-visible {
    border-color: var(--color-link-text);
    box-shadow: inset 0 1px 1px rgba(var(--color-link-text), 0.075), 0 0 8px rgba(var(--color-link-text), 0.6);
}

input#filter:focus+.search-icon::before,
input#filter:focus-visible+.search-icon::before {
    background-color: var(--color-link-text);
}

/* --------------------- */
/* -- SECTION CONTENT -- */
/* --------------------- */
/** table index  */
table#list {
    width: 100%;
    border: 0;
    table-layout: auto;
    border-collapse: collapse;
}

table#list tr td:first-child,
table#list tr th:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

table#list tr td:last-child,
table#list tr th:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/** tableIndex: hide break row  */
table#list tr.indexbreakrow {
    display: none;
}
table#list tr th:nth-child(1) a:nth-child(1) {
    padding-left: 3rem;
}

table#list tr th:nth-child(1),
table#list tr td:nth-child(1) {
    padding-left: 0 !important;
}

/** tableIndex: content */
table#list tr th,
table#list tr td {
    font-size: 0.875rem;
    color: var(--color-table-text);
    text-align: left;
    line-height: 2.5rem;
    word-break: break-all;
}

/** tableIndex: header */
table#list thead th {
    font-weight: bold;
    position: sticky;
    top: 0;
    background-color: var(--color-table-bg--head);
}

table#list thead th a,
table#list thead th a:visited {
    color: var(--color-table-header-text);
}

table#list tr td:nth-child(1) a,
table#list tr td:nth-child(1) a:visited {
    color: var(--color-highlight);
}

table#list tr[class*=dir] td:nth-child(1) a {
    font-weight: 600;
}

table#list .sorticon {
    margin-left: 6px;
    color: var(--color-table-header-text);
}

table#list tr.no-items td {
    padding: 15px;
    color: var(--color-text-light);
}

table#list tr.no-items td {
    text-align: center;
}

/** 
  table#list tr {
      background: var(--color-table-bg--even);
      border-bottom: 1px solid var(--color-table-border);
  }
  */
/* Adjust padding according to footer height (~50px) */
section#section-content {
    padding-bottom: 50px;
}

/* -------------------- */
/* -- SECTION FOOTER -- */
/* -------------------- */
/* Fixed footer */
footer#section-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 0 10px 0;
    color: var(--color-text-xlight);
    background-color: var(--color-bg);
    font-size: 0.75rem;
}

footer#section-footer p {
    margin: 0;
    margin-top: 6px;
}

footer#section-footer a,
footer#section-footer a:visited {
    color: var(--color-text-xlight);
    text-decoration: underline;
}

footer#section-footer a:hover {
    color: var(--color-text);
}

footer#section-footer .row {
    border-top: 1px solid var(--color-text-xlight);
}

@media (max-width: 400px) {
    h1 {
        font-size: 1.375em;
    }
}

@media (max-width: 767px) {

    /** tableIndex: alternative row style */
    table#list tr:not(.even-parentdir):not(.no-items):not(:first-of-type) {
        border-bottom: 1px solid var(--color-table-border);
    }

    section#section-title div#breadcrumb {
        padding-bottom: 6px;
    }


    table#list tr {
        position: relative;
    }

    table#list thead th:nth-child(1),
    table#list thead th:nth-child(3),
    table#list thead th:nth-child(2),
    table#list tr:nth-child(1) td:nth-child(3),
    table#list tr:nth-child(1) td:nth-child(2) {
        display: none !important;
    }

    table#list tr:nth-child(1) td {
        background-color: var(--color-table-bg--head);
        color: var(--color-table-header-text);
    }

    table#list tr:nth-child(1) td:nth-child(1) a,
    table#list tr:nth-child(1) td:nth-child(1) a:visited {
        color: var(--color-table-header-text);
    }

    table#list th:nth-child(1),
    table#list td:nth-child(1) {
        border-top-right-radius: 9px;
        border-bottom-right-radius: 9px;
    }

    table#list tr th:nth-child(1),
    table#list tr td:nth-child(1) {
        padding-left: 0 !important;
    }

    table#list tr:not(:nth-child(1)) td:nth-child(1) {
        display: block;
        line-height: 1.1;
        padding-bottom: 0;
        margin-top: 0.7rem;
    }

    table#list tr td:nth-child(3),
    table#list tr td:nth-child(2) {
        display: inline-flex;
        color: var(--color-text-light) !important;
        font-size: 13px !important;
        padding-left: 0 !important;
        line-height: 1.1;
        padding: 0;
        padding-right: 6px !important;
        padding-bottom: 8px !important;
        position: absolute;
        top: 1.8rem;
    }

    table#list tr td:nth-child(1) {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 90vw;
        height: 2.5rem;
    }

    table#list tr td:nth-child(2) {
        left: 2.25rem;
    }

    table#list tr td:nth-child(3) {
        right: 0rem;
    }

    h1 {
        font-size: 1.5em;
    }

    footer#section-footer {
        text-align: center;
        padding: 6px 0 10px 0;
    }

    tbody tr {
        line-height: 1.5;
    }

    tbody a {
        position: relative;
        padding-left: 2.2rem;
    }

    tbody a[href*="."]:before {
        background: url('../icons/file-blank.svg') left center/1.1rem no-repeat;
        content: "";
        width: 1.5rem;
        height: 200%;
        position: absolute;
        top: -0.1rem;
        left: 0.6rem;
        bottom: 0;
    }
}

@media only screen and (min-width: 768px) {
    .row {
        width: 96%;
    }

    .row.flex {
        display: flex;
        align-items: center;
    }

    section#section-title div#breadcrumb {
        width: calc(100% - 250px);
    }

    .search-wrapper {
        width: 230px;
        margin-left: auto;
    }

    /** tableIndex: alternative row style */
    table#list tr:not(.indexhead):not(.hidden):nth-child(even) td {
        background: var(--color-table-bg--even);
    }

    tbody a {
        position: relative;
        padding-left: 3rem;
    }

    tbody a[href*="."]:before {
        background: url('../icons/file-blank.svg') left center/1.1rem no-repeat;
        content: "";
        width: 1.5rem;
        height: 200%;
        position: absolute;
        top: -0.5rem;
        left: 1rem;
        bottom: 0;
    }
}

tbody td {
    font-weight: 300;
}

tbody a[href$="../"] {
    font-weight: 400;
}

/* ----------- */
/* -- ICONS -- */
/* ----------- */

tbody a[href*="/"]:after {
    background: url('../icons/folder.svg') left center/1.1rem no-repeat;
    content: "";
}

tbody a[href$="/"]:before {
    background: url('../icons/folder.svg') left center/1.1rem no-repeat;
}

tbody a[href*="../"]:before {
    background: url('../icons/angle-left.svg') left center/0.6rem no-repeat;
    top: -0.5rem;
    left: 1.2em;
}

tbody a[href$=".doc"]:before, tbody a[href$=".docx"]:before {
    background: url('../icons/file-word.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".pdf"]:before {
    background: url('../icons/file-pdf.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".xls"]:before, tbody a[href$=".xlsx"]:before,
tbody a[href$=".csv"]:before {
    background: url('../icons/file-excel.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".zip"]:before, tbody a[href$=".tar"]:before,
tbody a[href$=".gz"]:before, tbody a[href$=".tgz"]:before,
tbody a[href$=".7z"]:before, tbody a[href$=".rar"]:before,
tbody a[href$=".bz"]:before, tbody a[href$=".bz2"]:before,
tbody a[href$=".jar"]:before, tbody a[href$=".deb"]:before,
tbody a[href$=".udeb"]:before {
    background: url('../icons/file-archive.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".md"]:before, tbody a[href$=".markdown"]:before,
tbody a[href$=".rst"]:before, tbody a[href$=".txt"]:before,
tbody a[href$=".tex"]:before, tbody a[href$=".org"]:before,
tbody a[href~="CHANGELOG"]:before, tbody a[href~="COPYING"]:before,
tbody a[href~="LICENSE"]:before, tbody a[href~="INSTALL"]:before {
    background: url('../icons/file-txt.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".php"]:before, tbody a[href$=".java"]:before,
tbody a[href$=".py"]:before, tbody a[href$=".c"]:before,
tbody a[href$=".cpp"]:before, tbody a[href$=".h"]:before,
tbody a[href$=".hpp"]:before, tbody a[href$=".java"]:before,
tbody a[href$=".go"]:before, tbody a[href$=".rs"]:before,
tbody a[href$=".asm"]:before, tbody a[href$=".rb"]:before,
tbody a[href$=".js"]:before, tbody a[href$=".f"]:before,
tbody a[href$=".cbl"]:before, tbody a[href$=".cob"]:before {
    background: url('../icons/code.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".sql"]:before, tbody a[href$=".mysql"]:before,
tbody a[href$=".dsql"]:before, tbody a[href$=".db"]:before {
    background: url('../icons/database.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".json"]:before, tbody a[href$=".lock"]:before,
tbody a[href$=".ini"]:before, tbody a[href$=".conf"]:before,
tbody a[href$=".yml"]:before, tbody a[href$=".xml"]:before,
tbody a[href$=".cfg"]:before, tbody a[href$=".toml"]:before,
tbody a[href$=".template"]:before, list a[href~="Makefile"]:before {
   background: url('../icons/brackets-coding.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".bat"]:before, tbody a[href$=".sh"]:before,
tbody a[href$=".ps1"]:before {
    background: url('../icons/cmd-terminal.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".bin"]:before, tbody a[href$=".exe"]:before,
tbody a[href$=".dll"]:before, tbody a[href$=".o"]:before
tbody a[href$=".a"]:before, tbody a[href$=".so"]:before {
    background: url('../icons/file-binary.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".css"]:before, tbody a[href$=".scss"]:before,
tbody a[href$=".sass"]:before {
    background: url('../icons/file-css3.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".html"]:before {
    background: url('../icons/file-html.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".m3u"]:before, tbody a[href$=".mpeg"]:before,
tbody a[href$=".wma"]:before, tbody a[href$=".ogg"]:before,
tbody a[href$=".wav"]:before, tbody a[href$=".flac"]:before,
tbody a[href$=".mp3"]:before, tbody a[href$=".aac"]:before {
    background: url('../icons/file-audio.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".bmp"]:before, tbody a[href$=".jpg"]:before,
tbody a[href$=".jpeg"]:before, tbody a[href$=".png"]:before,
tbody a[href$=".svg"]:before, tbody a[href$=".tif"]:before,
tbody a[href$=".tiff"]:before, tbody a[href$=".gif"]:before,
tbody a[href$=".webp"]:before, tbody a[href$=".psd"]:before,
tbody a[href$=".xcf"]:before {
    background: url('../icons/file-image.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".webm"]:before, tbody a[href$=".avi"]:before,
tbody a[href$=".ts"]:before, tbody a[href$=".mov"]:before,
tbody a[href$=".wmv"]:before, tbody a[href$=".mp4"]:before,
tbody a[href$=".m4v"]:before, tbody a[href$=".mkv"]:before {
    background: url('../icons/file-video.svg') left center/1.1rem no-repeat;
}

tbody a[href$=".otf"]:before, tbody a[href$=".ttf"]:before,
tbody a[href$=".woff"]:before, {
    background: url('../icons/font.svg') left center/1.1rem no-repeat;
}
