/*
Overall style of the PWA app.

Color scheme:
- Background: #f2f2f2 (light gray)
- Primary: #1a73e8 (blue)
- Secondary: #ffbd00 (yellow)
- Accent: #e84118 (red)

Font: System font stack
*/

html {
    margin: 0;
    height: 100%;
}

body {
    margin: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f2f2f2;
}

body.waiting, body.waiting a:hover, body.waiting * {
    cursor: wait !important;
}

body.noscroll {
    overflow: hidden;
}

main>h1 {
    text-align: center;
}

form {
    display: contents;
}

h1 {
    overflow-wrap: break-word;
}

a {
    color: #1a73e8;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #cce4f6;
    border: 1px solid #005cb2;
    color: black;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.button-group > button:hover, .button-group:not(:has(button:hover)) > button:focus {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.hidden {
    display: none;
}

@keyframes fadeIn {
    0% {opacity: 0;}
    100% {opacity: 1;}
}

@keyframes fadeOut {
    0% {opacity: 1;}
    100% {opacity: 0;}
}

@keyframes slideInLeft {
    0% {left: 150vw;}
    100% {left: 50vw;}
}

@keyframes slideInRight {
    0% {left: -50vw;}
    100% {left: 50vw;}
}

@keyframes slideOutLeft {
    0% {left: 50vw;}
    100% {left: -50vw;}
}

@keyframes slideOutRight {
    0% {left: 50vw;}
    100% {left: 150vw;}
}

@keyframes slideIn {
    0% {transform: translate(0%, 100%); opacity: 0.5;}
    100% {transform: translate(0%, 0%); opacity: 1;}
}

@keyframes slideOut {
    0% {transform: translate(0%, 0%); opacity: 1;}
    100% {transform: translate(0%, 100%); opacity: 0.25;}
}

#popup-messages {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 1000;
}

.error {
    animation: slideIn 1s;
    padding: 8px;
    border: 2px solid #e84118;
    background-color: #ffbd00;
    font-size: 125%;
    cursor: pointer;
    min-width: 25vw;
    max-width: 75vw;
}

.info {
    animation: slideIn 1s;
    padding: 8px;
    border: 2px solid #1a73e8;
    background-color: #f2f2f2;
    font-size: 125%;
    cursor: pointer;
    min-width: 25vw;
    max-width: 75vw;
}

.progress {
    animation: slideIn 1s;
    padding: 8px;
    margin: 2px;
    border: 2px solid #1a73e8;
    background-color: #f2f2f2;
    font-size: 125%;
    cursor: pointer;
}

.progress-div {
    white-space: nowrap;
    padding-right: 3em;
}

.collectionThumbdiv {
    margin: 5px;
    border: 1px solid #ccc;
    padding: 0;
    text-align: center;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    min-width: fit-content;
    background-color: white;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.5s;
}

.collectionThumbdiv:hover, #collections:not(:has(.collectionThumbdiv:hover)) > .collectionThumbdiv:focus {
    transform: scale(1.05);
    border-color: #1a73e8;
}

.collectionThumbdiv .collectionThumbLabel {
    background-color: #f2f2f2;
    border-top: 1px solid #ccc;
    width: 100%;
}

.collectionThumbdiv.not-owner .collectionThumbLabel {
    background-color: #ffbd00;
}

.collectionThumbdiv img {
    object-fit: cover;
}

.collectionThumbdiv * {
    pointer-events: none;
}

.collectionThumbOfflineCheck {
    background-color: white;
}

.thumbdiv {
    margin: 10px;
    border: 1px solid #ccc;
    padding: 0;
    text-align: center;
    cursor: pointer;
    display: inline-grid;
    align-items: start;
    justify-content: end;
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.5s;
}

.thumbdiv * {
    pointer-events: none;
}

.thumbdiv:hover, #gallery:not(:has(.thumbdiv:hover)) .thumbdiv:focus {
    transform: scale(1.05);
    border-color: #1a73e8;
}

.thumbdiv img {
    grid-row: 1 / 2;
    grid-column: 1 / 2;
    object-fit: cover;
    border: 0;
    padding: 0;
}

.thumbdiv div.duration {
    grid-row: 1 / 2;
    grid-column: 1 / 2;
    text-align: right;
    margin: 5px;
}

.thumbdiv span.duration {
    background-color: rgba(255, 255, 255, 0.5);
    padding: 3px;
}

