:root {
    --dark-purple: #330C2F;
    --maximum-purple: #7B287D;
    --columbia-blue: #CEE5F2;
    --teal-blue: #4E8098;
    --riffle-green: #4B5043;
}

html, body {
    padding: 0;
    margin: 0;
    font-family: Helvetica, sans-serif;
    touch-action: pan-x pan-y;
}

header {
    position: fixed;
    width: 100%;
    top: 0px;
    left: 0px;
    height: 100px;
    background-color: var(--dark-purple);
    border-bottom: 5px solid var(--teal-blue);
    color: var(--columbia-blue);
    z-index: 1;
}

header #viewing {
    position: fixed;
    top: 10px;
    right: 10px;
}

header #file_count {
    position: fixed;
    top: 40px;
    right: 10px;
}

header a h1 {
    padding: 0;
    margin: 0;
    position: fixed;
    top: 10px;
    left: 10px;
    font-weight: 100;
    font-size: 40px;
    color: var(--columbia-blue);
}

#folders_container,
.images_container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

#folders_container > a,
.images_container > a {
    text-decoration: none;
    display: block;
    width: 100%;
}

header #sync {
    padding: 8px 13px;
    background-color: var(--teal-blue);
    color: var(--columbia-blue);
    position: fixed;
    left: 10px;
    top: 55px;
    border: 2px solid var(--columbia-blue);
    text-decoration: none;
    display: none;
}

header #sync:hover {
    background-color: var(--riffle-green);
    color: var(--columbia-blue);
    border: 2px solid var(--columbia-blue);
}

header nav {
    position: fixed;
    top: 60px;
}

header nav ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    margin-left: 10px;
}

header nav li {
    display: inline-block;
    margin-right: 5px;
}

header nav a {
    display: block;
    padding: 10px;
    font-size: 18px;
    background: var(--dark-purple);
    color: #fff;
    text-decoration: none;
    border-radius: 5px 5px 0 0;
    background: #fff2;
}

header nav a:hover {
    background: var(--riffle-green);
}

header nav a.current {
    background: var(--teal-blue);
}

.item {
    background-color: #fff;
    display: block;
    border: 3px solid var(--riffle-green);
    padding: 10px;
    box-sizing: border-box;
    margin: 0;
    width: 100%;
    min-width: 148px;
    max-width: 230px;
}

.item:hover {
    border: 3px solid var(--maximum-purple);
    background-color: rgba(255,255,255,0);
}

.item .folder {
    background-image: url(../image/folder.svg);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    margin-bottom: 10px;
}

.item .folder-up {
    background-image: url(../image/folder-up.svg);
}

.item .folder-download {
    background-image: url(../image/folder-download.svg);
}

.item .folder-prev {
    background-image: url(../image/folder-left.svg);
}

.item .folder-next {
    background-image: url(../image/folder-right.svg);
}

.item .text-file-icon {
    background-image: url(../image/text.svg);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    margin-bottom: 10px;
}

.item .image {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    text-align: center;
    background-size: cover !important;
    background-position: center;
    margin-bottom: 10px;
    position: relative;
}

.item .image img {
    max-width: 100%;
    max-height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
}

.item .label {
    display: block;
    text-align: center;
    overflow: hidden;
    width: 100%;
    height: 17px;
    color: var(--dark-purple);
}

footer {
    position: fixed;
    width: 100%;
    bottom: 0px;
    left: 0px;
    height: 30px;
    background-color: var(--dark-purple);
    border-top: 5px solid var(--teal-blue);
}

#container {
    margin-top: 105px;
    margin-bottom: 35px;
    width: 100%;
    padding: 10px;
    background-color: var(--columbia-blue);
    min-height: calc(100vh - 140px);
    box-sizing: border-box;
}

#lightbox {
    position: fixed;
    top:0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--dark-purple);
    z-index: 9;
    display: none;
}

#lightbox::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: .4;
    z-index: -1;
}

#lightbox-container {
    position: fixed;
    background: var(--columbia-blue);
    top: 10px;
    left: 10px;
    bottom: 10px;
    right: calc(20vw + 10px);
    border: 1px solid var(--riffle-green);

    display: flex;
    align-items: center;
    touch-action: none;
}

#lightbox-loading {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0px;
    left: 0px;
    display: none;
}

