// Document Link Type
#dlw_document_link_type {
    margin-top: 5px;
    margin-bottom: 5px;
    
    &:has(#dlw_file_attachment_details.active), &:has(#dlw_link_url_details.active) {
      margin-bottom: 1em;
    }
}
#document_link {
    &:has(#dlw_file_attachment_details.active), &:has(#dlw_link_url_details.active) {
        #dlw_document_link_type {
            margin-bottom: 1em;
        }
    }
}

// File Details Containers
#dlw_file_attachment_details,
#dlw_link_url_details,
.dlw_file_attached {
    display: none;

    &.active {
        display: flex;
        grid-column: 1 / span 3;
    }
}

#dlw_file_attachment_details.active {
    display: grid;
    grid-template-columns: repeat( 2, 0fr );
    row-gap: 10px;
}

#dlw_link_url_details.active {
    align-items: center;
}

// File Name Text
.dlw_file_name_text {
    word-wrap: break-word;
    line-height: 22px;
    max-width: 90%;
}

// Buttons
#dlw_add_file_button {
    grid-column: 2;
    margin-left: 0;
    margin-right: auto;
}

#dlw_remove_file_button {
    background: 0 0;
    border: none;
    cursor: pointer;
    height: 24px;
    padding: 0;
    text-indent: 0;
    width: 24px;

    .remove-file-icon:before {
        speak: none;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        background: 0 0;
        border-radius: 50%;
        color: #0073aa;
        content: "";
        display: block;
        line-height: 1.28;
        font: normal 16px/20px dashicons;
        height: 20px;
        margin-left: 2px;
        text-align: center;
        width: 20px;
    }

    &:hover .remove-file-icon:before {
        color: #c00;
    }
}

// Icons
.dlw-icon.link {
    color: #007cba;
    height: 24px;
    margin-right: 2px;
    width: 24px;
}

// Inputs
#dlw_direct_link_input {
    width: 100%;
}

#dlw_upload_metabox_description {
    margin-top: 3em;
    h3 {
        margin-top: 0;
        margin-bottom: 0.5em;
    }
    p {
        margin-bottom: 0;
    }
}

// Locked metabox styles
.postbox-locked {
    .hndle {
        cursor: default !important;
    }
}

#edit-slug-box:has(span) {
    margin-bottom: 12px;
}
#document_link {
    margin-top: 1.5em;
    .dlw-pro-only {
        font-weight: bold;
    }

    #version-history-after-html {
        margin-top: 1em;
        span {
            opacity: .75;
        }
    }
}

.dlw-help-tip {
    color: #666;
    display: inline-block;
    font-size: 18px;
    font-style: normal;
    height: 18px;
    line-height: 18px;
    position: relative;
    vertical-align: middle;
    width: 18px;
    text-decoration: none;

    &::after {
        font-family: Dashicons;
        speak: never;
        font-weight: 400;
        font-variant: normal;
        text-transform: none;
        line-height: 1;
        -webkit-font-smoothing: antialiased;
        margin: 0;
        text-indent: 0;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        text-align: center;
        content: "\f223";
        cursor: help
    }
}

[popover] {
    overflow: visible;
    background: white;
    border: 1px solid #C3C4C7;
    border-left: 4px solid #3871AC;
    box-shadow: 0px 4px 16px 0px #00000029;

    z-index: 1;
    margin: 0;

    .popover-inner {
      width: 540px;
      overflow: hidden;
      display: flex;
      align-items: center;
      gap: 2rem;
      padding: 23px 27px;

      // Mobile responsive layout
      @media (max-width: 782px) {
        width: calc(100vw - 40px);
        max-width: 320px;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 16px 20px;

        img {
          align-self: center;
          max-width: 80px;
          height: auto;
        }
      }

      @media (max-width: 480px) {
        width: calc(100vw - 20px);
        max-width: 280px;
        padding: 12px 16px;
        gap: 0.75rem;

        img {
          max-width: 60px;
        }
      }
    }

    .popover-arrow {
      position: absolute;
      pointer-events: none;
      z-index: 0;
    }

    h3 {
      font-weight: 600;
      font-size: 13px;
      line-height: 110%;
      letter-spacing: -1%;
      margin-top: 0;

      @media (max-width: 782px) {
        margin-bottom: 0;
        font-size: 14px;
        text-align: center;
        width: 100%;
      }
    }

    p {
      font-weight: 300;
      font-size: 13px;
      line-height: 22px;
      letter-spacing: -1%;

      @media (max-width: 782px) {
        font-size: 12px;
        line-height: 18px;
        text-align: center;
        margin-bottom: 12px;
      }
    }

    div:has(a.button) {
      @media (max-width: 782px) {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;

        a.button {
          text-align: center;
          justify-content: center;
          margin-right: 0;
        }
      }

      @media (max-width: 480px) {
        gap: 6px;
      }
    }

    a.button-secondary {
      margin-right: 6px;

      @media (max-width: 782px) {
        margin-right: 0;
      }
    }
}

#document-expiry {
    span {
        opacity: .75;
    }
}