.date {
    margin-top: 2em;
}

.row {
    display: contents;
}

#gallery-list-div:not(:has(:hover))>div.row>div:focus, #gallery-list-div>div.row:not(:first-child):has(:hover)>div:first-child {
    border: 0;
    transform-origin: left;
    transform: scale(1.2);
    z-index: 5;
}

#gallery-list-div:not(:has(:hover))>div.row:focus-within>div {
    border-top: 1px dotted black;
    border-bottom: 1px dotted black;
}

#gallery-list-div>div.row:not(:first-child):has(div:hover)>div {
    border-top: 1px solid #1a73e8;
    border-bottom: 1px solid #1a73e8;
}

div.row.selected>div {
    background-color: #a5d6a7;
}

#gallery-list-div {
    display: grid;
    grid-template-columns: auto 2fr 1fr 1fr 1fr 1fr;
    align-items: stretch;
    border: 1px solid #ccc;
    margin: 1em;
    width: 95vw;
    overflow-x: scroll;
}

#gallery-list-div>div.row>div {
    white-space: nowrap;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.5s;
}

#gallery-list-div>div.row>div:nth-child(1) {
    position: sticky;
    left: 0;
}

#gallery-list-div>div.row>div>img {
    border: 1px solid #ccc;
    object-fit: cover;
    width: 48px;
    height: 48px;
}

#gallery-list-div .filename {
    overflow-x: hidden;
    max-width: 75vw;
    min-width: 20em;;
}

#gallery-list-div .size {
    justify-content: end;
}

#gallery-list-div .time,.content-type {
    justify-content: center;
}

#gallery-list-div span {
    padding-left: 1em;
    padding-right: 1em;
}

#gallery-list-div>div:nth-child(-n+1)>div {
    font-weight: bold;
}

#gallery-list-div>div:not(.selected):nth-child(2n)>div {
    background-color: white;
}

#gallery-list-div>div:not(.selected):nth-child(2n+1)>div {
    background-color: #f2f2f2;
}

.resetdb-button {
    position: absolute;
    right: 0;
    top: 0;
}

#trash-button {
}

#refresh-button {
}

#account-button {
}

#buttons {
    position: fixed;
    top: 0;
    right: 10px;
    z-index: 2;
    background-color: #e0e0e0;
}

#buttons button {
    margin-top: 0.2em;
}

#gallery {
    margin: 5px;
    background-color: #f5f5f5;
}

#collection-buttons {
    position: absolute;
    right: 10px;
}

#collection-buttons button {
    margin: 0.25em;
}

#messages {
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1;
}

#passphrase-div {
    position: fixed;
    left: 50vw;
    top: 40vh;
    transform: translate(-50%, -50%);
    padding: 10px;
    border: 1px solid #e84118;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
    max-width: 80vw;
}

#bit-scroller {
    position: fixed;
    left: 50vw;
    top: 75vh;
    transform: translate(-50%, 0);
    white-space: nowrap;
    font-size: 80%;
    font-family: monospace;
    letter-spacing: 0.5em;
    overflow: hidden;
    opacity: 0.2;
    display: grid;
    grid-template-columns: 10vw 1fr 10vw;
    align-items: center;
    column-gap: 2em;
}

#bit-scroller>div:nth-child(1) {
    justify-self: end;
}

#bit-scroller>div:nth-child(2) {
    justify-self: center;
    font-size: 300%;
}

#bit-scroller>div:nth-child(3) {
    justify-self: start;
}

#loggedout-div {
    position: fixed;
    left: 50vw;
    top: 40vh;
    transform: translate(-50%, -50%);
    padding: 0;
}

#passphrase-form {
    display: grid;
    grid-auto-columns: 1fr 2fr;
    grid-auto-rows: auto;
    gap: 0.5em;
    align-items: start;
}

#passphrase-buttons {
    grid-column: 1 / 3;
    justify-self: center;
    width: fit-content;
}

#login-form {
    display: grid;
    grid-auto-columns: 1fr 2fr;
    grid-auto-rows: auto;
    padding: 10px;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid #ccc;
    z-index: 1;
    background-color: white;
    resize: both;
}

#login-form * {
    margin: 0.25em;
}