#lightbox-loading-image {
    position: fixed;
    top: 50%;
    left: 50%;
    margin-top: -100px;
    margin-left: -100px;
    z-index: 9999;
    display: block;
}

#lightbox-next {
    position: fixed;
    right: 10px;
    top: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
}

#lightbox-prev {
    position: fixed;
    right: calc(20vw - 50px);
    top: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
}

#lightbox-close {
    position: fixed;
    right: 10px;
    bottom: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
}

#lightbox-download {
    position: fixed;
    right: calc(20vw - 50px);
    bottom: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
}

#lightbox-download-raw {
    position: fixed;
    right: calc(20vw - 125px);
    bottom: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
}

#lightbox-info {
    position: fixed;
    left: 10px;
    bottom: 10px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    background: var(--dark-purple);
    padding: 5px 5px 0 0;
    border-radius: 0 50% 0 0;
}

#lightbox-next, #lightbox-prev, #lightbox-close, #lightbox-download, #lightbox-download-raw, #lightbox-info {
    z-index: 10;
}

#lightbox-caption {
    position: fixed;
    right: 10px;
    width: calc(20vw - 10px);
    top: 70px;
    bottom: 70px;
    box-sizing: border-box;
    border: 2px solid var(--maximum-purple);
    padding: 10px;
    color: var(--columbia-blue);
    box-sizing: border-box;
    background-color: rgba(0,0,0,0.5);
    overflow-y: scroll;
    overflow-x: hidden;
    transition: right 0.5s;
}

#lightbox-caption::-webkit-scrollbar {
    width: 2px;
  }

  #lightbox-caption::-webkit-scrollbar-track {
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  }

  #lightbox-caption::-webkit-scrollbar-thumb {
    background-color: var(--columbia-blue);
    outline: 1px solid var(--teal-blue);
  }

#lightbox-content {
    margin: auto;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#lightbox-content img, #lightbox-content video {
    position: absolute;
    max-width: calc(100% - 10px);
    max-height: calc(100% - 10px);
    margin: auto;
    border: 4px solid #ccc;
    box-sizing: border-box;
    top: 0; left: 0; right: 0; bottom: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-fade-in {
    animation: fadeIn 0.4s ease-in-out !important;
}

