html.light-mode {
    --upload-icon-cloud: #DDDEE1;
    --upload-icon-cloud-shadow: #B7B9BE;
    --upload-icon-accent: #1868DB;
    --upload-icon-accent-dark: #09326C;
    --upload-icon-arrow: #fff;
}

html.dark-mode {
    --upload-icon-cloud: #6B6E76;
    --upload-icon-cloud-shadow: #56585E;
    --upload-icon-accent: var(--ds-icon-accent-blue, #579DFF);
    --upload-icon-accent-dark: var(--ds-link, #579DFF);
    --upload-icon-arrow: #1D2125;
}

.attachments:target {
    border: none !important;
}

.attachments {
    margin-top: 24px;
    position: relative;

    > .expandable-group {
        margin-bottom: 0;
        align-items: center;
    }

    .group-label-static {
        cursor: auto;
    }
}

.attachments-count-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    block-size: 16px;
    border-radius: 2px;
    font-size: 12px;
    margin-left: 4px;
    background-color: var(--ds-background-neutral, #dddee1);
    color: var(--ds-text, #292a2e);
}

.attachments-content {
    display: flex;
    flex-direction: column;
    margin-top: 10px;

    .attachments-header-actions {
        position: absolute;
        top: 0;
        right: 0;
    }
}

.attachments-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

#attachments-wrapper {
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

.media-group {
    display: flex;
    flex-wrap: wrap;
}

.media-group-container {
    position: relative;
    display: flex;
    align-items: center;
}

.media-group-scroll-button {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: var(--ds-surface-overlay, #f4f5f7);
    box-shadow: var(--ds-shadow-overlay, 0 1px 6px 0 #0009);
    color: var(--ds-icon, #000);
    cursor: pointer;

    &:hover {
        background-color: var(--ds-surface-overlay-hovered, #dfe1e6);
        color: var(--ds-text-subtle, #000);
    }

    &:active {
        color: var(--ds-text-selected, #0052cc);
        background-color: var(--ds-background-selected, #deebff);
    }
}

.media-group-scroll-button-left {
    left: 8px;
}

.media-group-scroll-button-right {
    right: 8px;
}

.media-group-edge {
    display: none;
    position: absolute;
    top: 0;
    height: 100%;
    width: 2px;
    margin: 0;
    padding: 0;
    background-color: var(--ds-border, #0003);
    z-index: 5;
}

.media-group-edge-left {
    left: 0;
}

.media-group-edge-right {
    right: 0;
}

.attachments-wrapper-gallery {
    --list-unique-item-display: none;
    --media-background-position: 0;

    &#attachments-wrapper .media-group {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: hidden;
        scroll-behavior: smooth;
        padding-bottom: 0;
        gap: 0;

        .file {
            flex-shrink: 0;
        }
    }

    &:hover .media-group-scroll-button.visible {
        display: flex;
    }

    &:hover .media-group-edge:has(.media-group-scroll-button.visible) {
        display: block;
    }

    .attachments-table,
    .pagination {
        display: none;
    }

    .file:not(.media),
    .file.media.video {
        background-size: 4rem;
        background-repeat: no-repeat;
        background-position: center calc(50% - 20px);
    }

    .file-title {
        order: 2;
    }

    .file-wrapper .file-bottom {
        order: 1;
        justify-content: flex-end;
        visibility: hidden;
    }

    .file-wrapper:hover .file-bottom {
        visibility: visible;
    }

    .file-full:hover .file-tooltip {
        display: flex;
    }

    .attachment-buttons-wrapper .attachment-download,
    .attachment-buttons-wrapper .attachment-delete {
        display: flex;
        box-sizing: border-box;
        width: 26px;
        height: 26px;
        border-radius: 3px;
        cursor: default;
        justify-content: center;
        align-items: center;
        color: var(--ds-icon, #42526e);
        background-color: var(--ds-surface-overlay, #fffc);

        &:hover {
            background-color: var(--ds-surface-overlay-hovered, #fff9);
        }

        a, div {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            color: inherit;
            cursor: default;
        }
    }

    .media.video video {
        height: 0;
    }
}

.attachments-wrapper-list {
    &#attachments-wrapper .media-group {
        display: flex;
        flex-wrap: wrap;
        overflow-x: unset;
        padding-bottom: 0;
        gap: 0;
    }

    .media-group .file {
        display: none;
    }

    .file {
        background-image: none !important;
    }

    .media:hover .file-title {
        text-decoration: underline;
    }

    .media video {
        height: 0;
    }

    .file-full:hover .tooltip-image-preview {
        display: flex;
    }

    .pagination.visible {
        display: flex;
    }
}

.attachments:has(.attachments-wrapper-gallery) {
    .attachments-view.gallery-view {
        display: none;
    }

    .dropdown-wrapper {
        display: none;
    }
}

.attachments:has(.attachments-wrapper-list) .attachments-view.list-view {
    display: none;
}

.list-unique-item {
    display: var(--list-unique-item-display);
    align-items: center;
    justify-content: flex-start;
}

.file {
    background-color: var(--ds-background-neutral, #f4f5f7);
    border-radius: 3px;
    box-shadow: var(--ds-shadow-raised, 0 1px 1px #091e424f, 0 0 1px 0 #091e424f);
    color: var(--ds-text, #292a2e);
    height: 125px;
    margin: 4px;
    max-height: 100%;
    max-width: 100%;
    min-height: 3rem;
    position: relative;
    width: 156px;

    &.media {
        background-size: cover;
        background-repeat: no-repeat;
        background-position-y: var(--media-background-position);
    }
}

.file-full,
.file-wrapper {
    border-radius: 3px;
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.file-full {
    background-color: var(--ds-background-neutral, #f4f5f7);
    color: var(--ds-text, #292a2e);

    &:hover {
        background-color: var(--ds-blanket, #091e427a);
    }
}

.media:hover .file-full {
    cursor: pointer;
    visibility: visible;
}

.file-wrapper {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    word-break: break-word;
}

.file-title {
    font-size: 11px;
    line-height: 14px;
    overflow-y: auto;
    overflow-wrap: break-word;
    white-space: initial;
    width: 100%;
    background-color: var(--ds-surface, #fff);
    color: var(--ds-text, #172b4d);
    margin: 0;
    padding: 4px 8px;
}

.file-title-name {
    display: flex;
    white-space: nowrap;
    font-weight: 600;
    min-width: 0;
}

.file-title-date {
    display: block;
    font-weight: 400;
}

.file-bottom {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.file-size {
    display: var(--list-unique-item-display);
    align-items: center;
    width: 4rem;
}

.file-created-at {
    width: 14rem;
}

.file-labels {
    width: 15rem;
    gap: 10px;
}

.file-comment {
    width: 25rem;
}

.file-type-icon {
    margin-right: 8px;
    width: 3.5rem;
}

.attachment-buttons-wrapper {
    display: flex;
    flex-direction: row;
    box-sizing: border-box;
    padding: 8px;
    cursor: default;
    gap: 8px;
    color: var(--ds-text, #292a2e);
}

.file-tooltip {
    background-color: var(--ds-background-neutral-bold, #172b4d);
    border-radius: 4px;
    color: var(--ds-text-inverse, #fff);
    display: none;
    flex-direction: column;
    min-height: fit-content;
    padding: 16px;
    gap: 2px;
    position: fixed;
    width: 400px;
    white-space: normal;
    word-break: break-word;
    z-index: 10;
    margin: 10px;
}

.file-tooltip-row {
    display: flex;
    gap: 5px;
}

.tooltip-image-preview {
    --width: 8rem;
    --height: 6rem;
    background-position: center;
    background-size: cover;
    border-radius: 4px;
    box-shadow: rgba(9, 30, 66, 0.2) 0 1px 1px, rgba(9, 30, 66, 0.24) 0 0 1px 0;
    display: none;
    height: 6rem;
    bottom: calc(var(--height) / 2 + 0.25rem);
    left: 0.2rem;
    position: absolute;
    width: var(--width);
    z-index: 2;
}

.toggle-attachments-view-button,
.attachments-add-button {
    background: none;
    border: none;
    color: var(--ds-text-subtle, #505258);
    cursor: pointer;
    padding: 0;
    border-radius: 3px;

    &:hover {
        background-color: var(--ds-background-neutral-subtle-hovered, #091e4214);
    }

    &:active {
        background-color: var(--ds-background-neutral-subtle-pressed, #b3d4ff);
    }
}

.toggle-attachments-view-button,
.attachments-view {
    align-items: center;
    display: flex;
    flex-direction: row;
    justify-items: center;
}

.attachments-table {
    border-bottom: 2px solid var(--ds-background-neutral-subtle-pressed);
    border-collapse: separate;
    border-spacing: 0;
    box-sizing: border-box;
    color: var(--ds-text);
    font-size: 14px;
    line-height: 20px;
    table-layout: fixed;
    width: 100%;

    button {
        appearance: none;
        font-family: inherit;
        background-color: initial;
        border: none;
        display: flex;
        align-items: center;
        line-height: normal;
        margin: 0;
        padding: 0;
    }

    thead {
        vertical-align: middle;
    }

    tbody tr {
        height: 42px;
        background-color: var(--ds-background-neutral-subtle, #0000);
        color: var(--ds-text, #292a2e);

        &:hover {
            background-color: var(--ds-background-neutral-subtle-hovered);
        }
    }

    tbody td {
        white-space: nowrap;

        &:first-child {
            padding: 4px 8px;
        }
    }
}

.attachments-table-header-cell {
    border-bottom: 2px solid var(--ds-background-neutral-subtle-pressed);
    color: var(--ds-text-subtle);
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
    line-height: 16px;
    padding: 4px 8px 4px 0;
    position: relative;
    text-align: left;
    vertical-align: middle;

    &:nth-child(2) {
        width: 82px;
        padding: 4px 8px;
    }

    &:nth-child(3) {
        width: 210px;
        padding: 4px 8px;
    }

    &:nth-child(4) {
        width: 116px;
    }
}

.attachments-table tbody td:nth-child(2) {
    width: 82px;
    padding: 4px 8px;
}

.attachments-table tbody td:nth-child(3) {
    width: 210px;
    padding: 4px 8px;
}

.attachments-table-header-content {
    display: flex;
    align-items: center;
    border: none;
    text-align: left;

    span:first-child {
        font-weight: 650;
        padding-right: 4px;
        font-size: 12px;
        color: var(--ds-text-subtle, #505258);
        white-space: nowrap;
    }
}

.attachments-table-actions-cell {
    padding: 4px 8px;
}

.attachment-info-trigger {
    position: relative;
}

.attachments-table-actions {
    display: grid;
    grid-template-columns: 32px 32px 32px;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;

    button {
        border-radius: 3px;
        color: var(--ds-text-subtle, #505258);
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;

        &:hover {
            background-color: var(--ds-background-neutral-subtle-hovered, #091e4214);
        }

        span {
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
    }
}

.attachment-name-cell {
    display: flex;
    align-items: center;
    min-width: 0;
}

.attachment-name-base {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-name-ext {
    flex-shrink: 0;
    white-space: nowrap;
}

.attachment-preview {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    margin-right: 10px;
}

.attachment-preview-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ds-text-subtle, #505258);
}

.confirmation-modal-header {
    padding: 10px 0 20px;
    color: var(--ds-text, #292a2e);
}

.confirmation-modal-heading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.confirmation-modal-icon {
    display: flex;
    align-items: center;
    color: var(--ds-icon-danger, #C9372C);
}

.confirmation-modal-title {
    font-size: 20px;
    font-weight: 650;
}

.confirmation-modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: right;
}

.confirmation-modal-delete {
    background: var(--ds-background-danger-bold, #C9372C);
    color: var(--ds-text-inverse, #FFFFFF) !important;
    padding: 0 10px;
    font-weight: 500;
    font-family: inherit;

    &:hover {
        background: var(--ds-background-danger-bold-hovered, #AE2E24);
    }

    &:active {
        background: var(--ds-background-danger-bold-pressed, #872821);
    }
}

.confirmation-modal-cancel {
    margin-left: 5px;
    color: var(--ds-text-subtle, #505258) !important;
    background-color: transparent;
    padding: 0 10px;
    font-weight: 500;
    font-family: inherit;

    &:hover {
        background: var(--ds-background-neutral-subtle-hovered, #0515240F);
    }

    &:active {
        background: var(--ds-background-neutral-subtle-pressed, #0B120E24);
    }
}

.attachments-drop-overlay {
    background-color: var(--ds-background-accent-blue-subtlest);
    border: 2px dashed var(--ds-border-focused);
    border-radius: 4px;
    box-sizing: border-box;
    display: none;
    height: 100%;
    opacity: 0.7;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 300;
}

#attachments-wrapper.drag-over {
    .attachments-drop-overlay {
        display: block;
    }

    .upload-attachment-container-drop-info {
        display: flex;
    }
}

.upload-attachment-container-drop-info {
    align-items: center;
    border-radius: 9999px;
    bottom: 32px;
    column-gap: 4px;
    display: none;
    font-size: 14px;
    font-weight: 400;
    left: 0;
    line-height: 20px;
    margin: 0 auto;
    padding: 2px 16px 2px 6px;
    pointer-events: auto;
    position: absolute;
    right: 0;
    row-gap: 4px;
    z-index: 400;
    box-shadow: var(--ds-shadow-raised);
    background-color: var(--ds-surface-raised);
    color: var(--ds-text);
    width: fit-content;
}

.upload-drop-icon {
    display: flex;
    align-items: center;
    width: 50px;
    height: 50px;
    position: relative;
    margin: 8px 4px;
    padding: 0;
}

.upload-drop-text {
    font-size: 16px;
}

.attachment-upload-icon {
    .cloud {
        color: var(--upload-icon-cloud);
    }

    .cloud-shadow {
        color: var(--upload-icon-cloud-shadow);
    }

    .accent {
        color: var(--upload-icon-accent);
    }

    .accent-dark {
        color: var(--upload-icon-accent-dark);
    }

    .arrow {
        color: var(--upload-icon-arrow);
    }
}

main.attachment-share {
    height: calc(100vh - 80px);

    .content {
        max-width: 1800px;
        margin: 0 auto;
    }

    .page-footer {
        position: absolute;
        display: block;
    }
}

@media only screen and (min-width: 500px) {
    main.attachment-share .content {
        padding: 15px;
    }
}