#collections {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: inline-flex;
    align-items: flex-start;
    width: 100vw;
    max-width: 100vw;
    padding-top: 2em;
    padding-bottom: 1em;
    background-color: #e0e0e0;
    border-bottom: 1px solid #ccc;
}

#collections.fixed {
    animation: slideDown 0.75s;
    position: fixed;
    top: 0;
    z-index: 1;
}

#collections.noscroll {
    overflow-x: hidden;
}

@keyframes slideDown {
    0% {opacity: 0; top: -75%;}
    100% {opacity: 1; top: 0;}
}

.prompt-div {
    animation: fadeIn 0.25s;
    position: fixed;
    left: 50vw;
    top: 40vh;
    transform: translate(-50%, -50%);
    border: 7px double black;
    padding: 1em;
    background-color: white;
    z-index: 200;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    font-size: 150%;
    resize: both;
}

.prompt-input {
    padding: 0.5em;
}

.prompt-button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1em;
    margin-top: 2em;
}

.prompt-confirm-button {
    font-weight: bold;
    padding: 0.5em;
    border-radius: 8px;
    border: 2px solid #1a73e8;
    justify-self: start;
    white-space: nowrap;
}

.prompt-button-row:not(:hover) .prompt-confirm-button:focus {
    background-color: #a5d6a7;
}

.prompt-confirm-button:hover {
    background-color: #a5d6a7;
}

.prompt-cancel-button {
    font-weight: bold;
    padding: 0.5em;
    border-radius: 8px;
    border: 2px solid #e84118;
    justify-self: end;
    white-space: nowrap;
}

.prompt-button-row:not(:hover) .prompt-cancel-button:focus {
    background-color: #ffcdd2;
}

.prompt-cancel-button:hover {
    background-color: #ffcdd2;
}

.prompt-bg {
    animation: fadeIn 0.25s;
    background-color: rgba(224, 224, 224, 0.75);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: 199;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.popup {
    position: fixed;
    left: 50vw;
    top: 50vh;
    transform: translate(-50%, -50%);
    border: 1px solid #ccc;
    padding: 0;
    background-color: white;
    z-index: 100;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
    max-width: 95vw;
    max-height: 90vh;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.popup-header {
    border-bottom: 1px solid #ccc;
    background-color: #f2f2f2;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
}

.popup-name {
    grid-column: 1;
    overflow: hidden;
    white-space: nowrap;
}

.popup-info {
    cursor: pointer;
    grid-column: 2;
    text-align: right;
}

.popup-close {
    cursor: pointer;
    grid-column: 3;
    text-align: right;
}

.popup-media {
    max-height: 90vh;
    max-width: 95vw;
    object-fit: contain;
    display: block;
}

.popup-content {
    overflow: hidden;
    resize: both;
}

.popup-content > .arrow {
    position: absolute;
    top: 1em;
    height: calc(100% - 2em);
    font-size: 400%;
    opacity: 0;
    border: 0px;
    padding: 0px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.popup-content > .arrow:hover,.arrow:focus {
    opacity: 0.75;
}

.popup-content > .arrow.left {
    left: 0%;
    transform: translate(-50%, 0);
}

.popup-content > .arrow.right {
    right: 0%;
    transform: translate(50%, 0);
}

.upload {
    width: 90vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    align-content: stretch;
}

.popup-content {
}

.upload .popup-content {
    margin: 2em;
    overflow-y: auto;
}

.context-menu {
    animation: fadeIn 0.25s;
    position: fixed;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 3px;
    background-color: white;
    z-index: 100;
    display: flex;
    flex-direction: column;
    min-width: 10em;
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
}

.context-menu-item:hover, .context-menu:not(:has(:hover)) > .context-menu-item:focus {
    background-color: #f2f2f2;
}

.context-menu-div {
    padding: 0.2em;
    font-weight: bold;
}

button.context-menu-item {
    text-align: left;
    border: 0px;
    border-radius: 5px;
    background-color: white;
    color: black;
}

.context-menu-space {
    height: 0.5em;
    border: none;
    border-top: 2px dotted #ccc;
    width: 100%;
    padding: 0;
    margin: 0;
    margin-top: 0.25em;
}

.blur {
    animation: fadeIn 0.25s;
    background-color: rgba(255, 255, 255, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: 99;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#footer {
    position: fixed;
    bottom: 0.25em;
    right: 0.25em;
}

#add-button {
    position: fixed;
    bottom: 2em;
    right: 10px;
    background-color: #cce4f6;
    color: black;
    font-size: 200%;
    font-weight: bolder;
    border: 1px solid #005cb2;
    border-radius: 50%;
    height: 1.5em;
    width: 1.5em;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
}

#add-button:hover, #add-button:focus {
    border-color: #1a73e8;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

#upload-files-div {
    margin: 1em;
}

.upload-thumbnail {
    border: 1px solid #ccc;
    max-height: 160px;
}

.upload-item-div {
    margin: 1em;
    display: flex;
    flex-direction: row;
}

.upload-item-attrs {
    margin: 1em;
    display: flex;
    flex-direction: column;
}

.upload-item-remove-button {
    width: fit-content;
}

.dragging {
    opacity: 0.3;
}

.selected {
    box-shadow: 0 0 5px 5px #a5d6a7;
}

.empty-trash {
    float: right;
}

#collection-properties {
    padding: 0.5em;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    align-items: start;
    overflow-y: auto;
}

#collection-properties-thumbdiv {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

#collection-properties-thumb {
    border: 1px solid #ccc;
    object-fit: cover;
}