/* Slide animations for Lightbox transition */
@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-150%); opacity: 0; }
}
@keyframes slideInRight {
    from { transform: translateX(150%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(150%); opacity: 0; }
}
@keyframes slideInLeft {
    from { transform: translateX(-150%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-out-left {
    animation: slideOutLeft 0.4s forwards ease-in-out !important;
}
.slide-in-right {
    animation: slideInRight 0.4s forwards ease-in-out !important;
}
.slide-out-right {
    animation: slideOutRight 0.4s forwards ease-in-out !important;
}
.slide-in-left {
    animation: slideInLeft 0.4s forwards ease-in-out !important;
}

#showing {
    font-weight: 1.4em;
    display: block;
    text-align:center;
    margin-bottom: 5px;
}

.resync_container {
    position: fixed;
    top: 125px;
    left: 50px;
    width: calc(100% - 100px);
    height: calc(100% - 225px);
    background: #000;
}

.resync_close {
    position: fixed;
    top: 125px;
    right: 5px;
    color: #fff;
    background: #000;
    font-weight: bold;
    padding: 10px;
    cursor: pointer;
}

#resync_popup,
#text_popup {
    z-index: 99;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0005;
    backdrop-filter: blur(5px);
}

.text_modal_container {
    position: fixed;
    top: 125px;
    left: 50px;
    width: calc(100% - 100px);
    height: calc(100% - 225px);
    background: var(--dark-purple);
    color: var(--columbia-blue);
    border: 2px solid var(--teal-blue);
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.text_modal_close {
    position: fixed;
    top: 125px;
    right: 5px;
    color: #fff;
    background: #000;
    font-weight: bold;
    padding: 10px;
    cursor: pointer;
    z-index: 100;
}

.text_modal_content {
    padding: 20px;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.6;
}

.text_modal_content pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: monospace;
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 4px;
}

.text_modal_content h1,
.text_modal_content h2,
.text_modal_content h3,
.text_modal_content h4,
.text_modal_content h5,
.text_modal_content h6 {
    color: var(--columbia-blue);
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.text_modal_content a {
    color: var(--columbia-blue);
    text-decoration: underline;
}

.text_modal_content code {
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.type_video .image {
    border-radius: 10px;
}

.type_video .image::after {
    position: absolute;
    content: "";
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url(../image/video-overlay.svg);
}

.type_video_unsupported .image::after {
    position: absolute;
    content: "";
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff7;
    background-image: url(../image/video-unsupported-overlay.svg);
}

.database-error {
    position: absolute;
    width: 100%;
    text-align: center;
    padding: 10px 0;
    background: #ffcccc;
    border-top: 5px solid var(--teal-blue);
    left: 0;
    bottom: 35px;
}

.caption-rule {
    border-color: var(--maximum-purple);
    border-width: 1px;
    border-style: solid;
    margin-top: 15px;
}

#lightbox-caption-description textarea {
    width: 100%;
    height: 100px;
    resize: vertical;
    border-radius: 0;
    border: 2px var(--maximum-purple);
    background: #f6f6f6;
}

#lightbox-caption-description input[type=submit],
#lightbox-caption-tags input[type=submit] {
    width: 100%;
    border-radius: 0;
    border: 2px var(--maximum-purple);
    background: #f6f6f6;
    margin-top: 10px;
    padding: 5px;
    cursor: pointer;
    padding: 5px;
}

#lightbox-caption-description input[type=submit]:hover,
#lightbox-caption-tags input[type=submit]:hover {
    background: var(--columbia-blue);
}


/* Tags */
#add_tags{
    float:left;
    padding:5px 0px 0px;
    font-family:Arial;
    box-sizing: border-box;
  }
  #add_tags > span, .tag, #search span {
    cursor:pointer;
    display:block;
    float:left;
    color:#fff;
    background:#789;
    padding:5px;
    padding-right:25px;
    margin:0 5px 5px 0;
  }
  .tag {
      padding-right: 5px;
  }
  #add_tags > span:hover, #search span:hover{
    opacity:0.7;
  }
  #add_tags > span:after, #search span:after {
   position:absolute;
   content:"X";
   border:1px solid;
   padding:2px 5px;
   margin-left:3px;
   font-size:11px;
  }
  #add_tags > input{
    background:#eee;
    border:0;
    margin:4px 0;
    padding:7px;
    width:100%;
  }

  #add_tags_suggest, #search_term_suggest {
      background: #fff;
      margin: 0 4px;
      display: none;
      color: #000;
      margin: unset;
      margin-top: 5px;
      width: calc(100% - 20px);
      position: absolute;
  }

  #add_tags_suggest div, #search_term_suggest div {
      display: block;
      padding: 3px;
      cursor: pointer;
  }

  #add_tags_suggest div:hover, #search_term_suggest div:hover {
      background: #ccc;
  }

  #search {
      position: absolute;
      top: 100px;
      padding: 10px;
      background: var(--dark-purple);
      right: 0;
      border-left: 5px solid var(--teal-blue);
      border-bottom: 5px solid var(--teal-blue);
      display: none;
      width: 211px;
  }

#search-toggle {
    position: absolute; right: 10px; top: 67px; height: 22px; cursor: pointer;
}

.login {
    position: absolute;
    width: 200px;
    height: 150px;
    top: calc(50% - 100px);
    left: calc(50% - 100px);
}

.login input {
    width: 100%;
    box-sizing: border-box;
    margin: 5px 0 10px;
    border-radius: 0;
    padding: 5px;
    border: 1px solid var(--dark-purple);
}

.login .error {
    padding: 5px;
    text-align: center;
    background: var(--dark-purple);
    border: 2px solid var(--maximum-purple);
    color: #fff;
    margin-bottom: 10px;
}

#tags_container .options label { display: inline-block; width: 110px; padding-right: 5px; text-align: right; }


#tags_container input,
#tags_container select {
    display: inline-block;
    padding: 4px;
    width: 200px;
    box-sizing: border-box;
    margin-bottom: 5px;
}
#tags_container input[type=submit] {
    width: 315px;
}
#tags_container input[name=tag] { width: 284px; }
#search input[type=text] {
    margin-right: -1px;
}

.missing-image { background: url(../image/image.svg); }
.generating .missing-image { background: url(../image/spinner.gif); }

#menu-toggle, #menu-toggle-label {
    display: none;
}


    #lightbox.sidebar-open #lightbox-prev {
        right: 210px;
        left: unset;
        top: 10px;
    }

    #lightbox.sidebar-open #lightbox-download {
        display: block;
        right: 210px;
        left: unset;
        bottom: 10px;
    }

    #lightbox.sidebar-open #lightbox-download-raw {
        display: block;
        right: 135px;
        left: unset;
        bottom: 10px;
    }

    #lightbox-caption {
        display: none;
    }

    #lightbox.sidebar-open #lightbox-caption {
        display: block;
        position: fixed;
        right: 10px;
        left: unset;
        width: 250px;
        top: 70px;
        bottom: 70px;
        height: unset;
        transition: righ
    }

    #lightbox.sidebar-open #lightbox-container {
        right: 270px;
    }

    #lightbox:not(.sidebar-open) #lightbox-close {
        background: var(--dark-purple);
        padding: 5px 0 0 5px;
        border-radius: 50% 0 0 0;
    }

    #lightbox:not(.sidebar-open) #lightbox-prev {
        background: var(--dark-purple);
        padding: 0 5px 5px 0;
        border-radius: 0 0 50% 0;
    }

    #lightbox:not(.sidebar-open) #lightbox-next {
        background: var(--dark-purple);
        padding: 0 0 5px 5px;
        border-radius: 0 0 0 50%;
    }




    /*
    .item {
        width: calc(25% - 10px);
    }

    .item .image, .item .folder {
        margin: auto;
    }

    .item .label {
        width: unset;
        margin-top: 5px;
    }
    */

    header #sync {
        display: none;
    }

    #lightbox-caption {
        left: 10px;
        right: 10px;
        width: unset;
        height: 20vh;
    }

    #lightbox-container {
        top: calc(20vh + 80px);
        left: 10px;
        right: 10px;
        bottom: 70px;
    }

    #lightbox-info {
        display: none;
    }

    #lightbox-download, #lightbox-prev {
        right: unset;
        left: 10px;
    }

    #lightbox-download-raw {
        right: unset;
        left: 75px;
    }

    #lightbox-prev {
        left: 10px;
        top: 10px;
        right: unset;
        bottom: unset;
    }

    #lightbox-next {
        right: 10px;
        top: 10px;
        left: unset;
        bottom: unset;
    }

    #lightbox-close {
        right: 10px;
        bottom: 10px;
        left: unset;
        top: unset;
    }

    #lightbox-info {
        display: block;
        left: 10px;
        bottom: 10px;
        right: unset;
        top: unset;
    }

    #lightbox-download, #lightbox-download-raw {
        display: none;
    }

    #lightbox.sidebar-open #lightbox-prev {
        right: 210px;
        left: unset;
        top: 10px;
    }

    #lightbox.sidebar-open #lightbox-download {
        display: block;
        right: 210px;
        left: unset;
        bottom: 10px;
    }

    #lightbox.sidebar-open #lightbox-download-raw {
        display: block;
        right: 135px;
        left: unset;
        bottom: 10px;
    }

    #lightbox-caption {
        display: none;
    }

    #lightbox-container {
        top: 10px;
        left: 10px;
        bottom: 10px;
        right: 10px;
    }

    #lightbox.sidebar-open #lightbox-caption {
        display: block;
        position: fixed;
        right: 10px;
        left: unset;
        width: 250px;
        top: 70px;
        bottom: 70px;
        height: unset;
        transition: righ
    }

    #lightbox.sidebar-open #lightbox-container {
        right: 270px;
    }

    #lightbox:not(.sidebar-open) #lightbox-close {
        background: var(--dark-purple);
        padding: 5px 0 0 5px;
        border-radius: 50% 0 0 0;
    }

    #lightbox:not(.sidebar-open) #lightbox-prev {
        background: var(--dark-purple);
        padding: 0 5px 5px 0;
        border-radius: 0 0 50% 0;
    }

    #lightbox:not(.sidebar-open) #lightbox-next {
        background: var(--dark-purple);
        padding: 0 0 5px 5px;
        border-radius: 0 0 0 50%;
    }