#collection-properties-delete {
    position: absolute;
    right: 0;
}

#collection-properties-name-label {
}

#collection-properties-name {
    user-select: all;
}

#collection-properties-perm {
    display: inline-flex;
    align-items: center;
}

#collection-properties select {
    width: 100%;
}

#collection-properties button {
    margin-left: 0.5em;
    margin-right: 0.5em;
}

#collection-properties-apply-button {
    grid-column: 1 / 3;
}

.email {
    user-select: all;
}

#backup-phrase-content {
    padding: 2em;
    overflow-y: auto;
    min-width: 75vw;
    max-width: 90vw;
}

#backup-phrase-value {
    border: 2px solid #ccc;
    margin: 0.5em;
    padding: 0.5em;
    color: #333;
    font-style: italic;
    background-color: #ffbd00;
    user-select: all;
}

#backup-phrase-content .warning {
    font-size: 150%;
    color: #e84118;
}

#key-backup-password-input {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

input[type=checkbox] {
    justify-self: start;
}

.tabs {
    margin: 0;
    padding: 0;
    display: inline-flex;
    width: 100%;
}

.tab {
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    background-color: #f2f2f2;
    padding: 0.5em;
    margin: 0;
    cursor: pointer;
}

.tab.select {
    background-color: white;
    z-index: 5;
    transform: translate(0, 2px);
    font-weight: bold;
}

.profile-popup {
    min-width: 60vw;
}

#profile-content {
    margin: 0.5em;
}

#profile-form {
    display: grid;
    grid-template-columns: 1fr 2fr;
    column-gap: 10px;
}

#profile-form > * {
    margin: 0.5em;
}

#profile-form-button {
    grid-column: 1 / 3;
}

#profile-form-security-key-list {
    display: grid;
    grid-template-columns: 1fr max-content max-content;
    align-items: center;
    justify-items: start;
    column-gap: 0.5em;
}

.profile-form-security-key-list-header {
    font-weight: bold;
}

#profile-form-security-key-list > input {
    width: calc(100% - 0.5em);
}

#profile-form-security-key-list > div {
    white-space: nowrap;
}

#profile-form-security-key-list > button {
}

#profile-form-delete-button {
    margin: 0.5em;
}

.highlight {
    box-shadow: 0 0 3px 3px #ffbd00;
}

.deleted-key {
    color: #ccc;
    text-decoration: line-through;
}

button.deleted-key {
    background-color: #e84118;
}

#preferences-content {
    margin: 2em;
    overflow-y: auto;
}

#preferences-cache-choices {
    display: grid;
    grid-template-columns: 1fr 9fr;
    align-items: start;
    row-gap: 0.5em;
    min-width: 75vw;
}

#preferences-cache-size {
    width: 5em;
    text-align: right;
}

#preferences-notifications-choices {
    display: grid;
    grid-template-columns: 1fr 9fr;
    align-items: start;
    row-gap: 0.5em;
}

#preferences-notifications-checkbox {
    justify-self: center;
}

.photo-editor-popup {
    width: 90vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    align-content: stretch;
}

.photo-editor-popup .popup-content {
    width: 100%;
    height: 100%;
    overflow-y: hidden;
}