@media screen and (max-width: 1000px) {
    header {
        height: 110px
    }

    #container {
        margin-top: 115px;
    }

    header #viewing {
        left: 12px;
        top: 55px;
    }

    header #file_count {
        top: 55px;
        display: none;
    }

    nav {
        display: none;
    }

    #menu-toggle-label {
        display: inline-block;
        position: absolute;
        right: 10px;
        top: 70px;
    }

    #menu-toggle-label img {
        width: 30px;
        height: 30px;
    }

    #menu-toggle:checked + nav {
        display: block;
        position: absolute;
        z-index: 999999;
        top: 115px;
        width: calc(100% - 5px);
    }

    nav ul li {
        display: block;
        background: #000;
    }

    nav ul li a {
        border-radius: 0;
    }

    #search {
        width: 100%;
        border-left: 0;
        box-sizing: border-box;
        top: 110px;
    }

    #search input[type=text] {
        width: calc(100% - 34px);
        margin-right: -7px;
    }

    #search-toggle {
        top: 78px;
        left: 12px;
    }
}

@media screen and (max-width: 650px) {
    #lightbox.sidebar-open #lightbox-container {
        right: 10px;
    }

    #lightbox.sidebar-open #lightbox-caption {
        right: 20px;
        left: 20px;
        width: auto;
        background-color: rgba(0,0,0,0.85);
        top: 20px;
    }

    #lightbox.sidebar-open #lightbox-prev, #lightbox.sidebar-open #lightbox-next {
        display: none;
    }

    #lightbox.sidebar-open #lightbox-download {
        left: 72px;
        background: var(--dark-purple);
        border-radius: 5px 5px 0 0;
        padding: 5px 5px 0 5px;
    }

    #lightbox.sidebar-open #lightbox-download-raw {
        left: 140px;
        background: var(--dark-purple);
        border-radius: 5px 5px 0 0;
        padding: 5px 5px 0 5px;
    }

    #lightbox.sidebar-open #lightbox-close {
        background: var(--dark-purple);
        padding: 5px 0 0 5px;
        border-radius: 50% 0 0 0;
    }
}


/*
@media screen and (max-width: 700px) {
    .item {
        width: calc(33.333333% - 10px);
    }
}

@media screen and (max-width: 500px) {
    .item {
        width: calc(50% - 10px);
    }
}

@media screen and (max-width: 350px) {
    .item {
        width: 100%;
    }
}

@media screen and (max-width: 1000px) and (orientation: landscape) {
    #lightbox-prev {
        left: 10px;
        top: 10px;
        right: unset;
        bottom: unset;
    }

    #lightbox-next {
        right: 10px;
        top: 10px;
        left: unset;
        bottom: unset;
    }

    #lightbox-close {
        right: 10px;
        bottom: 10px;
        left: unset;
        top: unset;
    }

    #lightbox-info {
        display: block;
        left: 10px;
        bottom: 10px;
        right: unset;
        top: unset;
    }

    #lightbox-download, #lightbox-download-raw {
        display: none;
    }

    #lightbox.sidebar-open #lightbox-prev {
        right: 210px;
        left: unset;
        top: 10px;
    }

    #lightbox.sidebar-open #lightbox-download {
        display: block;
        right: 210px;
        left: unset;
        bottom: 10px;
    }

    #lightbox.sidebar-open #lightbox-download-raw {
        display: block;
        right: 135px;
        left: unset;
        bottom: 10px;
    }

    #lightbox-caption {
        display: none;
    }

    #lightbox-container {
        top: 10px;
        left: 10px;
        bottom: 10px;
        right: 10px;
    }

    #lightbox.sidebar-open #lightbox-caption {
        display: block;
        position: fixed;
        right: 10px;
        left: unset;
        width: 250px;
        top: 70px;
        bottom: 70px;
        height: unset;
        transition: righ
    }

    #lightbox.sidebar-open #lightbox-container {
        right: 270px;
    }

    #lightbox:not(.sidebar-open) #lightbox-close {
        background: var(--dark-purple);
        padding: 5px 0 0 5px;
        border-radius: 50% 0 0 0;
    }

    #lightbox:not(.sidebar-open) #lightbox-prev {
        background: var(--dark-purple);
        padding: 0 5px 5px 0;
        border-radius: 0 0 50% 0;
    }

    #lightbox:not(.sidebar-open) #lightbox-next {
        background: var(--dark-purple);
        padding: 0 0 5px 5px;
        border-radius: 0 0 0 50%;
    }
}
*/