#profile-form-enable-otp-div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.popup-download {
    min-width: 25vw;
    min-height: 25vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-console-popup {
    max-width: 95vw;
    height: 75vh;
    overflow-y: auto;
}

.admin-console-popup .popup-content {
    padding: 1em;
    display: flex;
    flex-flow: column;
    align-items: flex-start;
}

#admin-console-save-button {
    margin-top: 1em;
    align-self: stretch;
}

#admin-console-filter {
    margin-top: 1em;
    margin-bottom: 0.5em;
}

#admin-console-default-quota-value {
    width: 5em;
    text-align: right;
}

#admin-console-table {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 2fr;
    overflow-y: auto;
    overflow-x: scroll;
    justify-content: start;
    align-items: stretch;
    border: 1px solid #ccc;
    flex: 0 1 auto;
    width: 100%;
}

#admin-console-table>div.row:nth-child(-n+1)>div {
    font-weight: bold;
    position: sticky;
    top: 0;
}

#admin-console-table>div.row:nth-child(2n+1)>div {
    background-color: #f2f2f2;
}

#admin-console-table>div.row>div {
    padding: 0.5em;
}

#admin-console-table>div.row>div:nth-child(n+2):nth-child(-n+4) {
    text-align: center;
}

#upload-file-input {
    opacity: 0;
}

.quota-cell {
    display: flex;
}

.quota-cell > input {
    width: 5em;
    text-align: right;
}

.changed {
    background-color: #a5d6a7;
    box-shadow: 0 0 2px 2px #a5d6a7;
}

.image-popup {
    display: grid;
    align-items: start;
    justify-items: center;
}

.image-popup > * {
    grid-row: 1 / 2;
    grid-column: 1 / 2;
}

.exif-data {
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px;
    border: 1px solid #ccc;
    max-width: clamp(50%, 80vw, 80%);
    max-height: 80vh;
    overflow-wrap: break-word;
    overflow-y: auto;
}

.exif-more-details {
    cursor: pointer;
    padding-top: 1em;
}

.exif-details {
    white-space: pre;
}

#server-fingerprint {
    z-index: -1;
    position: fixed;
    bottom: 0.25em;
    width: 100%;
    text-align: center;
    font-family: monospace;
    font-weight: 500;
    font-size: min(5vh,5vw);
    opacity: 0.1;
}

.hide-no-mfa {
}

div.offline-overlay {
    position: absolute;
    bottom: 5px;
    color: black;
    background-color: #ffbd00;
    padding: 0.3em;
    border: 1px solid #ccc;
    border-radius: 0.3em;
}

audio.popup-media {
    padding-left: 5em;
    padding-right: 5em;
}

.popup-download iframe {
    width: 85vw;
    height: 85vh;
}

.icon {
  width: 2.5rem;
  height: 1.5rem;
  vertical-align: top;
}

[dir="rtl"] #buttons {
  right: auto;
  left: 10px;
}

[dir="rtl"] #collection-buttons {
  right: auto;
  left: 10px;
}

[dir="rtl"] #add-button {
  right: auto;
  left: 10px;
}

[dir="rtl"] #footer {
  right: auto;
  left: 0.25em;
}

[dir="rtl"] #popup-messages {
  right: auto;
  left: 0;
}

[dir="rtl"] .resetdb-button {
  right: auto;
  left: 0;
}

[dir="rtl"] #collection-properties-delete {
  right: auto;
  left: 0;
}

[dir="rtl"] .empty-trash {
  float: left;
}

[dir="rtl"] .thumbdiv div.duration {
  text-align: left;
}

[dir="rtl"] #gallery-list-div>div.row>div:nth-child(1) {
  left: auto;
  right: 0;
}

[dir="rtl"] #gallery-list-div .size {
  justify-content: start;
}

[dir="rtl"] .prompt-confirm-button {
  justify-self: end;
}

[dir="rtl"] .prompt-cancel-button {
  justify-self: start;
}

[dir="rtl"] .popup-info {
  text-align: left;
}

[dir="rtl"] .popup-close {
  text-align: left;
}

[dir="rtl"] .popup-content > .arrow.left {
  left: auto;
  right: 0%;
  transform: translate(50%, 0);
}

[dir="rtl"] .popup-content > .arrow.right {
  right: auto;
  left: 0%;
  transform: translate(-50%, 0);
}

[dir="rtl"] button.context-menu-item {
  text-align: right;
}
